mirror of
https://github.com/discourse/discourse-subscriptions.git
synced 2025-02-16 08:24:44 +00:00
FIX: allow admin to view any user's Billing page
This commit is contained in:
parent
46759c90cd
commit
3f45b1f19e
@ -1,10 +1,11 @@
|
||||
import { registerUnbound } from "discourse-common/lib/helpers";
|
||||
import User from "discourse/models/user";
|
||||
import { helperContext, registerUnbound } from "discourse-common/lib/helpers";
|
||||
|
||||
export default registerUnbound("user-viewing-self", function (model) {
|
||||
if (User.current()) {
|
||||
let currentUser = helperContext().currentUser;
|
||||
if (currentUser) {
|
||||
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",
|
||||
|
||||
setupController(controller, model) {
|
||||
if (this.currentUser.id !== this.modelFor("user").id) {
|
||||
this.replaceWith("userActivity");
|
||||
} else {
|
||||
if (
|
||||
this.currentUser.admin ||
|
||||
this.currentUser.id === this.modelFor("user").id
|
||||
) {
|
||||
controller.setProperties({ model });
|
||||
} else {
|
||||
this.replaceWith("userActivity");
|
||||
}
|
||||
},
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user