2020-12-11 20:38:10 +00:00
import QtQuick 2.3
2021-04-29 19:54:09 +00:00
import QtQuick . Dialogs 1.3
2021-10-01 15:58:36 +00:00
2021-09-28 15:04:06 +00:00
import utils 1.0
2020-12-11 20:38:10 +00:00
2021-10-18 12:32:48 +00:00
import StatusQ . Core 0.1
import StatusQ . Core . Theme 0.1
import StatusQ . Controls 0.1
2021-10-27 21:27:49 +00:00
import shared . panels 1.0
import shared . popups 1.0
2021-10-18 12:32:48 +00:00
2020-12-11 20:38:10 +00:00
Item {
id: root
anchors.left: parent . left
2021-08-30 09:50:45 +00:00
height: rectangleBubbleLoader . height
2021-04-30 14:45:13 +00:00
width: rectangleBubbleLoader . width
2020-12-11 20:38:10 +00:00
2021-10-21 00:41:54 +00:00
property string communityId
property var invitedCommunity
property int innerMargin: 12
property bool isLink: false
property var store
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
function getCommunity ( ) {
2021-12-13 14:24:21 +00:00
// Not Refactored Yet
// try {
// const communityJson = root.store.chatsModelInst.communities.list.getCommunityByIdJson(communityId)
// if (!communityJson) {
// return null
// }
2021-07-22 15:22:02 +00:00
2021-12-13 14:24:21 +00:00
// let community = JSON.parse(communityJson);
// if (community) {
// community.nbMembers = community.members.length;
// }
// return community
// } catch (e) {
// console.error("Error parsing community", e)
// }
2021-07-22 15:22:02 +00:00
return null
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
}
2020-12-11 20:38:10 +00:00
Component.onCompleted: {
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
root . invitedCommunity = getCommunity ( )
}
2020-12-11 20:38:10 +00:00
2021-12-13 14:24:21 +00:00
// Connections {
// target: root.store.chatsModelInst.communities
// onCommunityChanged: function (communityId) {
// if (communityId === root.communityId) {
// root.invitedCommunity = getCommunity()
// }
// }
// }
2020-12-11 20:38:10 +00:00
2021-07-12 17:49:06 +00:00
Component {
id: confirmationPopupComponent
ConfirmationDialog {
property string settingsProp: ""
property var onConfirmed: ( function ( ) { } )
showCancelButton: true
2021-07-16 20:22:50 +00:00
//% "This feature is experimental and is meant for testing purposes by core contributors and the community. It's not meant for real use and makes no claims of security or integrity of funds or data. Use at your own risk."
confirmationText: qsTrId ( "this-feature-is-experimental-and-is-meant-for-testing-purposes-by-core-contributors-and-the-community--it-s-not-meant-for-real-use-and-makes-no-claims-of-security-or-integrity-of-funds-or-data--use-at-your-own-risk-" )
//% "I understand"
confirmButtonLabel: qsTrId ( "i-understand" )
2021-07-12 17:49:06 +00:00
onConfirmButtonClicked: {
2021-10-20 09:50:50 +00:00
localAccountSensitiveSettings . communitiesEnabled = true
2021-07-12 17:49:06 +00:00
onConfirmed ( )
close ( )
}
onCancelButtonClicked: {
close ( )
}
onClosed: {
destroy ( )
}
}
}
2021-07-20 12:08:36 +00:00
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
2020-12-11 20:38:10 +00:00
Loader {
id: rectangleBubbleLoader
active: ! ! invitedCommunity
sourceComponent: Component {
Rectangle {
id: rectangleBubble
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
property alias button: joinBtn
2021-12-13 14:24:21 +00:00
// Not Refactored Yet
property bool isPendingRequest: false //root.store.chatsModelInst.communities.isCommunityRequestPending(communityId)
2020-12-11 20:38:10 +00:00
width: 270
2021-08-30 09:50:45 +00:00
height: title . height + title . anchors . topMargin +
invitedYou . height + invitedYou . anchors . topMargin +
sep1 . height + sep1 . anchors . topMargin +
communityName . height + communityName . anchors . topMargin +
communityDesc . height + communityDesc . anchors . topMargin +
communityNbMembers . height + communityNbMembers . anchors . topMargin +
sep2 . height + sep2 . anchors . topMargin +
btnItemId . height + btnItemId . anchors . topMargin
2020-12-11 20:38:10 +00:00
radius: 16
color: Style . current . background
border.color: Style . current . border
border.width: 1
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
states: [
State {
name: "requiresEns"
2021-12-13 14:24:21 +00:00
// Not Refactored Yet
// when: invitedCommunity.ensOnly && !root.store.profileModelInst.profile.ensVerified
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
PropertyChanges {
target: joinBtn
2021-07-16 20:22:50 +00:00
//% "Membership requires an ENS username"
text: qsTrId ( "membership-requires-an-ens-username" )
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
enabled: false
}
} ,
State {
name: "inviteOnly"
when: invitedCommunity . access === Constants . communityChatInvitationOnlyAccess
PropertyChanges {
target: joinBtn
2021-07-16 20:22:50 +00:00
//% "You need to be invited"
text: qsTrId ( "you-need-to-be-invited" )
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
enabled: false
}
} ,
State {
name: "pending"
when: invitedCommunity . access === Constants . communityChatOnRequestAccess &&
rectangleBubble . isPendingRequest
PropertyChanges {
target: joinBtn
2021-07-16 20:22:50 +00:00
//% "Pending"
text: qsTrId ( "invite-chat-pending" )
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
enabled: false
}
} ,
State {
name: "joined"
2021-09-14 06:01:43 +00:00
when: ( invitedCommunity . joined && invitedCommunity . isMember ) ||
( invitedCommunity . access === Constants . communityChatPublicAccess &&
invitedCommunity . joined )
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
PropertyChanges {
target: joinBtn
2021-07-16 20:22:50 +00:00
//% "View"
text: qsTrId ( "view" )
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
}
} ,
State {
name: "requestToJoin"
when: invitedCommunity . access === Constants . communityChatOnRequestAccess &&
2021-07-20 12:08:36 +00:00
// !invitedCommunity.joined && !invitedCommunity.isMember
invitedCommunity . canRequestAccess
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
PropertyChanges {
target: joinBtn
2021-07-16 20:22:50 +00:00
//% "Request Access"
text: qsTrId ( "request-access" )
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
}
} ,
State {
name: "unjoined"
2021-09-14 06:01:43 +00:00
when: ( invitedCommunity . access === Constants . communityChatOnRequestAccess &&
invitedCommunity . isMember ) ||
( invitedCommunity . access === Constants . communityChatPublicAccess &&
! invitedCommunity . joined )
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
PropertyChanges {
target: joinBtn
2021-07-16 20:22:50 +00:00
//% "Join"
text: qsTrId ( "join" )
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
}
}
]
2021-12-13 14:24:21 +00:00
// Not Refactored Yet
// Connections {
// target: root.store.chatsModelInst.communities
// onMembershipRequestChanged: function(communityId, communityName, requestAccepted) {
// if (communityId === root.communityId) {
// rectangleBubble.isPendingRequest = false
// }
// }
// }
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
2020-12-11 20:38:10 +00:00
// TODO add check if verified
2021-10-18 12:32:48 +00:00
StatusBaseText {
2020-12-11 20:38:10 +00:00
id: title
2021-10-18 12:32:48 +00:00
color: invitedCommunity . verifed ? Theme.palette.primaryColor1 : Theme . palette . baseColor1
2020-12-11 20:38:10 +00:00
text: invitedCommunity . verifed ?
2021-02-18 16:36:05 +00:00
//% "Verified community invitation"
qsTrId ( "verified-community-invitation" ) :
//% "Community invitation"
qsTrId ( "community-invitation" )
2020-12-11 20:38:10 +00:00
font.weight: Font . Medium
anchors.top: parent . top
anchors.topMargin: Style . current . halfPadding
anchors.left: parent . left
anchors.leftMargin: root . innerMargin
font.pixelSize: 13
}
2021-10-18 12:32:48 +00:00
StatusBaseText {
2020-12-11 20:38:10 +00:00
id: invitedYou
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
text: {
2021-12-13 14:24:21 +00:00
// Not Refactored Yet
return ""
// if (root.store.chatsModelInst.channelView.activeChannel.chatType === Constants.chatType.oneToOne) {
// return isCurrentUser ?
// //% "You invited %1 to join a community"
// qsTrId("you-invited--1-to-join-a-community").arg(root.store.chatsModelInst.userNameOrAlias(root.store.chatsModelInst.channelView.activeChannel.id))
// //% "%1 invited you to join a community"
// : qsTrId("-1-invited-you-to-join-a-community").arg(displayUserName)
// } else {
// return isCurrentUser ?
// //% "You shared a community"
// qsTrId("you-shared-a-community")
// //% "A community has been shared"
// : qsTrId("a-community-has-been-shared")
// }
fix(communities): re-joining of left communities
Fixes: #2649.
Upon receipt of status-go signals which included communities that have been left (`joined: false`), those communities were being rejoined automatically when they should not have been.
fix(communities): Invitation bubble button state updates
The community state inside of the invitation bubble was not reactive to any community actions (such as joining, leaving, updating). In addition, requesting to join a community changed the button’s text to “Pending”, but upon approval, the button’s state was not updating.
The component was setting an observed community in the Component.onCompleted event, which was occurring for all invitation bubbles, but because the community wasn’t bound correctly to the bubble, once a bubble with a different community was encountered, the community in context of the bubble wasn’t updated and instead used a local copy. Once the community was bound correctly (to be reactive), the states started working correctly.
The invitation bubble has been simplied so that it has states instead of using lots of if/else statements inside of the property bindings. This simplified the component’s logic for things like onClick action and made it a lot easier to read and modify.
2021-06-24 07:21:45 +00:00
}
2020-12-11 20:38:10 +00:00
anchors.top: title . bottom
anchors.topMargin: 4
anchors.left: parent . left
anchors.leftMargin: root . innerMargin
anchors.right: parent . right
anchors.rightMargin: root . innerMargin
wrapMode: Text . WordWrap
font.pixelSize: 15
2021-10-18 12:32:48 +00:00
color: Theme . palette . directColor1
2020-12-11 20:38:10 +00:00
}
Separator {
id: sep1
anchors.top: invitedYou . bottom
anchors.topMargin: Style . current . halfPadding
}
// TODO add image when it's supported
2021-10-18 12:32:48 +00:00
StatusBaseText {
2020-12-11 20:38:10 +00:00
id: communityName
text: invitedCommunity . name
anchors.top: sep1 . bottom
anchors.topMargin: root . innerMargin
anchors.left: parent . left
anchors.leftMargin: root . innerMargin
anchors.right: parent . right
anchors.rightMargin: root . innerMargin
font.weight: Font . Bold
2021-07-16 07:21:27 +00:00
wrapMode: Text . WrapAtWordBoundaryOrAnywhere
2020-12-11 20:38:10 +00:00
font.pixelSize: 17
2021-10-18 12:32:48 +00:00
color: Theme . palette . directColor1
2020-12-11 20:38:10 +00:00
}
2021-10-18 12:32:48 +00:00
StatusBaseText {
2020-12-11 20:38:10 +00:00
id: communityDesc
text: invitedCommunity . description
anchors.top: communityName . bottom
anchors.topMargin: 2
anchors.left: parent . left
anchors.leftMargin: root . innerMargin
anchors.right: parent . right
anchors.rightMargin: root . innerMargin
2021-07-16 07:21:27 +00:00
wrapMode: Text . WrapAtWordBoundaryOrAnywhere
2020-12-11 20:38:10 +00:00
font.pixelSize: 15
2021-10-18 12:32:48 +00:00
color: Theme . palette . directColor1
2020-12-11 20:38:10 +00:00
}
2021-10-18 12:32:48 +00:00
StatusBaseText {
2020-12-11 20:38:10 +00:00
id: communityNbMembers
// TODO add the plural support
2021-02-18 16:36:05 +00:00
//% "%1 members"
text: qsTrId ( "-1-members" ) . arg ( invitedCommunity . nbMembers )
2020-12-11 20:38:10 +00:00
anchors.top: communityDesc . bottom
anchors.topMargin: 2
anchors.left: parent . left
anchors.leftMargin: root . innerMargin
font.pixelSize: 13
font.weight: Font . Medium
2021-10-18 12:32:48 +00:00
color: Theme . palette . baseColor1
2020-12-11 20:38:10 +00:00
}
Separator {
id: sep2
anchors.top: communityNbMembers . bottom
anchors.topMargin: Style . current . halfPadding
}
2021-07-20 12:08:36 +00:00
Item {
2021-08-30 09:50:45 +00:00
id: btnItemId
2020-12-11 20:38:10 +00:00
width: parent . width
height: 44
2021-07-20 12:08:36 +00:00
anchors.bottom: parent . bottom
clip: true
2021-10-18 12:32:48 +00:00
StatusFlatButton {
2021-07-20 12:08:36 +00:00
id: joinBtn
anchors.top: parent . top
anchors.topMargin: - Style . current . smallPadding
2021-10-18 12:32:48 +00:00
radius: 16
2021-07-20 12:08:36 +00:00
width: parent . width
height: 54
enabled: true
//% "Unsupported state"
text: qsTrId ( "unsupported-state" )
onClicked: {
2021-12-13 14:24:21 +00:00
// Not Refactored Yet
// let onBtnClick = function(){
// let error
2021-06-02 12:28:15 +00:00
2021-12-13 14:24:21 +00:00
// if (rectangleBubble.state === "joined") {
// root.store.chatsModelInst.communities.setActiveCommunity(communityId);
// return
// } else if (rectangleBubble.state === "unjoined") {
// error = root.store.chatsModelInst.communities.joinCommunity(communityId, true)
// }
// else if (rectangleBubble.state === "requestToJoin") {
// error = root.store.chatsModelInst.communities.requestToJoinCommunity(communityId, userProfile.name)
// if (!error) {
// rectangleBubble.isPendingRequest = root.store.chatsModelInst.communities.isCommunityRequestPending(communityId)
// }
// }
2021-07-20 12:08:36 +00:00
2021-12-13 14:24:21 +00:00
// if (error) {
// joiningError.text = error
// return joiningError.open()
// }
// }
2021-07-12 17:49:06 +00:00
2021-12-13 14:24:21 +00:00
// if (localAccountSensitiveSettings.communitiesEnabled) {
// onBtnClick();
// } else {
// Global.openPopup(confirmationPopupComponent, { onConfirmed: onBtnClick });
// }
2021-04-29 19:54:09 +00:00
}
2021-07-20 12:08:36 +00:00
MessageDialog {
id: joiningError
//% "Error joining the community"
title: qsTrId ( "error-joining-the-community" )
icon: StandardIcon . Critical
standardButtons: StandardButton . Ok
2021-04-29 19:54:09 +00:00
}
}
2020-12-11 20:38:10 +00:00
}
}
}
}
}