A platform for community discussion. Free, open, simple.
DEV: Cleanup detection of user summary route for header collapsing (#11985)
David Taylord1b289daaacb
diff --git a/app/assets/javascripts/discourse/app/controllers/user.js b/app/assets/javascripts/discourse/app/controllers/user.jsindex a2b531f8a38..cfa79ddfb69 100644--- a/app/assets/javascripts/discourse/app/controllers/user.js+++ b/app/assets/javascripts/discourse/app/controllers/user.js@@ -1,6 +1,6 @@import Controller, { inject } from "@ember/controller";import EmberObject, { computed, set } from "@ember/object";-import { alias, and, gt, not, or } from "@ember/object/computed";+import { alias, and, equal, gt, not, or } from "@ember/object/computed";import CanCheckEmails from "discourse/mixins/can-check-emails";import User from "discourse/models/user";import I18n from "I18n";@@ -14,7 +14,6 @@ import { prioritizeNameInUx } from "discourse/lib/settings";import { inject as service } from "@ember/service";export default Controller.extend(CanCheckEmails, {- indexStream: false,router: service(),userNotifications: inject("user-notifications"),currentPath: alias("router._router.currentPath"),@@ -36,17 +35,19 @@ export default Controller.extend(CanCheckEmails, {return !isEmpty(background.toString());},+ isSummaryRoute: equal("router.currentRouteName", "user.summary"),+@discourseComputed("model.profile_hidden",- "indexStream",+ "isSummaryRoute","viewingSelf","forceExpand")- collapsedInfo(profileHidden, indexStream, viewingSelf, forceExpand) {+ collapsedInfo(profileHidden, isSummaryRoute, viewingSelf, forceExpand) {if (profileHidden) {return true;}- return (!indexStream || viewingSelf) && !forceExpand;+ return (!isSummaryRoute || viewingSelf) && !forceExpand;},canMuteOrIgnoreUser: or("model.can_ignore_user", "model.can_mute_user"),hasGivenFlags: gt("model.number_of_flags_given", 0),diff --git a/app/assets/javascripts/discourse/app/routes/build-admin-user-posts-route.js b/app/assets/javascripts/discourse/app/routes/build-admin-user-posts-route.jsindex e19026692e3..b56971fdae5 100644--- a/app/assets/javascripts/discourse/app/routes/build-admin-user-posts-route.js+++ b/app/assets/javascripts/discourse/app/routes/build-admin-user-posts-route.js@@ -6,7 +6,6 @@ export default function (filter) {return DiscourseRoute.extend({actions: {didTransition() {- this.controllerFor("user").set("indexStream", true);this.controllerFor("user-posts")._showFooter();return true;},diff --git a/app/assets/javascripts/discourse/app/routes/user-summary.js b/app/assets/javascripts/discourse/app/routes/user-summary.jsindex a3812871019..d7fefead284 100644--- a/app/assets/javascripts/discourse/app/routes/user-summary.js+++ b/app/assets/javascripts/discourse/app/routes/user-summary.js@@ -11,10 +11,4 @@ export default DiscourseRoute.extend({return user.summary();},-- actions: {- didTransition() {- this.controllerFor("user").set("indexStream", true);- },- },});diff --git a/app/assets/javascripts/discourse/app/routes/user.js b/app/assets/javascripts/discourse/app/routes/user.jsindex b8f7437d31f..5a3435eb72c 100644--- a/app/assets/javascripts/discourse/app/routes/user.js+++ b/app/assets/javascripts/discourse/app/routes/user.js@@ -11,14 +11,6 @@ export default DiscourseRoute.extend({},actions: {- willTransition(transition) {- // will reset the indexStream when transitioning to routes that aren't "indexStream"- // otherwise the "header" will jump- const isIndexStream = transition.targetName === "user.summary";- this.controllerFor("user").set("indexStream", isIndexStream);- return true;- },-undoRevokeApiKey(key) {key.undoRevoke();},