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

View File

@ -55,9 +55,7 @@ acceptance(
} }
); );
acceptance( function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
"User Private Messages - user with group messages",
function (needs) {
let fetchedNew; let fetchedNew;
let fetchUserNew; let fetchUserNew;
let fetchedGroupNew; let fetchedGroupNew;
@ -66,6 +64,7 @@ acceptance(
id: 5, id: 5,
username: "charlie", username: "charlie",
groups: [{ id: 14, name: "awesome_group", has_messages: true }], groups: [{ id: 14, name: "awesome_group", has_messages: true }],
...(customUserProps || {}),
}); });
needs.site({ 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) { test("incoming group archive message acted by current user", async function (assert) {
await visit("/u/charlie/messages"); await visit("/u/charlie/messages");
@ -318,10 +307,7 @@ acceptance(
); );
} }
for (const url of [ for (const url of ["/u/charlie/messages", "/u/charlie/messages/archive"]) {
"/u/charlie/messages",
"/u/charlie/messages/archive",
]) {
await visit(url); await visit(url);
await publishGroupArchiveToMessageBus({ groupIds: [14], topicId: 1 }); await publishGroupArchiveToMessageBus({ groupIds: [14], topicId: 1 });
@ -659,6 +645,21 @@ acceptance(
"displays the right browse more message" "displays the right browse more message"
); );
}); });
}
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,
});
} }
); );