DEV: Remove use of redesigned_user_page_nav_enabled prop client side 2 (#20388)
The property has been deprecated and will be dropped from Discourse core soon.
This commit is contained in:
parent
c43cb0c571
commit
dc9af48942
|
@ -1,5 +1,3 @@
|
||||||
{{#if this.currentUser.redesigned_user_page_nav_enabled}}
|
{{#in-element this.messagesNav}}
|
||||||
{{#in-element this.messagesNav}}
|
{{yield}}
|
||||||
{{yield}}
|
{{/in-element}}
|
||||||
{{/in-element}}
|
|
||||||
{{/if}}
|
|
|
@ -1,5 +1,5 @@
|
||||||
import Controller, { inject as controller } from "@ember/controller";
|
import Controller, { inject as controller } from "@ember/controller";
|
||||||
import { action, computed } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
import { inject as service } from "@ember/service";
|
import { inject as service } from "@ember/service";
|
||||||
import { alias, and, equal, readOnly } from "@ember/object/computed";
|
import { alias, and, equal, readOnly } from "@ember/object/computed";
|
||||||
import { cached, tracked } from "@glimmer/tracking";
|
import { cached, tracked } from "@glimmer/tracking";
|
||||||
|
@ -34,9 +34,7 @@ export default class extends Controller {
|
||||||
@alias("group.name") groupFilter;
|
@alias("group.name") groupFilter;
|
||||||
@and("user.viewingSelf", "currentUser.can_send_private_messages") showNewPM;
|
@and("user.viewingSelf", "currentUser.can_send_private_messages") showNewPM;
|
||||||
@equal("currentParentRouteName", "userPrivateMessages.group") isGroup;
|
@equal("currentParentRouteName", "userPrivateMessages.group") isGroup;
|
||||||
@equal("currentParentRouteName", "userPrivateMessages.user") isPersonal;
|
|
||||||
@readOnly("user.viewingSelf") viewingSelf;
|
@readOnly("user.viewingSelf") viewingSelf;
|
||||||
@readOnly("router.currentRouteName") currentRouteName;
|
|
||||||
@readOnly("router.currentRoute.parent.name") currentParentRouteName;
|
@readOnly("router.currentRoute.parent.name") currentParentRouteName;
|
||||||
@readOnly("site.can_tag_pms") pmTaggingEnabled;
|
@readOnly("site.can_tag_pms") pmTaggingEnabled;
|
||||||
|
|
||||||
|
@ -101,34 +99,6 @@ export default class extends Controller {
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
@computed(
|
|
||||||
"pmTopicTrackingState.newIncoming.[]",
|
|
||||||
"pmTopicTrackingState.statesModificationCounter",
|
|
||||||
"group"
|
|
||||||
)
|
|
||||||
get newLinkText() {
|
|
||||||
return this.#linkText("new");
|
|
||||||
}
|
|
||||||
|
|
||||||
@computed(
|
|
||||||
"pmTopicTrackingState.newIncoming.[]",
|
|
||||||
"pmTopicTrackingState.statesModificationCounter",
|
|
||||||
"group"
|
|
||||||
)
|
|
||||||
get unreadLinkText() {
|
|
||||||
return this.#linkText("unread");
|
|
||||||
}
|
|
||||||
|
|
||||||
#linkText(type) {
|
|
||||||
const count = this.pmTopicTrackingState?.lookupCount(type) || 0;
|
|
||||||
|
|
||||||
if (count === 0) {
|
|
||||||
return I18n.t(`user.messages.${type}`);
|
|
||||||
} else {
|
|
||||||
return I18n.t(`user.messages.${type}_with_count`, { count });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@action
|
@action
|
||||||
changeGroupNotificationLevel(notificationLevel) {
|
changeGroupNotificationLevel(notificationLevel) {
|
||||||
this.group.setNotification(notificationLevel, this.get("user.model.id"));
|
this.group.setNotification(notificationLevel, this.get("user.model.id"));
|
||||||
|
|
|
@ -1,210 +1,50 @@
|
||||||
{{#if this.currentUser.redesigned_user_page_nav_enabled}}
|
<DSection @pageClass="user-messages" />
|
||||||
<DSection @pageClass="user-messages" />
|
|
||||||
|
|
||||||
<div class="user-navigation user-navigation-secondary">
|
<div class="user-navigation user-navigation-secondary">
|
||||||
<ol class="category-breadcrumb">
|
<ol class="category-breadcrumb">
|
||||||
<li>
|
<li>
|
||||||
<UserNav::MessagesDropdown
|
<UserNav::MessagesDropdown
|
||||||
@content={{this.messagesDropdownContent}}
|
@content={{this.messagesDropdownContent}}
|
||||||
@value={{this.messagesDropdownValue}}
|
@value={{this.messagesDropdownValue}}
|
||||||
@onChange={{this.onMessagesDropdownChange}}
|
@onChange={{this.onMessagesDropdownChange}}
|
||||||
/>
|
/>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<HorizontalOverflowNav
|
<HorizontalOverflowNav
|
||||||
@className="messages-nav"
|
@className="messages-nav"
|
||||||
@ariaLabel="User secondary - messages"
|
@ariaLabel="User secondary - messages"
|
||||||
id="user-navigation-secondary__horizontal-nav"
|
id="user-navigation-secondary__horizontal-nav"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="navigation-controls">
|
<div class="navigation-controls">
|
||||||
{{#if this.site.mobileView}}
|
{{#if this.site.mobileView}}
|
||||||
{{#if this.currentUser.admin}}
|
{{#if this.currentUser.admin}}
|
||||||
<BulkSelectToggle
|
<BulkSelectToggle
|
||||||
@parentController={{"user-topics-list"}}
|
@parentController={{"user-topics-list"}}
|
||||||
@tagName=""
|
@tagName=""
|
||||||
/>
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#if this.isGroup}}
|
|
||||||
<GroupNotificationsButton
|
|
||||||
@value={{this.group.group_user.notification_level}}
|
|
||||||
@onChange={{this.changeGroupNotificationLevel}}
|
|
||||||
/>
|
/>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#if this.showNewPM}}
|
{{#if this.isGroup}}
|
||||||
<DButton
|
<GroupNotificationsButton
|
||||||
@class="btn-primary new-private-message"
|
@value={{this.group.group_user.notification_level}}
|
||||||
@action={{route-action "composePrivateMessage"}}
|
@onChange={{this.changeGroupNotificationLevel}}
|
||||||
@icon="envelope"
|
/>
|
||||||
@label="user.new_private_message"
|
{{/if}}
|
||||||
/>
|
|
||||||
{{/if}}
|
{{#if this.showNewPM}}
|
||||||
</div>
|
<DButton
|
||||||
|
@class="btn-primary new-private-message"
|
||||||
|
@action={{route-action "composePrivateMessage"}}
|
||||||
|
@icon="envelope"
|
||||||
|
@label="user.new_private_message"
|
||||||
|
/>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
</div>
|
||||||
<DSection @class="user-secondary-navigation" @pageClass="user-messages">
|
|
||||||
<MobileNav @class="messages-nav" @desktopClass="nav-stacked action-list">
|
|
||||||
<li>
|
|
||||||
<LinkTo @route="userPrivateMessages.user.index" @model={{this.model}}>
|
|
||||||
{{i18n "user.messages.inbox"}}
|
|
||||||
</LinkTo>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
{{#if this.isPersonal}}
|
|
||||||
<li class="archive">
|
|
||||||
<LinkTo @route="userPrivateMessages.user.sent" @model={{this.model}}>
|
|
||||||
{{i18n "user.messages.sent"}}
|
|
||||||
</LinkTo>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
{{#if this.viewingSelf}}
|
|
||||||
<li class="archive">
|
|
||||||
<LinkTo
|
|
||||||
@route="userPrivateMessages.user.new"
|
|
||||||
@model={{this.model}}
|
|
||||||
class="new"
|
|
||||||
>
|
|
||||||
{{this.newLinkText}}
|
|
||||||
</LinkTo>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="archive">
|
|
||||||
<LinkTo
|
|
||||||
@route="userPrivateMessages.user.unread"
|
|
||||||
@model={{this.model}}
|
|
||||||
class="unread"
|
|
||||||
>
|
|
||||||
{{this.unreadLinkText}}
|
|
||||||
</LinkTo>
|
|
||||||
</li>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<li class="archive">
|
|
||||||
<LinkTo
|
|
||||||
@route="userPrivateMessages.user.archive"
|
|
||||||
@model={{this.model}}
|
|
||||||
>
|
|
||||||
{{i18n "user.messages.archive"}}
|
|
||||||
</LinkTo>
|
|
||||||
</li>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#each this.model.groupsWithMessages as |group|}}
|
|
||||||
<li>
|
|
||||||
<LinkTo @route="userPrivateMessages.group" @model={{group.name}}>
|
|
||||||
{{d-icon "users"}}
|
|
||||||
{{capitalize-string group.name}}
|
|
||||||
</LinkTo>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
{{#if (and this.isGroup (eq this.groupFilter group.name))}}
|
|
||||||
{{#if this.viewingSelf}}
|
|
||||||
<li class="archive">
|
|
||||||
<LinkTo
|
|
||||||
@route="userPrivateMessages.group.new"
|
|
||||||
@model={{group.name}}
|
|
||||||
class="new"
|
|
||||||
>
|
|
||||||
{{this.newLinkText}}
|
|
||||||
</LinkTo>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="archive">
|
|
||||||
<LinkTo
|
|
||||||
@route="userPrivateMessages.group.unread"
|
|
||||||
@model={{group.name}}
|
|
||||||
class="unread"
|
|
||||||
>
|
|
||||||
{{this.unreadLinkText}}
|
|
||||||
</LinkTo>
|
|
||||||
</li>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<li class="archive">
|
|
||||||
<LinkTo
|
|
||||||
@route="userPrivateMessages.group.archive"
|
|
||||||
@model={{group.name}}
|
|
||||||
>
|
|
||||||
{{i18n "user.messages.archive"}}
|
|
||||||
</LinkTo>
|
|
||||||
</li>
|
|
||||||
{{/if}}
|
|
||||||
{{/each}}
|
|
||||||
|
|
||||||
{{#if this.pmTaggingEnabled}}
|
|
||||||
<li class="tags">
|
|
||||||
<LinkTo @route="userPrivateMessages.tags.index" @model={{this.model}}>
|
|
||||||
{{i18n "user.messages.tags"}}
|
|
||||||
</LinkTo>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
{{#if this.tagId}}
|
|
||||||
<li class="archive">
|
|
||||||
<LinkTo
|
|
||||||
@route="userPrivateMessages.tags.show"
|
|
||||||
@model={{this.tagId}}
|
|
||||||
>
|
|
||||||
{{this.tagId}}
|
|
||||||
</LinkTo>
|
|
||||||
</li>
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<span>
|
|
||||||
<PluginOutlet
|
|
||||||
@name="user-messages-nav"
|
|
||||||
@connectorTagName="li"
|
|
||||||
@outletArgs={{hash model=this.model}}
|
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
</MobileNav>
|
|
||||||
</DSection>
|
|
||||||
|
|
||||||
{{#unless this.site.mobileView}}
|
|
||||||
<section class="user-additional-controls">
|
|
||||||
{{#if this.group}}
|
|
||||||
<GroupNotificationsButton
|
|
||||||
@value={{this.group.group_user.notification_level}}
|
|
||||||
@onChange={{action "changeGroupNotificationLevel"}}
|
|
||||||
/>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#if this.showNewPM}}
|
|
||||||
<DButton
|
|
||||||
@class="btn-primary new-private-message"
|
|
||||||
@action={{route-action "composePrivateMessage"}}
|
|
||||||
@icon="envelope"
|
|
||||||
@label="user.new_private_message"
|
|
||||||
/>
|
|
||||||
{{/if}}
|
|
||||||
</section>
|
|
||||||
{{/unless}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<section class="user-content" id="user-content">
|
<section class="user-content" id="user-content">
|
||||||
{{#unless this.currentUser.redesigned_user_page_nav_enabled}}
|
|
||||||
<div class="list-actions">
|
|
||||||
{{#if this.site.mobileView}}
|
|
||||||
{{#if this.showNewPM}}
|
|
||||||
<DButton
|
|
||||||
@class="btn-primary new-private-message"
|
|
||||||
@action={{route-action "composePrivateMessage"}}
|
|
||||||
@icon="envelope"
|
|
||||||
@label="user.new_private_message"
|
|
||||||
/>
|
|
||||||
{{/if}}
|
|
||||||
{{#if this.currentUser.admin}}
|
|
||||||
<BulkSelectToggle
|
|
||||||
@parentController={{"user-topics-list"}}
|
|
||||||
@tagName=""
|
|
||||||
/>
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
{{/unless}}
|
|
||||||
{{outlet}}
|
{{outlet}}
|
||||||
</section>
|
</section>
|
Loading…
Reference in New Issue