feat(ActivityCenter): Fix handling membership requests from AC

This commit is contained in:
MishkaRogachev 2022-10-19 16:56:00 +04:00 committed by Mikhail Rogachev
parent 9b93a9d3f9
commit 5d8e3ac252
13 changed files with 33 additions and 33 deletions

View File

@ -373,11 +373,11 @@ proc joinGroupChatFromInvitation*(self: Controller, groupName: string, chatId: s
self.contactService, self.chatService, self.communityService, self.messageService,
self.gifService, self.mailserversService)
proc acceptRequestToJoinCommunity*(self: Controller, requestId: string) =
self.communityService.acceptRequestToJoinCommunity(self.sectionId, requestId)
proc acceptRequestToJoinCommunity*(self: Controller, requestId: string, communityId: string) =
self.communityService.acceptRequestToJoinCommunity(communityId, requestId)
proc declineRequestToJoinCommunity*(self: Controller, requestId: string) =
self.communityService.declineRequestToJoinCommunity(self.sectionId, requestId)
proc declineRequestToJoinCommunity*(self: Controller, requestId: string, communityId: string) =
self.communityService.declineRequestToJoinCommunity(communityId, requestId)
proc createCommunityChannel*(
self: Controller,

View File

@ -247,10 +247,10 @@ method initListOfMyContacts*(self: AccessInterface, pubKeys: string) {.base.} =
method clearListOfMyContacts*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method acceptRequestToJoinCommunity*(self: AccessInterface, requestId: string) {.base.} =
method acceptRequestToJoinCommunity*(self: AccessInterface, requestId: string, communityId: string) {.base.} =
raise newException(ValueError, "No implementation available")
method declineRequestToJoinCommunity*(self: AccessInterface, requestId: string) {.base.} =
method declineRequestToJoinCommunity*(self: AccessInterface, requestId: string, communityId: string) {.base.} =
raise newException(ValueError, "No implementation available")
method createCommunityChannel*(self: AccessInterface, name: string, description: string,

View File

@ -770,11 +770,11 @@ method onChatRenamed*(self: Module, chatId: string, newName: string) =
method onGroupChatDetailsUpdated*(self: Module, chatId, newName, newColor, newImage: string) =
self.view.chatsModel().updateNameColorIcon(chatId, newName, newColor, newImage)
method acceptRequestToJoinCommunity*(self: Module, requestId: string) =
self.controller.acceptRequestToJoinCommunity(requestId)
method acceptRequestToJoinCommunity*(self: Module, requestId: string, communityId: string) =
self.controller.acceptRequestToJoinCommunity(requestId, communityId)
method declineRequestToJoinCommunity*(self: Module, requestId: string) =
self.controller.declineRequestToJoinCommunity(requestId)
method declineRequestToJoinCommunity*(self: Module, requestId: string, communityId: string) =
self.controller.declineRequestToJoinCommunity(requestId, communityId)
method createCommunityChannel*(self: Module, name, description, emoji, color, categoryId: string) =
self.controller.createCommunityChannel(name, description, emoji, color, categoryId)

View File

@ -217,11 +217,11 @@ QtObject:
proc joinGroupChatFromInvitation*(self: View, groupName: string, chatId: string, adminPK: string) {.slot.} =
self.delegate.joinGroupChatFromInvitation(groupName, chatId, adminPK)
proc acceptRequestToJoinCommunity*(self: View, requestId: string) {.slot.} =
self.delegate.acceptRequestToJoinCommunity(requestId)
proc acceptRequestToJoinCommunity*(self: View, requestId: string, communityId: string) {.slot.} =
self.delegate.acceptRequestToJoinCommunity(requestId, communityId)
proc declineRequestToJoinCommunity*(self: View, requestId: string) {.slot.} =
self.delegate.declineRequestToJoinCommunity(requestId)
proc declineRequestToJoinCommunity*(self: View, requestId: string, communityId: string) {.slot.} =
self.delegate.declineRequestToJoinCommunity(requestId, communityId)
proc createCommunityChannel*(
self: View,

View File

@ -76,7 +76,7 @@ StatusModal {
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: communitySectionModule.acceptRequestToJoinCommunity(id)
onClicked: communitySectionModule.acceptRequestToJoinCommunity(id, popup.communityData.id)
}
},
StatusRoundIcon {
@ -90,7 +90,7 @@ StatusModal {
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: communitySectionModule.declineRequestToJoinCommunity(id)
onClicked: communitySectionModule.declineRequestToJoinCommunity(id, popup.communityData.id)
}
}
]

View File

@ -312,12 +312,12 @@ QtObject {
)
}
function acceptRequestToJoinCommunity(requestId) {
chatCommunitySectionModule.acceptRequestToJoinCommunity(requestId)
function acceptRequestToJoinCommunity(requestId, communityId) {
chatCommunitySectionModule.acceptRequestToJoinCommunity(requestId, communityId)
}
function declineRequestToJoinCommunity(requestId) {
chatCommunitySectionModule.declineRequestToJoinCommunity(requestId)
function declineRequestToJoinCommunity(requestId, communityId) {
chatCommunitySectionModule.declineRequestToJoinCommunity(requestId, communityId)
}
function userNameOrAlias(pk) {

View File

@ -234,8 +234,8 @@ StatusSectionLayout {
onKickUserClicked: root.rootStore.removeUserFromCommunity(id)
onBanUserClicked: root.rootStore.banUserFromCommunity(id)
onUnbanUserClicked: root.rootStore.unbanUserFromCommunity(id)
onAcceptRequestToJoin: root.rootStore.acceptRequestToJoinCommunity(id)
onDeclineRequestToJoin: root.rootStore.declineRequestToJoinCommunity(id)
onAcceptRequestToJoin: root.rootStore.acceptRequestToJoinCommunity(id, root.communityId)
onDeclineRequestToJoin: root.rootStore.declineRequestToJoinCommunity(id, root.communityId)
}
CommunityPermissionsSettingsPanel {

View File

@ -24,7 +24,8 @@ Item {
StatusBaseText {
id: textItem
anchors.centerIn: parent
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
visible: !pending
text: {
if (root.accepted) {

View File

@ -22,7 +22,8 @@ Item {
StatusBaseText {
id: textItem
anchors.centerIn: parent
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
visible: !pending
text: {
if (root.accepted) {

View File

@ -19,7 +19,7 @@ Item {
property alias ctaComponent: ctaLoader.sourceComponent
property alias previousNotificationIndex: dateGroupLabel.previousMessageIndex
height: Math.max(50, bodyLoader.height +
height: Math.max(60, bodyLoader.height +
(dateGroupLabel.visible ? dateGroupLabel.height : 0) +
(badgeLoader.item ? badgeLoader.height : 0))

View File

@ -16,6 +16,7 @@ ActivityNotificationBase {
id: root
bodyComponent: RowLayout {
height: 50
readonly property var community: root.store.getCommunityDetailsAsJson(notification.communityId)
StatusSmartIdenticon {
@ -27,6 +28,7 @@ ActivityNotificationBase {
asset.letterSize: width / 2.4
asset.name: community.image
asset.isImage: true
Layout.alignment: Qt.AlignVCenter
Layout.leftMargin: Style.current.padding
}

View File

@ -74,13 +74,7 @@ ActivityNotificationBase {
pending: notification.membershipStatus === Constants.activityCenterMembershipStatusPending
accepted: notification.membershipStatus === Constants.activityCenterMembershipStatusAccepted
declined: notification.membershipStatus === Constants.activityCenterMembershipStatusDeclined
onAcceptRequestToJoinCommunity: {
root.store.setActiveCommunity(message.communityId)
root.store.acceptRequestToJoinCommunity(notification.id)
}
onDeclineRequestToJoinCommunity: {
root.store.setActiveCommunity(message.communityId)
root.store.declineRequestToJoinCommunity(notification.id)
}
onAcceptRequestToJoinCommunity: root.store.acceptRequestToJoinCommunity(notification.id, notification.communityId)
onDeclineRequestToJoinCommunity: root.store.declineRequestToJoinCommunity(notification.id, notification.communityId)
}
}

View File

@ -16,6 +16,7 @@ ActivityNotificationBase {
id: root
bodyComponent: RowLayout {
height: 50
readonly property var community: root.store.getCommunityDetailsAsJson(notification.communityId)
StatusSmartIdenticon {
@ -27,6 +28,7 @@ ActivityNotificationBase {
asset.letterSize: width / 2.4
asset.name: community.image
asset.isImage: true
Layout.alignment: Qt.AlignVCenter
Layout.leftMargin: Style.current.padding
}