mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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
|
end
|
||||||
|
|
||||||
if is_my_own?(post)
|
if is_my_own?(post)
|
||||||
|
|
||||||
|
return false if @user.silenced?
|
||||||
|
|
||||||
if post.hidden?
|
if post.hidden?
|
||||||
return false if post.hidden_at.present? &&
|
return false if post.hidden_at.present? &&
|
||||||
post.hidden_at >= SiteSetting.cooldown_minutes_after_hiding_posts.minutes.ago
|
post.hidden_at >= SiteSetting.cooldown_minutes_after_hiding_posts.minutes.ago
|
||||||
|
@ -1174,6 +1174,11 @@ describe Guardian do
|
|||||||
|
|
||||||
describe 'a Post' 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
|
it 'returns false when not logged in' do
|
||||||
expect(Guardian.new.can_edit?(post)).to be_falsey
|
expect(Guardian.new.can_edit?(post)).to be_falsey
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user