DEV: Simplifying rendering of secondary nav links for group inbox (#19164)

Also run user private messages page tests against redesign user page nav
This commit is contained in:
Alan Guo Xiang Tan 2022-11-24 05:07:41 +08:00 committed by GitHub
parent 01aa42c4b4
commit 470b8b8984
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 587 additions and 588 deletions

View File

@ -7,7 +7,7 @@
</ol>
{{/if}}
<HorizontalOverflowNav>
<HorizontalOverflowNav @className="messages-nav">
{{#if @isPersonal}}
<li class="messages-latest">
<LinkTo @route="userPrivateMessages.index" @model={{@user}}>
@ -47,39 +47,37 @@
</li>
{{/if}}
{{#each @user.groups as |group|}}
{{#if (and @isGroup (eq @groupFilter group.name))}}
{{#if @viewingSelf}}
{{#if @isGroup}}
<li class="messages-group-latest">
<LinkTo @route="userPrivateMessages.group" @model={{group.name}}>
<LinkTo @route="userPrivateMessages.group" @model={{@group.name}}>
{{d-icon "envelope"}}
<span>{{i18n "categories.latest"}}</span>
</LinkTo>
</li>
{{#if @viewingSelf}}
<li class="messages-group-new">
<LinkTo @route="userPrivateMessages.groupNew" @model={{group.name}} class="new">
<LinkTo @route="userPrivateMessages.groupNew" @model={{@group.name}} class="new">
{{d-icon "exclamation-circle"}}
<span>{{@newLinkText}}</span>
</LinkTo>
</li>
<li class="messages-group-unread">
<LinkTo @route="userPrivateMessages.groupUnread" @model={{group.name}} class="unread">
<LinkTo @route="userPrivateMessages.groupUnread" @model={{@group.name}} class="unread">
{{d-icon "plus-circle"}}
<span>{{@unreadLinkText}}</span>
</LinkTo>
</li>
{{/if}}
<li class="messages-group-archive">
<LinkTo @route="userPrivateMessages.groupArchive" @model={{group.name}}>
<LinkTo @route="userPrivateMessages.groupArchive" @model={{@group.name}}>
{{d-icon "archive"}}
<span>{{i18n "user.messages.archive"}}</span>
</LinkTo>
</li>
{{/if}}
{{/each}}
{{/if}}
{{#if this.displayTags}}
<li class="tags">

View File

@ -55,9 +55,7 @@ acceptance(
}
);
acceptance(
"User Private Messages - user with group messages",
function (needs) {
function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
let fetchedNew;
let fetchUserNew;
let fetchedGroupNew;
@ -66,6 +64,7 @@ acceptance(
id: 5,
username: "charlie",
groups: [{ id: 14, name: "awesome_group", has_messages: true }],
...(customUserProps || {}),
});
needs.site({
@ -278,16 +277,6 @@ acceptance(
);
};
test("viewing messages filtered by tags", async function (assert) {
await visit("/u/charlie/messages/tags");
assert.strictEqual(
count(".action-list li"),
3,
"it does not expand personal or group inbox"
);
});
test("incoming group archive message acted by current user", async function (assert) {
await visit("/u/charlie/messages");
@ -318,10 +307,7 @@ acceptance(
);
}
for (const url of [
"/u/charlie/messages",
"/u/charlie/messages/archive",
]) {
for (const url of ["/u/charlie/messages", "/u/charlie/messages/archive"]) {
await visit(url);
await publishGroupArchiveToMessageBus({ groupIds: [14], topicId: 1 });
@ -660,6 +646,21 @@ acceptance(
);
});
}
acceptance(
"User Private Messages - user with group messages",
function (needs) {
return testUserPrivateMessagesWithGroupMessages(needs);
}
);
acceptance(
"User Private Messages - user with group messages - redesigned user page nav enabled",
function (needs) {
return testUserPrivateMessagesWithGroupMessages(needs, {
redesigned_user_page_nav_enabled: true,
});
}
);
acceptance("User Private Messages - user with no messages", function (needs) {