2022-10-05 14:51:42 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Layouts 1.14
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
|
|
|
import shared 1.0
|
|
|
|
import shared.panels 1.0
|
|
|
|
import utils 1.0
|
|
|
|
import shared.views.chat 1.0
|
|
|
|
|
|
|
|
import "../controls"
|
|
|
|
import "../panels"
|
2023-02-23 11:09:05 +00:00
|
|
|
import "../stores"
|
2022-10-05 14:51:42 +00:00
|
|
|
|
2022-11-16 17:17:38 +00:00
|
|
|
ActivityNotificationMessage {
|
2022-10-05 14:51:42 +00:00
|
|
|
id: root
|
|
|
|
|
2023-04-19 16:48:57 +00:00
|
|
|
contactDetails: notification ? Utils.getContactDetailsAsJson(notification.author, false) : null
|
2022-10-05 14:51:42 +00:00
|
|
|
|
2022-11-16 17:17:38 +00:00
|
|
|
messageDetails.messageText: qsTr("Wants to join")
|
2022-11-30 11:15:29 +00:00
|
|
|
messageDetails.sender.profileImage.name: contactDetails ? contactDetails.displayIcon : ""
|
2022-11-16 17:17:38 +00:00
|
|
|
messageDetails.sender.profileImage.assetSettings.isImage: true
|
2022-11-30 11:15:29 +00:00
|
|
|
messageDetails.sender.profileImage.pubkey: notification ? notification.author : ""
|
|
|
|
messageDetails.sender.profileImage.colorId: Utils.colorIdForPubkey(notification ? notification.author : "")
|
2023-01-18 12:02:46 +00:00
|
|
|
messageDetails.sender.profileImage.colorHash: Utils.getColorHashAsJson(notification ? notification.author : "", contactDetails && contactDetails.ensVerified)
|
2022-10-05 14:51:42 +00:00
|
|
|
|
2022-11-16 17:17:38 +00:00
|
|
|
messageBadgeComponent: CommunityBadge {
|
2022-11-30 11:15:29 +00:00
|
|
|
readonly property var community: notification ?
|
|
|
|
root.store.getCommunityDetailsAsJson(notification.communityId) :
|
|
|
|
null
|
2022-10-05 14:51:42 +00:00
|
|
|
|
2022-11-30 11:15:29 +00:00
|
|
|
communityName: community ? community.name : ""
|
|
|
|
communityImage: community ? community.image : ""
|
|
|
|
communityColor: community ? community.color : "black"
|
2022-10-13 15:52:44 +00:00
|
|
|
|
2022-11-16 17:17:38 +00:00
|
|
|
onCommunityNameClicked: {
|
|
|
|
root.store.setActiveCommunity(notification.communityId)
|
|
|
|
root.closeActivityCenter()
|
2022-10-05 14:51:42 +00:00
|
|
|
}
|
2023-02-15 12:24:18 +00:00
|
|
|
Layout.maximumWidth: 190
|
2022-10-05 14:51:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ctaComponent: MembershipCta {
|
2023-08-07 13:35:14 +00:00
|
|
|
membershipStatus: notification && notification.membershipStatus ? notification.membershipStatus : ActivityNotification.MembershipStatus.None
|
2022-10-19 12:56:00 +00:00
|
|
|
onAcceptRequestToJoinCommunity: root.store.acceptRequestToJoinCommunity(notification.id, notification.communityId)
|
|
|
|
onDeclineRequestToJoinCommunity: root.store.declineRequestToJoinCommunity(notification.id, notification.communityId)
|
2023-08-07 09:21:46 +00:00
|
|
|
//TODO: Get backend value. If the membersip is in acceptedPending or declinedPending state, another user can't accept or decline the request
|
|
|
|
//Only the user who requested can cancel the request
|
|
|
|
ctaAllowed: true
|
2022-10-05 14:51:42 +00:00
|
|
|
}
|
2022-12-01 10:24:25 +00:00
|
|
|
}
|