fix: display "View" on already joined community invites

Fixes #2580
This commit is contained in:
Richard Ramos 2021-06-02 08:28:15 -04:00 committed by Iuri Matias
parent 0b0a542828
commit f3caf589a5
1 changed files with 9 additions and 5 deletions

View File

@ -144,10 +144,8 @@ Item {
if (joinBtn.access === Constants.communityChatInvitationOnlyAccess || isPendingRequest) { if (joinBtn.access === Constants.communityChatInvitationOnlyAccess || isPendingRequest) {
return false return false
} }
if (invitedCommunity.canJoin) {
return true return true
}
return !invitedCommunity.joined
} }
text: { text: {
if (invitedCommunity.ensOnly && !profileModel.profile.ensVerified) { if (invitedCommunity.ensOnly && !profileModel.profile.ensVerified) {
@ -157,7 +155,7 @@ Item {
return qsTr("Join") return qsTr("Join")
} }
if (invitedCommunity.joined || invitedCommunity.isMember) { if (invitedCommunity.joined || invitedCommunity.isMember) {
return qsTr("Joined") return qsTr("View")
} }
if (isPendingRequest) { if (isPendingRequest) {
return qsTr("Pending") return qsTr("Pending")
@ -173,6 +171,12 @@ Item {
onClicked: { onClicked: {
let error let error
if (invitedCommunity.joined || invitedCommunity.isMember) {
chatsModel.communities.setActiveCommunity(communityId);
return
}
if (joinBtn.access === Constants.communityChatOnRequestAccess) { if (joinBtn.access === Constants.communityChatOnRequestAccess) {
error = chatsModel.communities.requestToJoinCommunity(communityId, error = chatsModel.communities.requestToJoinCommunity(communityId,
profileModel.profile.ensVerified ? profileModel.profile.username : "") profileModel.profile.ensVerified ? profileModel.profile.username : "")