mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 17:53:40 +08:00
REFACTOR: Clean up router usage and private APIs
This commit is contained in:
parent
6a9bde3bf4
commit
01e213c930
|
@ -1,4 +1,4 @@
|
|||
import { alias, match, gt } from "@ember/object/computed";
|
||||
import { alias, gt } from "@ember/object/computed";
|
||||
import Component from "@ember/component";
|
||||
import { setting } from "discourse/lib/computed";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
|
@ -24,8 +24,6 @@ export default Component.extend(CardContentsBase, CleansUp, {
|
|||
showBadges: setting("enable_badges"),
|
||||
|
||||
postStream: alias("topic.postStream"),
|
||||
viewingTopic: match("currentPath", /^topic\./),
|
||||
|
||||
showMoreMembers: gt("moreMembersCount", 0),
|
||||
|
||||
group: null,
|
||||
|
|
|
@ -12,7 +12,6 @@ import CanCheckEmails from "discourse/mixins/can-check-emails";
|
|||
import CardContentsBase from "discourse/mixins/card-contents-base";
|
||||
import CleansUp from "discourse/mixins/cleans-up";
|
||||
import { prioritizeNameInUx } from "discourse/lib/settings";
|
||||
import { getOwner } from "@ember/application";
|
||||
|
||||
export default Component.extend(CardContentsBase, CanCheckEmails, CleansUp, {
|
||||
elementId: "user-card",
|
||||
|
@ -201,10 +200,7 @@ export default Component.extend(CardContentsBase, CanCheckEmails, CleansUp, {
|
|||
|
||||
composePM(user, post) {
|
||||
this._close();
|
||||
|
||||
getOwner(this)
|
||||
.lookup("router:main")
|
||||
.send("composePrivateMessage", user, post);
|
||||
this.composePrivateMessage(user, post);
|
||||
},
|
||||
|
||||
cancelFilter() {
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import { inject as service } from "@ember/service";
|
||||
import Controller, { inject as controller } from "@ember/controller";
|
||||
import DiscourseURL, { userPath, groupPath } from "discourse/lib/url";
|
||||
|
||||
export default Controller.extend({
|
||||
application: controller(),
|
||||
topic: controller(),
|
||||
router: service(),
|
||||
|
||||
actions: {
|
||||
togglePosts(user) {
|
||||
|
|
|
@ -5,14 +5,17 @@ import afterTransition from "discourse/lib/after-transition";
|
|||
import DiscourseURL from "discourse/lib/url";
|
||||
import Mixin from "@ember/object/mixin";
|
||||
import { escapeExpression } from "discourse/lib/utilities";
|
||||
import { inject as service } from "@ember/service";
|
||||
|
||||
export default Mixin.create({
|
||||
router: service(),
|
||||
|
||||
elementId: null, //click detection added for data-{elementId}
|
||||
triggeringLinkClass: null, //the <a> classname where this card should appear
|
||||
_showCallback: null, //username, $target - load up data for when show is called, should call this._positionCard($target) when it's done.
|
||||
|
||||
postStream: alias("topic.postStream"),
|
||||
viewingTopic: match("currentPath", /^topic\./),
|
||||
viewingTopic: match("router.currentRouteName", /^topic\./),
|
||||
|
||||
visible: false,
|
||||
username: null,
|
||||
|
|
|
@ -3,14 +3,13 @@
|
|||
{{/if}}
|
||||
|
||||
{{user-card-contents
|
||||
currentPath=router._router.currentPath
|
||||
topic=topic.model
|
||||
showUser=(action "showUser")
|
||||
togglePosts=(action "togglePosts")
|
||||
composePrivateMessage=(route-action "composePrivateMessage")
|
||||
createNewMessageViaParams=(route-action "createNewMessageViaParams")}}
|
||||
|
||||
{{group-card-contents
|
||||
currentPath=router._router.currentPath
|
||||
topic=topic.model
|
||||
showUser=(action "showUser")
|
||||
showGroup=(action "showGroup")
|
||||
|
|
Loading…
Reference in New Issue
Block a user