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: Add new simplified model for profile showcase preferences #13708

Conversation

MishkaRogachev
Copy link
Contributor

@MishkaRogachev MishkaRogachev commented Feb 23, 2024

Close #13688
Waits status-im/status-go#4854 (comment)

What does the PR do

  • Add simplified profile showcase preferences models for:

    • Communities
    • Accounts
    • Collectibles
    • Assets
    • Social links
  • Add api for saving profile changes

JSon structure:

{
  accounts: [ { key <string>, visibility: <int> }],
  communities: [ { key: <string>, visibility: <int> }],
  assets: [ { key: <string>, visibility: <int> }],
  collectibles: [ { key: <string>, visibility: <int> }],
  socialLinks: [ { url: <string>, text: <string>, visibility: <int> }]
}

Affected areas

Profile showcase

@MishkaRogachev MishkaRogachev force-pushed the feat/issue-13688-featprofileshowcase-simplified-nim-backend-for-profile-showcase-settings branch from 29e52ad to 62c4b79 Compare February 23, 2024 14:29
@status-im-auto
Copy link
Member

status-im-auto commented Feb 23, 2024

Jenkins Builds

Click to see older builds (73)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 62c4b79 #2 2024-02-23 14:35:33 ~6 min tests/nim 📄log
✔️ 62c4b79 #2 2024-02-23 14:36:05 ~6 min macos/aarch64 🍎dmg
✔️ 62c4b79 #2 2024-02-23 14:39:35 ~10 min macos/x86_64 🍎dmg
✔️ 62c4b79 #2 2024-02-23 14:39:41 ~10 min tests/ui 📄log
✔️ 62c4b79 #2 2024-02-23 14:45:22 ~16 min linux/x86_64 📦tgz
✔️ 76376aa #3 2024-02-26 12:12:28 ~4 min macos/aarch64 🍎dmg
✔️ 76376aa #3 2024-02-26 12:14:20 ~6 min tests/nim 📄log
✔️ 76376aa #3 2024-02-26 12:15:52 ~8 min macos/x86_64 🍎dmg
✔️ 13969c0 #4 2024-02-26 12:20:52 ~4 min macos/aarch64 🍎dmg
✔️ 13969c0 #4 2024-02-26 12:22:59 ~6 min tests/nim 📄log
✔️ 13969c0 #4 2024-02-26 12:24:10 ~7 min macos/x86_64 🍎dmg
✔️ 13969c0 #4 2024-02-26 12:27:18 ~10 min tests/ui 📄log
✔️ 13969c0 #4 2024-02-26 12:34:46 ~18 min linux/x86_64 📦tgz
✔️ 6f3cf67 #5 2024-02-26 17:21:45 ~4 min macos/aarch64 🍎dmg
✔️ 6f3cf67 #5 2024-02-26 17:23:36 ~6 min tests/nim 📄log
✔️ 6f3cf67 #5 2024-02-26 17:25:53 ~8 min macos/x86_64 🍎dmg
✔️ 6f3cf67 #5 2024-02-26 17:28:24 ~10 min tests/ui 📄log
✔️ 6f3cf67 #5 2024-02-26 17:32:39 ~15 min linux/x86_64 📦tgz
✔️ 4bcb6d6 #6 2024-03-01 09:17:19 ~5 min macos/aarch64 🍎dmg
✔️ 4bcb6d6 #6 2024-03-01 09:18:57 ~6 min tests/nim 📄log
✔️ 4bcb6d6 #6 2024-03-01 09:20:59 ~8 min macos/x86_64 🍎dmg
✔️ 4bcb6d6 #6 2024-03-01 09:22:24 ~10 min tests/ui 📄log
✔️ 4bcb6d6 #6 2024-03-01 09:27:49 ~15 min linux/x86_64 📦tgz
✔️ a5c91a6 #7 2024-03-01 16:24:04 ~4 min macos/aarch64 🍎dmg
✔️ a5c91a6 #7 2024-03-01 16:26:10 ~6 min tests/nim 📄log
✔️ a5c91a6 #7 2024-03-01 16:28:19 ~8 min macos/x86_64 🍎dmg
✔️ a5c91a6 #7 2024-03-01 16:30:41 ~10 min tests/ui 📄log
✔️ a5c91a6 #7 2024-03-01 16:35:00 ~15 min linux/x86_64 📦tgz
✔️ 8177ced #8 2024-03-04 11:45:28 ~4 min macos/aarch64 🍎dmg
✔️ 8177ced #8 2024-03-04 11:47:20 ~6 min tests/nim 📄log
✔️ 8177ced #8 2024-03-04 11:48:38 ~7 min macos/x86_64 🍎dmg
✔️ 8177ced #8 2024-03-04 11:51:43 ~10 min tests/ui 📄log
✔️ 8177ced #8 2024-03-04 11:56:16 ~15 min linux/x86_64 📦tgz
✔️ caa5bae #9 2024-03-07 10:50:46 ~4 min macos/aarch64 🍎dmg
✔️ caa5bae #9 2024-03-07 10:51:55 ~6 min tests/nim 📄log
✔️ caa5bae #9 2024-03-07 10:55:08 ~9 min macos/x86_64 🍎dmg
✔️ caa5bae #9 2024-03-07 10:56:45 ~10 min tests/ui 📄log
✔️ caa5bae #9 2024-03-07 11:00:33 ~14 min linux/x86_64 📦tgz
✔️ 391eb98 #10 2024-03-07 11:07:23 ~4 min macos/aarch64 🍎dmg
✔️ 391eb98 #10 2024-03-07 11:09:37 ~6 min tests/nim 📄log
✔️ 391eb98 #10 2024-03-07 11:10:25 ~7 min macos/x86_64 🍎dmg
✔️ 391eb98 #10 2024-03-07 11:14:59 ~11 min tests/ui 📄log
✔️ 22b2ef7 #11 2024-03-07 11:20:14 ~3 min macos/aarch64 🍎dmg
✔️ 22b2ef7 #11 2024-03-07 11:22:18 ~5 min tests/nim 📄log
✔️ 22b2ef7 #11 2024-03-07 11:23:17 ~6 min macos/x86_64 🍎dmg
✔️ 925c03b #12 2024-03-07 11:31:15 ~3 min macos/aarch64 🍎dmg
✔️ 925c03b #12 2024-03-07 11:33:33 ~6 min tests/nim 📄log
✔️ 925c03b #12 2024-03-07 11:36:59 ~9 min macos/x86_64 🍎dmg
✔️ 925c03b #12 2024-03-07 11:37:52 ~10 min tests/ui 📄log
✔️ 925c03b #12 2024-03-07 11:41:47 ~14 min linux/x86_64 📦tgz
✔️ a4a32d5 #13 2024-03-07 14:10:30 ~4 min macos/aarch64 🍎dmg
✔️ a4a32d5 #13 2024-03-07 14:13:04 ~7 min tests/nim 📄log
✔️ a4a32d5 #13 2024-03-07 14:13:48 ~7 min macos/x86_64 🍎dmg
✔️ a4a32d5 #13 2024-03-07 14:16:52 ~10 min tests/ui 📄log
✔️ a4a32d5 #13 2024-03-07 14:20:39 ~14 min linux/x86_64 📦tgz
✔️ 1dda3b1 #14 2024-03-07 15:21:03 ~4 min macos/aarch64 🍎dmg
✔️ 1dda3b1 #14 2024-03-07 15:23:15 ~6 min tests/nim 📄log
✔️ 1dda3b1 #14 2024-03-07 15:24:12 ~7 min macos/x86_64 🍎dmg
✔️ 1dda3b1 #14 2024-03-07 15:27:37 ~10 min tests/ui 📄log
✔️ 1dda3b1 #14 2024-03-07 15:31:59 ~15 min linux/x86_64 📦tgz
✔️ 1150ef9 #15 2024-03-08 11:20:40 ~4 min macos/aarch64 🍎dmg
✔️ 1150ef9 #15 2024-03-08 11:22:32 ~6 min tests/nim 📄log
✔️ 1150ef9 #15 2024-03-08 11:23:51 ~7 min macos/x86_64 🍎dmg
✔️ bbe75af #16 2024-03-08 11:29:25 ~4 min macos/aarch64 🍎dmg
✔️ bbe75af #16 2024-03-08 11:30:58 ~6 min tests/nim 📄log
✔️ bbe75af #16 2024-03-08 11:31:28 ~6 min macos/x86_64 🍎dmg
✔️ bbe75af #16 2024-03-08 11:35:22 ~10 min tests/ui 📄log
✔️ bbe75af #16 2024-03-08 11:39:15 ~14 min linux/x86_64 📦tgz
✔️ a337176 #17 2024-03-08 15:16:31 ~6 min tests/nim 📄log
✔️ a337176 #17 2024-03-08 15:19:11 ~8 min macos/x86_64 🍎dmg
✔️ a337176 #17 2024-03-08 15:19:43 ~9 min macos/aarch64 🍎dmg
✔️ a337176 #17 2024-03-08 15:20:34 ~10 min tests/ui 📄log
✔️ a337176 #17 2024-03-08 15:25:28 ~15 min linux/x86_64 📦tgz
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 15c9bb0 #19 2024-03-08 16:29:17 ~6 min macos/aarch64 🍎dmg
✔️ 15c9bb0 #19 2024-03-08 16:34:24 ~11 min macos/x86_64 🍎dmg
✔️ 15c9bb0 #19 2024-03-08 16:37:28 ~14 min tests/nim 📄log
✔️ 15c9bb0 #19 2024-03-08 16:41:54 ~18 min tests/ui 📄log
✔️ 15c9bb0 #19 2024-03-08 16:45:46 ~22 min linux/x86_64 📦tgz
✔️ 15c9bb0 #25 2024-03-08 17:33:53 ~28 min windows/x86_64 💿exe
✔️ 47b416d #20 2024-03-08 17:47:24 ~4 min macos/aarch64 🍎dmg
✔️ 47b416d #20 2024-03-08 17:48:48 ~6 min tests/nim 📄log
✔️ 47b416d #20 2024-03-08 17:50:20 ~7 min macos/x86_64 🍎dmg
✔️ 47b416d #20 2024-03-08 17:53:17 ~10 min tests/ui 📄log
✔️ 47b416d #20 2024-03-08 17:57:57 ~15 min linux/x86_64 📦tgz
✔️ 47b416d #26 2024-03-08 18:00:28 ~18 min windows/x86_64 💿exe

@MishkaRogachev MishkaRogachev marked this pull request as ready for review February 26, 2024 12:12
@@ -157,6 +162,67 @@ method storeProfileShowcasePreferences(self: Module,
revealedAddresses
)

method saveProfileShowcasePreferences*(self: Module, showcase: ProfileShowcaseSaveData) =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@alexjba @noeliaSD @micieslak
this part looks dirty from my perspective, to simplify it we need to add some extra data to the initial json:

  • wallet accounts metadata
  • collectibles's raw identification fields
    -and i expect some extra data for tokens (contractAddress and tokeId)

Copy link
Contributor

Choose a reason for hiding this comment

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

the initial json means the json composed in qml when saving?

I find it ok if this data is really needed here, in saveProfileShowcasePreferences. My reasoning is that the profileShowcasePreferences only operates on visibility and position. If the metadata is needed on save operation, I find it ok to be collected on save as opposed to be carried around in other places where it's not immediatly needed.

But I don't really understand why this data needs to be collected here just to be forwarded to status-go. I'd expect status-go not to need accounts metadata for example when saving some accounts showcase preferences. IMO this data could be kept in sync by status-go internals.

Unless I'm missing something, I think it would be more or less the same if we're collecting this data in saveProfileShowcasePreferences or qml. The best solution IMO is for this data not to be needed on save. The profile showcase preferences is not meant to save accounts metadata, just some visibilities and positions.

Copy link
Contributor

Choose a reason for hiding this comment

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

On the other hand, I see it's quite an overhead to parse the qml updates. The profile settings are going through the following changes:

---qml---

  1. model to string
    ---nim---
  2. string -> json
  3. json -> nim object 1
  4. nim object 1 -> nim object 2 (similar object)
  5. nim object 2 -> json
  6. json -> back to string

would your proposal help in simplifying this flow as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@alexjba thanks for the detailed comment, let's try to figure out the best way to do it!

Yes, by json I meant the data that qml passes to nim for saving.

There is one thing about filling additional fields in status-go: these data are in different services and not all status-go api are available from messenger service. It is still possible to route them, but it is much more laborious than in nim. However, for profile showcase preferences this problem is not so noticeable. I can move wallet filling to go, and it will even be correct. But not everything is so easy with tokens. The most correct structure seems to me to be:

{
  communities: [ { communityId: <string>, visibility: <int> }],
  accounts: [ { address <string>, visibility: <int> }],
  collectibles: [ { chainId: <int>, tokenId: <string>, contractAddress: <string>, visibility: <int> }],
  verifiedTokens: [ { symbol: <string>, visibility: <int> }],
  unverifiedTokens: [ { chainId: <int>, contractAddress: <string>, visibility: <int> }],
  socialLinks: [ { url: <string>, text: <string>, visibility: <int> }]
}

I would prefer to use the same nim structure for both saving and querying profile showcase preferences from status-go. And it is possible to completely remove converying in the nim layer, but then the position and correct id names will have to be filled in qml.

Copy link
Contributor

Choose a reason for hiding this comment

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

For verifiedTokens and unverifiedTokens I'd use the word assets instead of tokens to have more nomenclature consistency!

Copy link
Contributor

Choose a reason for hiding this comment

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

@alexjba thanks for the detailed comment, let's try to figure out the best way to do it!

Yes, by json I meant the data that qml passes to nim for saving.

There is one thing about filling additional fields in status-go: these data are in different services and not all status-go api are available from messenger service. It is still possible to route them, but it is much more laborious than in nim. However, for profile showcase preferences this problem is not so noticeable. I can move wallet filling to go, and it will even be correct. But not everything is so easy with tokens. The most correct structure seems to me to be:

{
  communities: [ { communityId: <string>, visibility: <int> }],
  accounts: [ { address <string>, visibility: <int> }],
  collectibles: [ { chainId: <int>, tokenId: <string>, contractAddress: <string>, visibility: <int> }],
  verifiedTokens: [ { symbol: <string>, visibility: <int> }],
  unverifiedTokens: [ { chainId: <int>, contractAddress: <string>, visibility: <int> }],
  socialLinks: [ { url: <string>, text: <string>, visibility: <int> }]
}

I would prefer to use the same nim structure for both saving and querying profile showcase preferences from status-go. And it is possible to completely remove converying in the nim layer, but then the position and correct id names will have to be filled in qml.

I'm not sure if I'm understanding correctly what you say here but if I'm not wrong for the UI to do the proper joins we will need to indentify each item by a key being this key the following corresponding data for each case:

  • Communities --> key = communityId
  • Accounts --> key = walletAddress
  • VerifiedTokens (assets) --> key = symbol in case of non-community ones but a hash(chainId, tokenId) or something (we need to look at the assetsModel from wallet) for community ones
  • UnverifiedTokens --> I really don't know about how these are treat in wallet
  • Collectibles --> key = uid value build from chainId, tokenId and contractAddress

I think that if there's the need of some key transformation, it should happen in nim and the UI should not know anything about the rest of params, just the key.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that if there's the need of some key transformation, it should happen in nim and the UI should not know anything about the rest of params, just the key.

I think it's a good point to keep the nim specific logic in nim so that we don't have to duplicate it in qml as well.

@MishkaRogachev MishkaRogachev force-pushed the feat/issue-13688-featprofileshowcase-simplified-nim-backend-for-profile-showcase-settings branch from 76376aa to 13969c0 Compare February 26, 2024 12:16
profileShowcasePreferencesAssetsModel: ProfileShowcasePreferencesModel
profileShowcasePreferencesAssetsModelVariant: QVariant
profileShowcasePreferencesSocialLinksModel: ProfileShowcasePreferencesModel
profileShowcasePreferencesSocialLinksModelVariant: QVariant
Copy link
Member

Choose a reason for hiding this comment

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

Does it make sense to publish the social links related stuff when it's still TODO?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was waiting for status-im/status-go#4775, will update PR soon with social links soon

ui/app/AppLayouts/Profile/stores/ProfileStore.qml Outdated Show resolved Hide resolved
@MishkaRogachev MishkaRogachev force-pushed the feat/issue-13688-featprofileshowcase-simplified-nim-backend-for-profile-showcase-settings branch from 13969c0 to 6f3cf67 Compare February 26, 2024 17:17
@MishkaRogachev
Copy link
Contributor Author

For reviewers: this PR is not for merging for now, it's a proposal

@@ -110,6 +110,9 @@ proc toJsonNode*(self: ProfileShowcaseCollectiblePreference): JsonNode =
"order": self.order,
}

proc toCombinedCollectibleId*(self: ProfileShowcaseCollectiblePreference): string =
Copy link
Contributor

Choose a reason for hiding this comment

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

WDYT about adding a symmetric fromCombiledCollectibleId instead of spreading this formatting logic into other pieces of code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ill improve it soon, after merging current PRs

Copy link
Contributor

Choose a reason for hiding this comment

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

ill improve it soon, after merging current PRs

After merging this PR?

@@ -157,6 +162,67 @@ method storeProfileShowcasePreferences(self: Module,
revealedAddresses
)

method saveProfileShowcasePreferences*(self: Module, showcase: ProfileShowcaseSaveData) =
Copy link
Contributor

Choose a reason for hiding this comment

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

the initial json means the json composed in qml when saving?

I find it ok if this data is really needed here, in saveProfileShowcasePreferences. My reasoning is that the profileShowcasePreferences only operates on visibility and position. If the metadata is needed on save operation, I find it ok to be collected on save as opposed to be carried around in other places where it's not immediatly needed.

But I don't really understand why this data needs to be collected here just to be forwarded to status-go. I'd expect status-go not to need accounts metadata for example when saving some accounts showcase preferences. IMO this data could be kept in sync by status-go internals.

Unless I'm missing something, I think it would be more or less the same if we're collecting this data in saveProfileShowcasePreferences or qml. The best solution IMO is for this data not to be needed on save. The profile showcase preferences is not meant to save accounts metadata, just some visibilities and positions.

@@ -157,6 +162,67 @@ method storeProfileShowcasePreferences(self: Module,
revealedAddresses
)

method saveProfileShowcasePreferences*(self: Module, showcase: ProfileShowcaseSaveData) =
Copy link
Contributor

Choose a reason for hiding this comment

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

On the other hand, I see it's quite an overhead to parse the qml updates. The profile settings are going through the following changes:

---qml---

  1. model to string
    ---nim---
  2. string -> json
  3. json -> nim object 1
  4. nim object 1 -> nim object 2 (similar object)
  5. nim object 2 -> json
  6. json -> back to string

would your proposal help in simplifying this flow as well?

@MishkaRogachev MishkaRogachev marked this pull request as draft February 27, 2024 15:27
ui/app/AppLayouts/Profile/stores/ProfileStore.qml Outdated Show resolved Hide resolved
function storeProfileShowcasePreferences() {
root.profileModule.storeProfileShowcasePreferences()
}

function saveProfileShowcasePreferences(json) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a reminder: Here we will need to add the identity tab data management.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not for now, because of profile image. Let's open an issue instead :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Will you open it? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -157,6 +162,67 @@ method storeProfileShowcasePreferences(self: Module,
revealedAddresses
)

method saveProfileShowcasePreferences*(self: Module, showcase: ProfileShowcaseSaveData) =
Copy link
Contributor

Choose a reason for hiding this comment

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

For verifiedTokens and unverifiedTokens I'd use the word assets instead of tokens to have more nomenclature consistency!

ProfileShowcasePreferencesItem* = object of RootObj
showcaseKey*: string
showcaseVisibility*: ProfileShowcaseVisibility
showcasePosition*: int
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we then need the position? I think we talked about using the natural order at least in the UI, with the natural order it should be enough

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we don't have plans to support diff changes, i can remove it. But just in case we will need it in the future it's worth having them in the model.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's ok to have it in the preferences model. We already have code in the new models that depends on showcasePosition. IMO the contacts profile doesn't need the position and can use the natural order.


import app_service/service/profile/dto/profile_showcase_preferences

type ProfileShowcaseSaveEntry* = ref object of RootObj
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need a different type than ProfileShowcasePreferencesItem in here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In case we have similar requirements to the model source item and json structure, it may work. But on the latest discussion stage they are a bit different.

Copy link
Contributor

Choose a reason for hiding this comment

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

Which are the differences?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fields naming and extra fields for collectibles

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even if they are two identical structures, I'm against using the same type for models and for reflecting the json structure. It would be a time bomb.

Copy link
Contributor

Choose a reason for hiding this comment

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

Even if they are two identical structures, I'm against using the same type for models and for reflecting the json structure. It would be a time bomb.

Probably I'm missing something but I'd opt for using same type of object when we are talking about the same data instead of creating different types each time we do different actions, otherwise we are acumulating types and types that indeed define the same things. However, you have a better view of the complete flow so I leave it up to you! It was just a suggestion! :)

@MishkaRogachev
Copy link
Contributor Author

For verifiedTokens and unverifiedTokens I'd use the word assets instead of tokens to have more nomenclature consistency!

I don't have strong opinion here, but it's better to have same naming as wallet team @dlipicar @alaibe @Khushboo-dev-cpp WDYT?

@alexjba
Copy link
Contributor

alexjba commented Feb 28, 2024

One note: currently when saving the profile showcase the app is briefly freezing. Could we move the save to an async task?

@MishkaRogachev
Copy link
Contributor Author

One note: currently when saving the profile showcase the app is briefly freezing. Could we move the save to an async task?

Yes! I will update the PR soon

@MishkaRogachev MishkaRogachev force-pushed the feat/issue-13688-featprofileshowcase-simplified-nim-backend-for-profile-showcase-settings branch from 6f3cf67 to 4bcb6d6 Compare March 1, 2024 09:11
@MishkaRogachev MishkaRogachev force-pushed the feat/issue-13688-featprofileshowcase-simplified-nim-backend-for-profile-showcase-settings branch 2 times, most recently from a5c91a6 to 8177ced Compare March 4, 2024 11:40
@MishkaRogachev MishkaRogachev force-pushed the feat/issue-13688-featprofileshowcase-simplified-nim-backend-for-profile-showcase-settings branch 3 times, most recently from 391eb98 to 22b2ef7 Compare March 7, 2024 11:16
@MishkaRogachev MishkaRogachev marked this pull request as ready for review March 7, 2024 11:16
@MishkaRogachev MishkaRogachev force-pushed the feat/issue-13688-featprofileshowcase-simplified-nim-backend-for-profile-showcase-settings branch from 22b2ef7 to 925c03b Compare March 7, 2024 11:27
@MishkaRogachev MishkaRogachev force-pushed the feat/issue-13688-featprofileshowcase-simplified-nim-backend-for-profile-showcase-settings branch from 925c03b to a4a32d5 Compare March 7, 2024 14:05
@MishkaRogachev
Copy link
Contributor Author

@caybro @noeliaSD @alexjba this PR is up for review, but it has a few TODOs that I'd like to clean up after the UI is already working with the new api

Copy link
Contributor

@alexjba alexjba left a comment

Choose a reason for hiding this comment

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

LGTM in general! Nice work!

2 questions inline:

result.showcaseVisibility = visibility

type
ModelRole {.pure.} = enum
Copy link
Contributor

Choose a reason for hiding this comment

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

This model won't have the showcasePosition?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i'll add it now

@@ -110,6 +110,9 @@ proc toJsonNode*(self: ProfileShowcaseCollectiblePreference): JsonNode =
"order": self.order,
}

proc toCombinedCollectibleId*(self: ProfileShowcaseCollectiblePreference): string =
Copy link
Contributor

Choose a reason for hiding this comment

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

ill improve it soon, after merging current PRs

After merging this PR?

@MishkaRogachev
Copy link
Contributor Author

After merging this PR?

@alexjba yes, i want refactor this to helpers function and use it in the wallet section too

@MishkaRogachev MishkaRogachev force-pushed the feat/issue-13688-featprofileshowcase-simplified-nim-backend-for-profile-showcase-settings branch from a4a32d5 to 1dda3b1 Compare March 7, 2024 15:16
Copy link
Contributor

@alexjba alexjba 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! Thanks! 🍻

@MishkaRogachev MishkaRogachev force-pushed the feat/issue-13688-featprofileshowcase-simplified-nim-backend-for-profile-showcase-settings branch 3 times, most recently from bbe75af to a337176 Compare March 8, 2024 15:10
Copy link
Contributor

@noeliaSD noeliaSD left a comment

Choose a reason for hiding this comment

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

Tested on #13886

@caybro caybro self-requested a review March 8, 2024 15:57
@MishkaRogachev MishkaRogachev force-pushed the feat/issue-13688-featprofileshowcase-simplified-nim-backend-for-profile-showcase-settings branch from a337176 to 063ff3c Compare March 8, 2024 16:21
@MishkaRogachev MishkaRogachev force-pushed the feat/issue-13688-featprofileshowcase-simplified-nim-backend-for-profile-showcase-settings branch from 063ff3c to 15c9bb0 Compare March 8, 2024 16:22
@alexjba
Copy link
Contributor

alexjba commented Mar 8, 2024

@MishkaRogachev Found an issue while saving the collectibles. The status-go error is saying the owner account is not in showcase, but I see it there.

DBG 2024-03-08 18:19:23.005+02:00 [threadpool task thread] initiating task   topics="task-threadpool" tid=32866290 file=threadpool.nim:54 messageType=SaveProfileShowcasePreferencesTaskArg:ObjectType threadid=32866290 task="{\"$type\":\"SaveProfileShowcasePreferencesTaskArg:ObjectType\",\"preferences\":{\"$type\":\"ProfileShowcasePreferencesDto:ObjectType\",\"communities\":[{\"$type\":\"ProfileShowcaseCommunityPreference:ObjectType\",\"communityId\":\"0x021b9be65e5ca8e2699296b23374f57a1a0a8bf14f53c24f67f1637c123701abf8\",\"showcaseVisibility\":2,\"order\":0},{\"$type\":\"ProfileShowcaseCommunityPreference:ObjectType\",\"communityId\":\"0x023bc3823a823a5c899dadebe73cd030c446fbefc2d035d5c943bbebb8f22125be\",\"showcaseVisibility\":2,\"order\":1},{\"$type\":\"ProfileShowcaseCommunityPreference:ObjectType\",\"communityId\":\"0x0269b18891d3b42ebd047be103d05c7da72969fa4417bf6b5f4abd6b6b872e8207\",\"showcaseVisibility\":2,\"order\":2},{\"$type\":\"ProfileShowcaseCommunityPreference:ObjectType\",\"communityId\":\"0x026b5070c012cafcac1477ce19c45563e177f6b7a08bfda6b90bc9fdacc93cd4e1\",\"showcaseVisibility\":2,\"order\":3}],\"accounts\":[{\"$type\":\"ProfileShowcaseAccountPreference:ObjectType\",\"address\":\"0x8b6950bb8a74489a83e6a1281e3aa008f02bf368\",\"showcaseVisibility\":3,\"order\":0},{\"$type\":\"ProfileShowcaseAccountPreference:ObjectType\",\"address\":\"0xb5102d8abe09650e5f18248b18c09c27df1765b6\",\"showcaseVisibility\":2,\"order\":1},{\"$type\":\"ProfileShowcaseAccountPreference:ObjectType\",\"address\":\"0x4f014b9143c52a9f07b7edf9fd79ca2176532140\",\"showcaseVisibility\":3,\"order\":2}],\"collectibles\":[{\"$type\":\"ProfileShowcaseCollectiblePreference:ObjectType\",\"contractAddress\":\"0x21f6f5cb75e81e5104d890d750270ed6538c50cb\",\"chainId\":10,\"tokenId\":\"2\",\"showcaseVisibility\":3,\"order\":0}],\"verifiedTokens\":[],\"unverifiedTokens\":[],\"socialLinks\":[]},\"vptr\":105553123694336,\"slot\":\"asyncProfileShowcasePreferencesSaved\",\"tptr\":4310183228}"
DBG 2024-03-08 18:19:23.005+02:00 NewBE_callPrivateRPC                       topics="rpc" tid=32866290 file=core.nim:27 rpc_method=wakuext_setProfileShowcasePreferences
DBG 2024-03-08 18:19:23.005+02:00 NewBE_callPrivateRPC                       topics="rpc" tid=32866203 file=core.nim:27 rpc_method=accounts_addressWasShown
DBG 2024-03-08 18:19:23.006+02:00 NewBE_callPrivateRPC                       topics="rpc" tid=32866203 file=core.nim:27 rpc_method=accounts_addressWasShown
ERR 2024-03-08 18:19:23.006+02:00 rpc response error                         topics="rpc" tid=32866290 file=core.nim:36 err="\nstatus-go error [methodName:wakuext_setProfileShowcasePreferences, code:-32000, message:account holding the collectible is not presented in the profile showcase ]\n"
ERR 2024-03-08 18:19:23.006+02:00 error doing rpc request                    topics="rpc" tid=32866290 file=core.nim:40 methodName=wakuext_setProfileShowcasePreferences exception="\nstatus-go error [methodName:wakuext_setProfileShowcasePreferences, code:-32000, message:account holding the collectible is not presented in the profile showcase ]\n"
DBG 2024-03-08 18:19:23.018+02:00 [threadpool task thread] initiating task   topics="task-threadpool" tid=32866289 file=threadpool.nim:54 messageType=QObjectTaskArg:ObjectType threadid=32866289 task="{\"$type\":\"QObjectTaskArg:ObjectType\",\"vptr\":105553123694336,\"slot\":\"asyncProfileShowcasePreferencesLoaded\",\"tptr\":4310184416}"
DBG 2024-03-08 18:19:23.018+02:00 NewBE_callPrivateRPC                       topics="rpc" tid=32866289 file=core.nim:27 rpc_method=wakuext_getProfileShowcasePreferences
ERR 2024-03-08 18:19:23.018+02:00 Error saving profile showcase preferences  topics="profile-service" tid=32866203 file=service.nim:194 msg="\"\\nstatus-go error [methodName:wakuext_setProfileShowcasePreferences, code:-32000, message:account holding the collectible is not presented in the profile showcase ]\\n\""
Screen.Recording.2024-03-08.at.18.22.31.mov

- Created JSON file according to new backend structure when saving.
- Updated `dirty state` to sync writable and movable models when position is changed to have a better internal models sync.
- Reenabled identity fields save.

Closes #13799
Updated showcase limits with values coming from backend.
@noeliaSD
Copy link
Contributor

noeliaSD commented Mar 8, 2024

@MishkaRogachev Found an issue while saving the collectibles. The status-go error is saying the owner account is not in showcase, but I see it there.

DBG 2024-03-08 18:19:23.005+02:00 [threadpool task thread] initiating task   topics="task-threadpool" tid=32866290 file=threadpool.nim:54 messageType=SaveProfileShowcasePreferencesTaskArg:ObjectType threadid=32866290 task="{\"$type\":\"SaveProfileShowcasePreferencesTaskArg:ObjectType\",\"preferences\":{\"$type\":\"ProfileShowcasePreferencesDto:ObjectType\",\"communities\":[{\"$type\":\"ProfileShowcaseCommunityPreference:ObjectType\",\"communityId\":\"0x021b9be65e5ca8e2699296b23374f57a1a0a8bf14f53c24f67f1637c123701abf8\",\"showcaseVisibility\":2,\"order\":0},{\"$type\":\"ProfileShowcaseCommunityPreference:ObjectType\",\"communityId\":\"0x023bc3823a823a5c899dadebe73cd030c446fbefc2d035d5c943bbebb8f22125be\",\"showcaseVisibility\":2,\"order\":1},{\"$type\":\"ProfileShowcaseCommunityPreference:ObjectType\",\"communityId\":\"0x0269b18891d3b42ebd047be103d05c7da72969fa4417bf6b5f4abd6b6b872e8207\",\"showcaseVisibility\":2,\"order\":2},{\"$type\":\"ProfileShowcaseCommunityPreference:ObjectType\",\"communityId\":\"0x026b5070c012cafcac1477ce19c45563e177f6b7a08bfda6b90bc9fdacc93cd4e1\",\"showcaseVisibility\":2,\"order\":3}],\"accounts\":[{\"$type\":\"ProfileShowcaseAccountPreference:ObjectType\",\"address\":\"0x8b6950bb8a74489a83e6a1281e3aa008f02bf368\",\"showcaseVisibility\":3,\"order\":0},{\"$type\":\"ProfileShowcaseAccountPreference:ObjectType\",\"address\":\"0xb5102d8abe09650e5f18248b18c09c27df1765b6\",\"showcaseVisibility\":2,\"order\":1},{\"$type\":\"ProfileShowcaseAccountPreference:ObjectType\",\"address\":\"0x4f014b9143c52a9f07b7edf9fd79ca2176532140\",\"showcaseVisibility\":3,\"order\":2}],\"collectibles\":[{\"$type\":\"ProfileShowcaseCollectiblePreference:ObjectType\",\"contractAddress\":\"0x21f6f5cb75e81e5104d890d750270ed6538c50cb\",\"chainId\":10,\"tokenId\":\"2\",\"showcaseVisibility\":3,\"order\":0}],\"verifiedTokens\":[],\"unverifiedTokens\":[],\"socialLinks\":[]},\"vptr\":105553123694336,\"slot\":\"asyncProfileShowcasePreferencesSaved\",\"tptr\":4310183228}"
DBG 2024-03-08 18:19:23.005+02:00 NewBE_callPrivateRPC                       topics="rpc" tid=32866290 file=core.nim:27 rpc_method=wakuext_setProfileShowcasePreferences
DBG 2024-03-08 18:19:23.005+02:00 NewBE_callPrivateRPC                       topics="rpc" tid=32866203 file=core.nim:27 rpc_method=accounts_addressWasShown
DBG 2024-03-08 18:19:23.006+02:00 NewBE_callPrivateRPC                       topics="rpc" tid=32866203 file=core.nim:27 rpc_method=accounts_addressWasShown
ERR 2024-03-08 18:19:23.006+02:00 rpc response error                         topics="rpc" tid=32866290 file=core.nim:36 err="\nstatus-go error [methodName:wakuext_setProfileShowcasePreferences, code:-32000, message:account holding the collectible is not presented in the profile showcase ]\n"
ERR 2024-03-08 18:19:23.006+02:00 error doing rpc request                    topics="rpc" tid=32866290 file=core.nim:40 methodName=wakuext_setProfileShowcasePreferences exception="\nstatus-go error [methodName:wakuext_setProfileShowcasePreferences, code:-32000, message:account holding the collectible is not presented in the profile showcase ]\n"
DBG 2024-03-08 18:19:23.018+02:00 [threadpool task thread] initiating task   topics="task-threadpool" tid=32866289 file=threadpool.nim:54 messageType=QObjectTaskArg:ObjectType threadid=32866289 task="{\"$type\":\"QObjectTaskArg:ObjectType\",\"vptr\":105553123694336,\"slot\":\"asyncProfileShowcasePreferencesLoaded\",\"tptr\":4310184416}"
DBG 2024-03-08 18:19:23.018+02:00 NewBE_callPrivateRPC                       topics="rpc" tid=32866289 file=core.nim:27 rpc_method=wakuext_getProfileShowcasePreferences
ERR 2024-03-08 18:19:23.018+02:00 Error saving profile showcase preferences  topics="profile-service" tid=32866203 file=service.nim:194 msg="\"\\nstatus-go error [methodName:wakuext_setProfileShowcasePreferences, code:-32000, message:account holding the collectible is not presented in the profile showcase ]\\n\""

Screen.Recording.2024-03-08.at.18.22.31.mov

We can create task for next week!

@MishkaRogachev MishkaRogachev merged commit 74dfd18 into master Mar 8, 2024
8 checks passed
@MishkaRogachev MishkaRogachev deleted the feat/issue-13688-featprofileshowcase-simplified-nim-backend-for-profile-showcase-settings branch March 8, 2024 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(ProfileShowcase): Simplified NIM backend for profile showcase settings
5 participants