mirror of
https://ghfast.top/https://github.com/discourse/discourse-follow.git
synced 2026-07-15 11:36:38 +08:00
19 lines
542 B
JavaScript
19 lines
542 B
JavaScript
import DiscourseRoute from "discourse/routes/discourse";
|
|
|
|
export default DiscourseRoute.extend({
|
|
beforeModel() {
|
|
const model = this.modelFor("user");
|
|
const canSeeFollowers = model.can_see_followers;
|
|
const canSeeFollowing = model.can_see_following;
|
|
|
|
if (this.currentUser?.id === model.id) {
|
|
this.replaceWith("feed");
|
|
} else if (canSeeFollowing) {
|
|
this.replaceWith("following");
|
|
} else if (canSeeFollowers) {
|
|
this.replaceWith("followers");
|
|
} else {
|
|
this.replaceWith("user");
|
|
}
|
|
},
|
|
});
|