From dc9af48942d6fbbf3f14d015f36716bbe73dc807 Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Wed, 22 Feb 2023 08:13:07 +0800 Subject: [PATCH] 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. --- .../user-nav/messages-secondary-nav.hbs | 8 +- .../app/controllers/user-private-messages.js | 32 +-- .../discourse/app/templates/user/messages.hbs | 238 +++--------------- 3 files changed, 43 insertions(+), 235 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/user-nav/messages-secondary-nav.hbs b/app/assets/javascripts/discourse/app/components/user-nav/messages-secondary-nav.hbs index 24558ef8df..ba830cb191 100644 --- a/app/assets/javascripts/discourse/app/components/user-nav/messages-secondary-nav.hbs +++ b/app/assets/javascripts/discourse/app/components/user-nav/messages-secondary-nav.hbs @@ -1,5 +1,3 @@ -{{#if this.currentUser.redesigned_user_page_nav_enabled}} - {{#in-element this.messagesNav}} - {{yield}} - {{/in-element}} -{{/if}} \ No newline at end of file +{{#in-element this.messagesNav}} + {{yield}} +{{/in-element}} \ No newline at end of file diff --git a/app/assets/javascripts/discourse/app/controllers/user-private-messages.js b/app/assets/javascripts/discourse/app/controllers/user-private-messages.js index 3b66fa6b61..d5b76815e1 100644 --- a/app/assets/javascripts/discourse/app/controllers/user-private-messages.js +++ b/app/assets/javascripts/discourse/app/controllers/user-private-messages.js @@ -1,5 +1,5 @@ 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 { alias, and, equal, readOnly } from "@ember/object/computed"; import { cached, tracked } from "@glimmer/tracking"; @@ -34,9 +34,7 @@ export default class extends Controller { @alias("group.name") groupFilter; @and("user.viewingSelf", "currentUser.can_send_private_messages") showNewPM; @equal("currentParentRouteName", "userPrivateMessages.group") isGroup; - @equal("currentParentRouteName", "userPrivateMessages.user") isPersonal; @readOnly("user.viewingSelf") viewingSelf; - @readOnly("router.currentRouteName") currentRouteName; @readOnly("router.currentRoute.parent.name") currentParentRouteName; @readOnly("site.can_tag_pms") pmTaggingEnabled; @@ -101,34 +99,6 @@ export default class extends Controller { 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 changeGroupNotificationLevel(notificationLevel) { this.group.setNotification(notificationLevel, this.get("user.model.id")); diff --git a/app/assets/javascripts/discourse/app/templates/user/messages.hbs b/app/assets/javascripts/discourse/app/templates/user/messages.hbs index 274af80a94..ef2c7f38cd 100644 --- a/app/assets/javascripts/discourse/app/templates/user/messages.hbs +++ b/app/assets/javascripts/discourse/app/templates/user/messages.hbs @@ -1,210 +1,50 @@ -{{#if this.currentUser.redesigned_user_page_nav_enabled}} - + -
-
    -
  1. - -
  2. -
+
+
    +
  1. + +
  2. +
- + - + {{#if this.isGroup}} + + {{/if}} + + {{#if this.showNewPM}} + + {{/if}}
-{{else}} - - -
  • - - {{i18n "user.messages.inbox"}} - -
  • - - {{#if this.isPersonal}} -
  • - - {{i18n "user.messages.sent"}} - -
  • - - {{#if this.viewingSelf}} -
  • - - {{this.newLinkText}} - -
  • - -
  • - - {{this.unreadLinkText}} - -
  • - {{/if}} - -
  • - - {{i18n "user.messages.archive"}} - -
  • - {{/if}} - - {{#each this.model.groupsWithMessages as |group|}} -
  • - - {{d-icon "users"}} - {{capitalize-string group.name}} - -
  • - - {{#if (and this.isGroup (eq this.groupFilter group.name))}} - {{#if this.viewingSelf}} -
  • - - {{this.newLinkText}} - -
  • - -
  • - - {{this.unreadLinkText}} - -
  • - {{/if}} - -
  • - - {{i18n "user.messages.archive"}} - -
  • - {{/if}} - {{/each}} - - {{#if this.pmTaggingEnabled}} -
  • - - {{i18n "user.messages.tags"}} - -
  • - - {{#if this.tagId}} -
  • - - {{this.tagId}} - -
  • - {{/if}} - {{/if}} - - - - -
    -
    - - {{#unless this.site.mobileView}} -
    - {{#if this.group}} - - {{/if}} - - {{#if this.showNewPM}} - - {{/if}} -
    - {{/unless}} -{{/if}} +
    - {{#unless this.currentUser.redesigned_user_page_nav_enabled}} -
    - {{#if this.site.mobileView}} - {{#if this.showNewPM}} - - {{/if}} - {{#if this.currentUser.admin}} - - {{/if}} - {{/if}} -
    - {{/unless}} {{outlet}}
    \ No newline at end of file