REFACTOR: Edit title respects min trust to edit post

Follow up to: 241d8f6452
This commit is contained in:
Blake Erickson 2020-02-05 10:23:29 -07:00
parent 49c750ca78
commit 926d5f1c0a

View File

@ -4,14 +4,9 @@ module LimitedEdit
extend ActiveSupport::Concern
def edit_time_limit_expired?(user)
return true if user.trust_level < SiteSetting.min_trust_to_edit_post
time_limit = user_time_limit(user)
if user.trust_level < SiteSetting.min_trust_to_edit_post
true
elsif created_at && time_limit > 0
created_at < time_limit.minutes.ago
else
false
end
created_at && (time_limit > 0) && (created_at < time_limit.minutes.ago)
end
private