FEATURE: Allow TL4 users to reset bump date

This commit is contained in:
Gerhard Schlager 2019-01-02 16:57:05 +01:00
parent e8053d6e7d
commit c30996129f
3 changed files with 10 additions and 12 deletions

View File

@ -211,7 +211,6 @@ export default createWidget("topic-admin-menu", {
});
}
if (this.currentUser.get("staff")) {
buttons.push({
className: "topic-admin-reset-bump-date",
buttonClass: "btn-default",
@ -219,7 +218,6 @@ export default createWidget("topic-admin-menu", {
icon: "anchor",
label: "actions.reset_bump_date"
});
}
if (!isPrivateMessage) {
buttons.push({

View File

@ -148,6 +148,6 @@ module TopicGuardian
end
def can_update_bumped_at?
is_staff?
is_staff? || @user.has_trust_level?(TrustLevel[4])
end
end

View File

@ -2620,7 +2620,7 @@ RSpec.describe TopicsController do
expect(response.status).to eq(403)
end
[:user, :trust_level_4].each do |user|
[:user].each do |user|
it "denies access for #{user}" do
sign_in(Fabricate(user))
put "/t/#{topic.id}/reset-bump-date.json"
@ -2635,7 +2635,7 @@ RSpec.describe TopicsController do
end
end
[:admin, :moderator].each do |user|
[:admin, :moderator, :trust_level_4].each do |user|
it "should reset bumped_at as #{user}" do
sign_in(Fabricate(user))
topic = Fabricate(:topic, bumped_at: 1.hour.ago)