mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Internal renaming of elder,leader,regular,basic to numbers
Changed internals so trust levels are referred to with TrustLevel[1], TrustLevel[2] etc. This gives us much better flexibility naming trust levels, these names are meant to be controlled by various communities.
This commit is contained in:
@@ -10,7 +10,7 @@ module PostGuardian
|
||||
|
||||
if authenticated? && post
|
||||
# we allow flagging for trust level 1 and higher
|
||||
(is_flag && @user.has_trust_level?(:basic) && not(already_did_flagging)) ||
|
||||
(is_flag && @user.has_trust_level?(TrustLevel[1]) && not(already_did_flagging)) ||
|
||||
|
||||
# not a flagging action, and haven't done it already
|
||||
not(is_flag || already_taken_this_action) &&
|
||||
@@ -25,7 +25,7 @@ module PostGuardian
|
||||
not(action_key == :like && is_my_own?(post)) &&
|
||||
|
||||
# new users can't notify_user because they are not allowed to send private messages
|
||||
not(action_key == :notify_user && !@user.has_trust_level?(:basic)) &&
|
||||
not(action_key == :notify_user && !@user.has_trust_level?(TrustLevel[1])) &&
|
||||
|
||||
# no voting more than once on single vote topics
|
||||
not(action_key == :vote && opts[:voted_in_topic] && post.topic.has_meta_data_boolean?(:single_vote))
|
||||
@@ -76,7 +76,7 @@ module PostGuardian
|
||||
return false
|
||||
end
|
||||
|
||||
if is_staff? || @user.has_trust_level?(:elder)
|
||||
if is_staff? || @user.has_trust_level?(TrustLevel[4])
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -149,7 +149,7 @@ module PostGuardian
|
||||
end
|
||||
|
||||
authenticated? &&
|
||||
(is_staff? || @user.has_trust_level?(:elder) || @user.id == post.user_id) &&
|
||||
(is_staff? || @user.has_trust_level?(TrustLevel[4]) || @user.id == post.user_id) &&
|
||||
can_see_post?(post)
|
||||
end
|
||||
|
||||
@@ -162,7 +162,7 @@ module PostGuardian
|
||||
end
|
||||
|
||||
def can_wiki?
|
||||
is_staff? || @user.has_trust_level?(:elder)
|
||||
is_staff? || @user.has_trust_level?(TrustLevel[4])
|
||||
end
|
||||
|
||||
def can_see_flagged_posts?
|
||||
|
||||
@@ -22,13 +22,13 @@ module TopicGuardian
|
||||
# No users can create posts on deleted topics
|
||||
return false if topic.trashed?
|
||||
|
||||
is_staff? || (authenticated? && user.has_trust_level?(:elder)) || (not(topic.closed? || topic.archived? || topic.trashed?) && can_create_post?(topic))
|
||||
is_staff? || (authenticated? && user.has_trust_level?(TrustLevel[4])) || (not(topic.closed? || topic.archived? || topic.trashed?) && can_create_post?(topic))
|
||||
end
|
||||
|
||||
# Editing Method
|
||||
def can_edit_topic?(topic)
|
||||
return false if Discourse.static_doc_topic_ids.include?(topic.id) && !is_admin?
|
||||
return true if is_staff? || user.has_trust_level?(:leader)
|
||||
return true if is_staff? || user.has_trust_level?(TrustLevel[3])
|
||||
return false if topic.archived
|
||||
is_my_own?(topic)
|
||||
end
|
||||
@@ -46,7 +46,7 @@ module TopicGuardian
|
||||
end
|
||||
|
||||
def can_reply_as_new_topic?(topic)
|
||||
authenticated? && topic && not(topic.private_message?) && @user.has_trust_level?(:basic)
|
||||
authenticated? && topic && not(topic.private_message?) && @user.has_trust_level?(TrustLevel[1])
|
||||
end
|
||||
|
||||
def can_see_deleted_topics?
|
||||
|
||||
Reference in New Issue
Block a user