feat(ProfileShowcase): Remove unnecessary roles renamings from profile showcase models

This commit is contained in:
Alex Jbanca 2024-03-11 20:54:51 +02:00 committed by Alex Jbanca
parent b77d6ab76f
commit 7f78c03e6a
2 changed files with 8 additions and 154 deletions

View File

@ -13,30 +13,24 @@ QObject {
// Communities input models // Communities input models
property alias communitiesSourceModel: communitySFPM.sourceModel property alias communitiesSourceModel: communitySFPM.sourceModel
property alias communitiesShowcaseModel: communityShowcaseRenaming.sourceModel
// adapted models // adapted models
readonly property alias adaptedCommunitiesSourceModel: communitySFPM readonly property alias adaptedCommunitiesSourceModel: communitySFPM
readonly property alias adaptedCommunitiesShowcaseModel: communityShowcaseRenaming
// Accounts input models // Accounts input models
property alias accountsSourceModel: accountsSFPM.sourceModel property alias accountsSourceModel: accountsSFPM.sourceModel
property alias accountsShowcaseModel: accountsRenamingShowcase.sourceModel
// adapted models // adapted models
readonly property alias adaptedAccountsSourceModel: accountsSFPM readonly property alias adaptedAccountsSourceModel: accountsSFPM
readonly property alias adaptedAccountsShowcaseModel: accountsRenamingShowcase
// Collectibles input models // Collectibles input models
property alias collectiblesSourceModel: collectiblesSFPM.sourceModel property alias collectiblesSourceModel: collectiblesSFPM.sourceModel
property alias collectiblesShowcaseModel: collectiblesRenamingShowcase.sourceModel
// adapted models // adapted models
readonly property alias adaptedCollectiblesSourceModel: collectiblesSFPM readonly property alias adaptedCollectiblesSourceModel: collectiblesSFPM
readonly property alias adaptedCollectiblesShowcaseModel: collectiblesRenamingShowcase
// Social links input models // Social links input models
property alias socialLinksSourceModel: socialLinksRoleRenaming.sourceModel property alias socialLinksSourceModel: socialLinksSFPM.sourceModel
// adapted models // adapted models
readonly property alias adaptedSocialLinksSourceModel: socialLinksSFPM readonly property alias adaptedSocialLinksSourceModel: socialLinksSFPM
@ -52,51 +46,6 @@ QObject {
] ]
} }
RolesRenamingModel {
id: communityShowcaseRenaming
mapping: [
RoleRename {
from: "id"
to: "showcaseKey"
},
RoleRename {
from: "order"
to: "showcasePosition"
},
// Removing model duplicates
// TODO: remove this when the lightweigth model is used
// https://github.com/status-im/status-desktop/issues/13688
RoleRename {
from: "name"
to: "_name"
},
RoleRename {
from: "memberRole"
to: "_memberRole"
},
RoleRename {
from: "image"
to: "_image"
},
RoleRename {
from: "color"
to: "_color"
},
RoleRename {
from: "description"
to: "_description"
},
RoleRename {
from: "membersCount"
to: "_membersCount"
},
RoleRename {
from: "loading"
to: "_loading"
}
]
}
SortFilterProxyModel { SortFilterProxyModel {
id: accountsSFPM id: accountsSFPM
proxyRoles: [ proxyRoles: [
@ -108,35 +57,6 @@ QObject {
] ]
} }
RolesRenamingModel {
id: accountsRenamingShowcase
mapping: [
RoleRename {
from: "address"
to: "showcaseKey"
},
RoleRename {
from: "order"
to: "showcasePosition"
},
// Removing model duplicates
// TODO: remove this when the lightweigth model is used
// https://github.com/status-im/status-desktop/issues/13688
RoleRename {
from: "name"
to: "_name"
},
RoleRename {
from: "emoji"
to: "_emoji"
},
RoleRename {
from: "colorId"
to: "_colorId"
}
]
}
SortFilterProxyModel { SortFilterProxyModel {
id: collectiblesSFPM id: collectiblesSFPM
proxyRoles: [ proxyRoles: [
@ -148,76 +68,13 @@ QObject {
] ]
} }
RolesRenamingModel {
id: collectiblesRenamingShowcase
mapping: [
RoleRename {
from: "uid"
to: "showcaseKey"
},
RoleRename {
from: "order"
to: "showcasePosition"
},
// Removing model duplicates
// TODO: remove this when the lightweigth model is used
// https://github.com/status-im/status-desktop/issues/13688
RoleRename {
from: "chainId"
to: "_chainId"
},
RoleRename {
from: "contractAddress"
to: "_contractAddress"
},
RoleRename {
from: "tokenId"
to: "_tokenId"
},
RoleRename {
from: "name"
to: "_name"
},
RoleRename {
from: "imageUrl"
to: "_imageUrl"
},
RoleRename {
from: "backgroundColor"
to: "_backgroundColor"
},
RoleRename {
from: "collectionName"
to: "_collectionName"
},
RoleRename {
from: "isLoading"
to: "_isLoading"
},
RoleRename {
from: "communityId"
to: "_communityId"
}
]
}
RolesRenamingModel {
id: socialLinksRoleRenaming
mapping: [
RoleRename {
from: "uuid"
to: "showcaseKey"
}
]
}
SortFilterProxyModel { SortFilterProxyModel {
id: socialLinksSFPM id: socialLinksSFPM
sourceModel: socialLinksRoleRenaming
proxyRoles: [ proxyRoles: [
FastExpressionRole { FastExpressionRole {
name: "showcasePosition" name: "showcaseKey"
expression: index expression: model.url
expectedRoles: ["url"]
}, },
FastExpressionRole { FastExpressionRole {
name: "showcaseVisibility" name: "showcaseVisibility"

View File

@ -24,7 +24,7 @@ QObject {
// Input models // Input models
property alias communitiesSourceModel: modelAdapter.communitiesSourceModel property alias communitiesSourceModel: modelAdapter.communitiesSourceModel
property alias communitiesShowcaseModel: modelAdapter.communitiesShowcaseModel property alias communitiesShowcaseModel: communities.showcaseModel
property string communitiesSearcherText property string communitiesSearcherText
// Output models // Output models
@ -48,7 +48,7 @@ QObject {
// Input models // Input models
property alias accountsSourceModel: modelAdapter.accountsSourceModel property alias accountsSourceModel: modelAdapter.accountsSourceModel
property alias accountsShowcaseModel: modelAdapter.accountsShowcaseModel property alias accountsShowcaseModel: accounts.showcaseModel
property string accountsSearcherText property string accountsSearcherText
// Output models // Output models
@ -79,7 +79,7 @@ QObject {
// Input models // Input models
property alias collectiblesSourceModel: modelAdapter.collectiblesSourceModel property alias collectiblesSourceModel: modelAdapter.collectiblesSourceModel
property alias collectiblesShowcaseModel: modelAdapter.collectiblesShowcaseModel property alias collectiblesShowcaseModel: collectibles.showcaseModel
property string collectiblesSearcherText property string collectiblesSearcherText
// Output models // Output models
@ -151,7 +151,6 @@ QObject {
} }
sourceModel: modelAdapter.adaptedCommunitiesSourceModel sourceModel: modelAdapter.adaptedCommunitiesSourceModel
showcaseModel: modelAdapter.adaptedCommunitiesShowcaseModel
searcherFilter: FastExpressionFilter { searcherFilter: FastExpressionFilter {
expression: { expression: {
root.communitiesSearcherText root.communitiesSearcherText
@ -166,7 +165,6 @@ QObject {
id: accounts id: accounts
sourceModel: modelAdapter.adaptedAccountsSourceModel sourceModel: modelAdapter.adaptedAccountsSourceModel
showcaseModel: modelAdapter.adaptedAccountsShowcaseModel
searcherFilter: FastExpressionFilter { searcherFilter: FastExpressionFilter {
expression: { expression: {
root.accountsSearcherText root.accountsSearcherText
@ -181,7 +179,6 @@ QObject {
id: collectibles id: collectibles
sourceModel: collectiblesFilter sourceModel: collectiblesFilter
showcaseModel: modelAdapter.adaptedCollectiblesShowcaseModel
searcherFilter: FastExpressionFilter { searcherFilter: FastExpressionFilter {
expression: { expression: {
root.collectiblesSearcherText root.collectiblesSearcherText