FIX: Permit unpinning an unlisted topic.

This commit is contained in:
Bianca Nenciu 2018-09-12 20:52:24 +02:00 committed by Sam
parent f666d72606
commit 8f39cf6bfc
2 changed files with 31 additions and 2 deletions

View File

@ -184,8 +184,8 @@ export default createWidget("topic-admin-menu", {
const isPrivateMessage = topic.get("isPrivateMessage");
if (!isPrivateMessage && topic.get("visible")) {
const featured = topic.get("pinned_at") || topic.get("isBanner");
const featured = topic.get("pinned_at") || topic.get("isBanner");
if (!isPrivateMessage && (topic.get("visible") || featured)) {
buttons.push({
className: "topic-admin-pin",
action: "showFeatureTopic",

View File

@ -7,6 +7,18 @@ acceptance("Topic", {
server.put("/posts/398/wiki", () => {
return helper.response({});
});
server.get("/topics/feature_stats.json", () => {
return helper.response({
pinned_in_category_count: 0,
pinned_globally_count: 0,
banner_count: 0
});
});
server.put("/t/280/make-banner", () => {
return helper.response({});
});
}
});
@ -215,6 +227,23 @@ QUnit.test("remove featured link", async assert => {
// assert.ok(!exists('.title-wrapper .topic-featured-link'), 'link is gone');
});
QUnit.test("Unpinning unlisted topic", async assert => {
await visit("/t/internationalization-localization/280");
await click(".toggle-admin-menu");
await click(".topic-admin-pin .btn");
await click(".btn-primary:last");
await click(".toggle-admin-menu");
await click(".topic-admin-visible .btn");
await click(".toggle-admin-menu");
assert.ok(
exists(".topic-admin-pin"),
"it should show the multi select menu"
);
});
QUnit.test("selecting posts", async assert => {
await visit("/t/internationalization-localization/280");
await click(".toggle-admin-menu");