-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "Display" to the Name textfield header on the edit profile page. #1456
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
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.
This perfectly does what is asked for in the ticket, but I think the ticket description left something out.
The data for a Nostr profile is stored in a "metadata" event, and there are two name fields in the metadata event: name
and display_name
. These are mapped to the properties on our Author class called name
and displayName
. Since we changed the label in the UI I think we also need to change the code that saves the name to use author.displayName
instead of author.name
. It looks like you can do this in ProfileEditView.save()
.
You weren't expected to figure this out on your own, I just happened to notice it while reviewing. Can you make that change and then request another review?
Thanks for pointing this out Matt. I have a few questions:|
|
@@ -166,15 +166,15 @@ struct ProfileEditView: View { | |||
|
|||
private func populateTextFields() { | |||
viewContext.refresh(author, mergeChanges: true) | |||
nameText = author.name ?? author.displayName ?? "" | |||
displayNameText = author.displayName ?? author.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.
Hey @pelumy, this looks good and accomplishes what I asked for in my last comment. However I found one weird flow on my test account that I would like to smooth out before we merge. It looks like if the user has only set a name
in Nos but never a displayName
then we actually show an empty displayName
field. I think this is happening because we have been saving an empty string into the displayName
field, so this line of code ends up evaulating as displayNameText = ""
. It looks a little weird:
Screen.Recording.2024-09-05.at.3.43.52.PM.mov
Can you tweak this so that it uses the name if author.displayName
is nil or empty?
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.
Ooh, thanks for catching this @mplorentz . I will push a fix for this.
@mplorentz , I have pushed the fix and the video below shows: First screen, a new test account with only name set I also made sure to test that the displayName still shows for accounts that already saved the displayName. |
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.
This is good to go now. Nice work @pelumy!
@pelumy awesome work on your first PR -- this is great! |
Thank you @joshuatbrown 😊 |
Issues covered
#1445
Description
This PR updates "Name" to "Display Name" in the
EditProfile
pagedisplayName
key was capitalised in the Localizable filedisplayName
key is used to replace the previous localizedname
keyHow to test
Screenshots/Video