Skip to content
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

feat: r/profile dapp #1983

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

feat: r/profile dapp #1983

wants to merge 17 commits into from

Conversation

kazai777
Copy link
Contributor

@kazai777 kazai777 commented Apr 25, 2024

Following this PR concerning the creation of a realm profile I created this realm which allows the creation of profile as well as the associated functions to display the information of a profile with an address or a username. I have some questions concerning this realm:

  • Currently, if a user modifies his username, his old username is not freed and is therefore no longer available, even if it is no longer in use. Should I free the old username when the user has changed username?
  • To make it possible to search by username and address, I've created a second avl tree containing both username and address, so that I can find the profile indexed by its address by searching for it by its username. This is the most efficient solution I've found. I'd like to get some feedback on this and know if I should do things differently so that searching by username is more optimized.
  • Do you have any other suggestions for completing the profile fields, or other interesting features to add?

Thanks in advance for your feedback

Contributors' checklist...
  • Added new tests, or not needed, or not feasible
  • Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • Added references to related issues and PRs
  • Provided any useful hints for running manual tests
  • Added new benchmarks to generated graphs, if any. More info here.

@kazai777 kazai777 requested review from a team as code owners April 25, 2024 15:04
@github-actions github-actions bot added the 🧾 package/realm Tag used for new Realms or Packages. label Apr 25, 2024
@leohhhn leohhhn self-requested a review April 29, 2024 07:46
Copy link
Contributor

@leohhhn leohhhn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work - I left some comments that should be addressed before merging. Please take a look 🙏

examples/gno.land/r/demo/profile/profile.gno Outdated Show resolved Hide resolved
examples/gno.land/r/demo/profile/profile.gno Outdated Show resolved Hide resolved
examples/gno.land/r/demo/profile/profile.gno Show resolved Hide resolved
examples/gno.land/r/demo/profile/profile.gno Outdated Show resolved Hide resolved
examples/gno.land/r/demo/profile/profile.gno Outdated Show resolved Hide resolved
examples/gno.land/r/demo/profile/profile.gno Outdated Show resolved Hide resolved
examples/gno.land/r/demo/profile/profile.gno Outdated Show resolved Hide resolved
examples/gno.land/r/demo/profile/profile.gno Outdated Show resolved Hide resolved
examples/gno.land/r/demo/profile/profile.gno Show resolved Hide resolved
examples/gno.land/r/demo/profile/profile.gno Outdated Show resolved Hide resolved
examples/gno.land/r/demo/profile/profile.gno Outdated Show resolved Hide resolved
examples/gno.land/r/demo/profile/profile.gno Outdated Show resolved Hide resolved
examples/gno.land/r/demo/profile/profile.gno Outdated Show resolved Hide resolved
Copy link

codecov bot commented May 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.18%. Comparing base (977a3f4) to head (38b5439).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1983      +/-   ##
==========================================
- Coverage   55.01%   54.18%   -0.83%     
==========================================
  Files         481      520      +39     
  Lines       67432    73038    +5606     
==========================================
+ Hits        37097    39576    +2479     
- Misses      27318    30245    +2927     
- Partials     3017     3217     +200     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kazai777
Copy link
Contributor Author

@leohhhn would it be possible to have a new review please?

Website string
Country string
City string
ModificationHistory map[string][]string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maps aren't deterministic in some operations. I guess that's why avl.Tree was made (correct me if wrong please, @leohhhn ). So it could be a dangerous way to store the modification history. It would be better if you use an avl.Tree{time -> []string} instead, and since it's stored lexicographically, you can store the data based on yyyy-mm-dd-time .

type UserProfile struct {
Username string
Address std.Address
AvatarURL string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will there be an off chain way to verify the link is broken? Maybe with an NFT storage website it could be solved, but I'm not sure about the costs.

AvatarURL string
Age string
Gender string
Website string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we convert this variable website into an avl.Tree{} so the user can add as many websites as s/he wants? For example if you want to use your GitHub or your X account, it would be great to add the name of the website and the link to it.

if value, exists := profiles.Get(address.String()); exists {
return value.(UserProfile).Gender
}
} else if username != "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't necessarily need an else if. Instead only using an if can solve your thing.

return "unknown path"
}

func renderHome() string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way to hide your own information when the content is returned to another address? Will be all or nothing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean having something that allows you to put your profile in private? And if the “private” mode is active, if another address calls the profile, the information will be hidden?

Copy link
Contributor

@iam-agf iam-agf May 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, that's another option, but what I meant at first was hiding some properties of your profile. Your idea is also a good one. Maybe you could associate each user to an avl.Tree and add a list of allowed addresses that can read their account. It's not an absolute solution to privacy since they can check your account in gnoscan, but it's a good starting point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧾 package/realm Tag used for new Realms or Packages.
Projects
Status: Done
Status: In Progress
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet

3 participants