Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

fix(report-abilities): get function is not exists #1199

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

MitanOmar
Copy link
Member

No description provided.

@MitanOmar MitanOmar self-assigned this Apr 16, 2024
@MitanOmar MitanOmar force-pushed the fix-freeze-issue-of-page-if-multiple-tabs-are-open branch from ab83b55 to 59ea9c5 Compare April 16, 2024 15:12
@MitanOmar MitanOmar requested a review from a team April 16, 2024 15:17
@@ -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}}
Copy link
Contributor

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?

Copy link
Member Author

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

Comment on lines +25 to +31
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"]}`;
}
Copy link
Contributor

@StephanH90 StephanH90 Apr 16, 2024

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:

Suggested change
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"]}"
}

Copy link
Member

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 🤣

Copy link
Member Author

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 :)

Copy link
Contributor

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants