Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c9cb338f9b | ||
|
|
3f45b1f19e |
@@ -1,10 +1,11 @@
|
|||||||
import { registerUnbound } from "discourse-common/lib/helpers";
|
import { helperContext, registerUnbound } from "discourse-common/lib/helpers";
|
||||||
import User from "discourse/models/user";
|
|
||||||
|
|
||||||
export default registerUnbound("user-viewing-self", function (model) {
|
export default registerUnbound("user-viewing-self", function (model) {
|
||||||
if (User.current()) {
|
let currentUser = helperContext().currentUser;
|
||||||
|
if (currentUser) {
|
||||||
return (
|
return (
|
||||||
User.current().username.toLowerCase() === model.username.toLowerCase()
|
currentUser.admin ||
|
||||||
|
currentUser.username?.toLowerCase() === model.username?.toLowerCase()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,13 @@ export default Route.extend({
|
|||||||
templateName: "user/billing",
|
templateName: "user/billing",
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
if (this.currentUser.id !== this.modelFor("user").id) {
|
if (
|
||||||
this.replaceWith("userActivity");
|
this.currentUser.admin ||
|
||||||
} else {
|
this.currentUser.id === this.modelFor("user").id
|
||||||
|
) {
|
||||||
controller.setProperties({ model });
|
controller.setProperties({ model });
|
||||||
|
} else {
|
||||||
|
this.replaceWith("userActivity");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user