FIX: "Toggle topic bump" wasn't visible for TL4 users

This commit is contained in:
Gerhard Schlager 2019-01-02 20:15:12 +01:00
parent a61d9deba1
commit dc477d1228
2 changed files with 18 additions and 3 deletions

View File

@ -193,8 +193,11 @@ export default DropdownSelectBoxComponent.extend({
}
const currentUser = Discourse.User.current();
const showToggleTopicBump =
currentUser &&
(currentUser.get("staff") || currentUser.trust_level === 4);
if (action === REPLY && currentUser && currentUser.get("staff")) {
if (action === REPLY && showToggleTopicBump) {
items.push({
name: I18n.t("composer.composer_actions.toggle_topic_bump.label"),
description: I18n.t("composer.composer_actions.toggle_topic_bump.desc"),

View File

@ -291,10 +291,10 @@ QUnit.test("replying to post as staff", async assert => {
assert.equal(composerActions.rowByIndex(4).value(), "toggle_topic_bump");
});
QUnit.test("replying to post as regular user", async assert => {
QUnit.test("replying to post as TL3 user", async assert => {
const composerActions = selectKit(".composer-actions");
replaceCurrentUser({ staff: false, admin: false });
replaceCurrentUser({ staff: false, admin: false, trust_level: 3 });
await visit("/t/internationalization-localization/280");
await click("article#post_3 button.reply");
await composerActions.expand();
@ -309,6 +309,18 @@ QUnit.test("replying to post as regular user", async assert => {
});
});
QUnit.test("replying to post as TL4 user", async assert => {
const composerActions = selectKit(".composer-actions");
replaceCurrentUser({ staff: false, admin: false, trust_level: 4 });
await visit("/t/internationalization-localization/280");
await click("article#post_3 button.reply");
await composerActions.expand();
assert.equal(composerActions.rows().length, 4);
assert.equal(composerActions.rowByIndex(3).value(), "toggle_topic_bump");
});
QUnit.test(
"replying to first post - reply_as_private_message",
async assert => {