mirror of
https://github.com/discourse/discourse.git
synced 2024-12-21 14:03:57 +08:00
fc2259d1c8
Admin can create up to 50 custom flags. It is limited for performance reasons. When the limit is reached "Add button" is disabled and backend is protected by guardian.
20 lines
373 B
Ruby
20 lines
373 B
Ruby
# frozen_string_literal: true
|
|
|
|
module FlagGuardian
|
|
def can_edit_flag?(flag)
|
|
@user.admin? && !flag.system? && !flag.used?
|
|
end
|
|
|
|
def can_create_flag?
|
|
@user.admin? && Flag.custom.count < SiteSetting.custom_flags_limit
|
|
end
|
|
|
|
def can_toggle_flag?
|
|
@user.admin?
|
|
end
|
|
|
|
def can_reorder_flag?(flag)
|
|
@user.admin? && flag.name_key != "notify_user"
|
|
end
|
|
end
|