FEATURE: silenced users should not be allowed to edit posts
This commit is contained in:
parent
33b5cc6bbd
commit
91e0a77a60
|
@ -147,6 +147,9 @@ module PostGuardian
|
|||
end
|
||||
|
||||
if is_my_own?(post)
|
||||
|
||||
return false if @user.silenced?
|
||||
|
||||
if post.hidden?
|
||||
return false if post.hidden_at.present? &&
|
||||
post.hidden_at >= SiteSetting.cooldown_minutes_after_hiding_posts.minutes.ago
|
||||
|
|
|
@ -1174,6 +1174,11 @@ describe Guardian do
|
|||
|
||||
describe 'a Post' do
|
||||
|
||||
it 'returns false for silenced users' do
|
||||
post.user.silenced_till = 1.day.from_now
|
||||
expect(Guardian.new(post.user).can_edit?(post)).to be_falsey
|
||||
end
|
||||
|
||||
it 'returns false when not logged in' do
|
||||
expect(Guardian.new.can_edit?(post)).to be_falsey
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue