mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-09 22:06:25 +00:00
fix(UnfurlingUrls): Fix community invitation when community cannot be fetched
This commit is contained in:
parent
606d30abc6
commit
2accc52b15
@ -29,6 +29,15 @@ Control {
|
|||||||
|
|
||||||
property var invitedCommunity
|
property var invitedCommunity
|
||||||
|
|
||||||
|
readonly property string communityName: !!d.invitedCommunity ? d.invitedCommunity.name : ""
|
||||||
|
readonly property string communityDescription: !!d.invitedCommunity ? d.invitedCommunity.description : ""
|
||||||
|
readonly property string communityImage: !!d.invitedCommunity ? d.invitedCommunity.image : ""
|
||||||
|
readonly property string communityColor: !!d.invitedCommunity ? d.invitedCommunity.color : ""
|
||||||
|
readonly property int communityNbMembers: !!d.invitedCommunity ? d.invitedCommunity.nbMembers : 0
|
||||||
|
readonly property bool communityVerified: false //!!d.invitedCommunity ? d.invitedCommunity.verified : false TODO: add this to the community object if we should support verified communities
|
||||||
|
readonly property bool communityJoined: !!d.invitedCommunity ? d.invitedCommunity.joined : false
|
||||||
|
readonly property bool communitySpectated: !!d.invitedCommunity ? d.invitedCommunity.spectated : false
|
||||||
|
|
||||||
readonly property int margin: 12
|
readonly property int margin: 12
|
||||||
readonly property int radius: 16
|
readonly property int radius: 16
|
||||||
|
|
||||||
@ -91,8 +100,8 @@ Control {
|
|||||||
Layout.topMargin: 8
|
Layout.topMargin: 8
|
||||||
Layout.bottomMargin: 8
|
Layout.bottomMargin: 8
|
||||||
|
|
||||||
text: d.invitedCommunity.verifed ? qsTr("Verified community invitation") : qsTr("Community invitation")
|
text: d.communityVerified ? qsTr("Verified community invitation") : qsTr("Community invitation")
|
||||||
color: d.invitedCommunity.verifed ? Theme.palette.primaryColor1 : Theme.palette.baseColor1
|
color: d.communityVerified ? Theme.palette.primaryColor1 : Theme.palette.baseColor1
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
font.pixelSize: 13
|
font.pixelSize: 13
|
||||||
}
|
}
|
||||||
@ -118,13 +127,13 @@ Control {
|
|||||||
Layout.preferredWidth: 40
|
Layout.preferredWidth: 40
|
||||||
Layout.preferredHeight: 40
|
Layout.preferredHeight: 40
|
||||||
|
|
||||||
name: d.invitedCommunity.name
|
name: d.communityName
|
||||||
|
|
||||||
asset {
|
asset {
|
||||||
width: 40
|
width: 40
|
||||||
height: 40
|
height: 40
|
||||||
name: d.invitedCommunity.image
|
name: d.communityImage
|
||||||
color: d.invitedCommunity.color
|
color: d.communityColor
|
||||||
isImage: true
|
isImage: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,7 +144,7 @@ Control {
|
|||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
text: d.invitedCommunity.name
|
text: d.communityName
|
||||||
font.weight: Font.Bold
|
font.weight: Font.Bold
|
||||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
font.pixelSize: 17
|
font.pixelSize: 17
|
||||||
@ -145,7 +154,7 @@ Control {
|
|||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
text: d.invitedCommunity.description
|
text: d.communityDescription
|
||||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
color: Theme.palette.directColor1
|
color: Theme.palette.directColor1
|
||||||
}
|
}
|
||||||
@ -153,7 +162,7 @@ Control {
|
|||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
text: qsTr("%n member(s)", "", d.invitedCommunity.nbMembers)
|
text: qsTr("%n member(s)", "", d.communityNbMembers)
|
||||||
font.pixelSize: 13
|
font.pixelSize: 13
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: Theme.palette.baseColor1
|
color: Theme.palette.baseColor1
|
||||||
@ -177,7 +186,7 @@ Control {
|
|||||||
radius: d.radius - 1 // We do -1, otherwise there's a gap between border and button
|
radius: d.radius - 1 // We do -1, otherwise there's a gap between border and button
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (d.invitedCommunity.joined || d.invitedCommunity.spectated) {
|
if (d.communityJoined || d.communitySpectated) {
|
||||||
root.store.setActiveCommunity(communityId)
|
root.store.setActiveCommunity(communityId)
|
||||||
} else {
|
} else {
|
||||||
root.store.spectateCommunity(communityId, userProfile.name)
|
root.store.spectateCommunity(communityId, userProfile.name)
|
||||||
|
@ -183,10 +183,10 @@ Column {
|
|||||||
store: root.store
|
store: root.store
|
||||||
communityId: invitationData ? invitationData.communityId : ""
|
communityId: invitationData ? invitationData.communityId : ""
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
visible: invitationData && !invitationData.fetching
|
visible: !!invitationData && !invitationData.fetching
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
enabled: invitationData && invitationData.fetching
|
enabled: !!invitationData && invitationData.fetching
|
||||||
target: root.store.communitiesModuleInst
|
target: root.store.communitiesModuleInst
|
||||||
function onCommunityAdded(communityId: string) {
|
function onCommunityAdded(communityId: string) {
|
||||||
if (communityId !== invitationData.communityId) return
|
if (communityId !== invitationData.communityId) return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user