DEV: Make the assign tab in the user menu link to the assign page (#380)

As of 12ebdf0ff0, it's possible to make tabs in the experimental user menu link to a page when they're clicked on when they're active. This commit makes the assign tab links to `/my/activity/assigned` when it's active.
This commit is contained in:
Osama Sayegh 2022-09-19 17:11:37 +03:00 committed by GitHub
parent 1a5b02755d
commit cef3d23766
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 1 deletions

View File

@ -36,6 +36,10 @@ export default {
get notificationTypes() {
return ["assigned"];
}
get linkWhenActive() {
return `${this.currentUser.path}/activity/assigned`;
}
};
});
}

View File

@ -5,7 +5,7 @@ import {
queryAll,
updateCurrentUser,
} from "discourse/tests/helpers/qunit-helpers";
import { click, visit } from "@ember/test-helpers";
import { click, currentURL, visit } from "@ember/test-helpers";
import { test } from "qunit";
import I18n from "I18n";
import { withPluginApi } from "discourse/lib/plugin-api";
@ -261,6 +261,15 @@ acceptance("Discourse Assign | experimental user menu", function (needs) {
markRead = true;
return helper.response({ success: true });
});
server.get("/topics/messages-assigned/eviltrout.json", () => {
return helper.response({
users: [],
topic_list: {
topics: [],
},
});
});
});
needs.hooks.afterEach(() => {
@ -299,6 +308,19 @@ acceptance("Discourse Assign | experimental user menu", function (needs) {
);
});
test("clicking on the assign tab when it's already selected navigates to the user's assignments page", async function (assert) {
await visit("/");
await click(".d-header-icons .current-user");
await click("#user-menu-button-assign-list");
await click("#user-menu-button-assign-list");
assert.strictEqual(
currentURL(),
"/u/eviltrout/activity/assigned",
"user is navigated to their assignments page"
);
});
test("displays unread assign notifications on top and fills the remaining space with read assigns", async function (assert) {
await visit("/");
await click(".d-header-icons .current-user");