-
Notifications
You must be signed in to change notification settings - Fork 20
fix(report-abilities): get function is not exists #1199
base: main
Are you sure you want to change the base?
fix(report-abilities): get function is not exists #1199
Conversation
ab83b55
to
59ea9c5
Compare
@@ -61,7 +61,7 @@ | |||
<li class="nav-top-list-item"> | |||
<LinkTo @route="users.edit" @model={{this.session.data.user.id}}> | |||
<FaIcon @icon="user" /> | |||
{{this.session.data.user.fullName}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
before we had fullName on the user and now thats gone? How come?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because there is an issue with ember-simple-auth
or ember-simple-auth-oidc
,
because in the first time login, the session.data
is return an instance of ember data model, but after refreshing the token, it's return just an object of the user information, so i can not use the helper that is defined in User
data model
get fullName() { | ||
const fullName = this.session.data.user?.fullName; | ||
if (fullName) return fullName; | ||
|
||
if (!this.session.data.user?.attributes) return ""; | ||
|
||
const userAttributes = this.session.data.user.attributes; | ||
return `${userAttributes["first-name"]} ${userAttributes["last-name"]}`; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would first check if I really need this function. Otherwise you might be able to shorten it to:
get fullName() { | |
const fullName = this.session.data.user?.fullName; | |
if (fullName) return fullName; | |
if (!this.session.data.user?.attributes) return ""; | |
const userAttributes = this.session.data.user.attributes; | |
return `${userAttributes["first-name"]} ${userAttributes["last-name"]}`; | |
} | |
get fullName() { | |
return this.session?.data?.user?.fullName ?? "${this.session?.data?.user?["first-name"]} ${this.session?.data?.user?["last-name"]}" | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thats a lot of question marks 🤣
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was able for me to do that, but i wanted it to be more clear and readable :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Yelinz yh I was wondering if we even try to show the topnav if there is no session. I also don't know if there can be a session without data. So I would try to remove as many ? as possible.
59ea9c5
to
668067f
Compare
No description provided.