mirror of
https://github.com/discourse/discourse.git
synced 2025-03-20 09:35:40 +08:00
BUGFIX: make the system_user an elder (TL=4)
Otherwise it won't be able to create topic when the `min_trust_to_create_topic` is > 0
This commit is contained in:
parent
5a3c77abd9
commit
1fd71bb237
@ -22,4 +22,5 @@ User.seed do |u|
|
|||||||
u.email_direct = false
|
u.email_direct = false
|
||||||
u.approved = true
|
u.approved = true
|
||||||
u.email_private_messages = false
|
u.email_private_messages = false
|
||||||
|
u.trust_level = TrustLevel.levels[:elder]
|
||||||
end
|
end
|
||||||
|
@ -27,18 +27,17 @@ module TopicGuardian
|
|||||||
|
|
||||||
# Creating Methods
|
# Creating Methods
|
||||||
def can_create_topic?(parent)
|
def can_create_topic?(parent)
|
||||||
user && user.trust_level >= SiteSetting.min_trust_to_create_topic.to_i && can_create_post?(parent)
|
user &&
|
||||||
|
user.trust_level >= SiteSetting.min_trust_to_create_topic.to_i &&
|
||||||
|
can_create_post?(parent)
|
||||||
end
|
end
|
||||||
|
|
||||||
def can_create_topic_on_category?(category)
|
def can_create_topic_on_category?(category)
|
||||||
can_create_topic?(nil) && (
|
can_create_topic?(nil) &&
|
||||||
!category ||
|
(!category || Category.topic_create_allowed(self).where(:id => category.id).count == 1)
|
||||||
Category.topic_create_allowed(self).where(:id => category.id).count == 1
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def can_create_post_on_topic?(topic)
|
def can_create_post_on_topic?(topic)
|
||||||
|
|
||||||
# No users can create posts on deleted topics
|
# No users can create posts on deleted topics
|
||||||
return false if topic.trashed?
|
return false if topic.trashed?
|
||||||
|
|
||||||
@ -82,4 +81,4 @@ module TopicGuardian
|
|||||||
(not(topic.private_message?) || authenticated? && (topic.all_allowed_users.where(id: @user.id).exists? || is_staff?))
|
(not(topic.private_message?) || authenticated? && (topic.all_allowed_users.where(id: @user.id).exists? || is_staff?))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user