added pro version enabling in annoucment settings
This commit is contained in:
parent
b974cb771a
commit
bfbececdbf
|
@ -146,9 +146,13 @@ class Admin::AnnouncementsController < OrbitAdminController
|
|||
bulletin = Bulletin.new(bps)
|
||||
bulletin.create_user_id = current_user.id
|
||||
bulletin.update_user_id = current_user.id
|
||||
# if user_can_approve?
|
||||
if AnnouncementSetting.is_pro?
|
||||
if user_can_approve?
|
||||
bulletin.approved = true
|
||||
# end
|
||||
end
|
||||
else
|
||||
bulletin.approved = true
|
||||
end
|
||||
|
||||
bulletin.save
|
||||
build_email(bulletin)
|
||||
|
|
|
@ -3,6 +3,7 @@ class AnnouncementSetting
|
|||
include Mongoid::Timestamps
|
||||
|
||||
field :top_limit, type: Integer, :default => 0
|
||||
field :pro_enabled, type: Boolean, :default => false
|
||||
|
||||
def self.check_limit_for_user(user_id, b_id = nil)
|
||||
limit = self.first.top_limit rescue 0
|
||||
|
@ -10,4 +11,8 @@ class AnnouncementSetting
|
|||
count = Bulletin.where(:is_top => true, :create_user_id => user_id, :id.ne => b_id).count
|
||||
return count < limit
|
||||
end
|
||||
|
||||
def self.is_pro?
|
||||
self.first.pro_enabled
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue