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.contactService, self.chatService, self.communityService, self.messageService,
self.gifService, self.mailserversService) self.gifService, self.mailserversService)
proc acceptRequestToJoinCommunity*(self: Controller, requestId: string) = proc acceptRequestToJoinCommunity*(self: Controller, requestId: string, communityId: string) =
self.communityService.acceptRequestToJoinCommunity(self.sectionId, requestId) self.communityService.acceptRequestToJoinCommunity(communityId, requestId)
proc declineRequestToJoinCommunity*(self: Controller, requestId: string) = proc declineRequestToJoinCommunity*(self: Controller, requestId: string, communityId: string) =
self.communityService.declineRequestToJoinCommunity(self.sectionId, requestId) self.communityService.declineRequestToJoinCommunity(communityId, requestId)
proc createCommunityChannel*( proc createCommunityChannel*(
self: Controller, self: Controller,

View File

@ -247,10 +247,10 @@ method initListOfMyContacts*(self: AccessInterface, pubKeys: string) {.base.} =
method clearListOfMyContacts*(self: AccessInterface) {.base.} = method clearListOfMyContacts*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available") 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") 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") raise newException(ValueError, "No implementation available")
method createCommunityChannel*(self: AccessInterface, name: string, description: string, 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) = method onGroupChatDetailsUpdated*(self: Module, chatId, newName, newColor, newImage: string) =
self.view.chatsModel().updateNameColorIcon(chatId, newName, newColor, newImage) self.view.chatsModel().updateNameColorIcon(chatId, newName, newColor, newImage)
method acceptRequestToJoinCommunity*(self: Module, requestId: string) = method acceptRequestToJoinCommunity*(self: Module, requestId: string, communityId: string) =
self.controller.acceptRequestToJoinCommunity(requestId) self.controller.acceptRequestToJoinCommunity(requestId, communityId)
method declineRequestToJoinCommunity*(self: Module, requestId: string) = method declineRequestToJoinCommunity*(self: Module, requestId: string, communityId: string) =
self.controller.declineRequestToJoinCommunity(requestId) self.controller.declineRequestToJoinCommunity(requestId, communityId)
method createCommunityChannel*(self: Module, name, description, emoji, color, categoryId: string) = method createCommunityChannel*(self: Module, name, description, emoji, color, categoryId: string) =
self.controller.createCommunityChannel(name, description, emoji, color, categoryId) 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.} = proc joinGroupChatFromInvitation*(self: View, groupName: string, chatId: string, adminPK: string) {.slot.} =
self.delegate.joinGroupChatFromInvitation(groupName, chatId, adminPK) self.delegate.joinGroupChatFromInvitation(groupName, chatId, adminPK)
proc acceptRequestToJoinCommunity*(self: View, requestId: string) {.slot.} = proc acceptRequestToJoinCommunity*(self: View, requestId: string, communityId: string) {.slot.} =
self.delegate.acceptRequestToJoinCommunity(requestId) self.delegate.acceptRequestToJoinCommunity(requestId, communityId)
proc declineRequestToJoinCommunity*(self: View, requestId: string) {.slot.} = proc declineRequestToJoinCommunity*(self: View, requestId: string, communityId: string) {.slot.} =
self.delegate.declineRequestToJoinCommunity(requestId) self.delegate.declineRequestToJoinCommunity(requestId, communityId)
proc createCommunityChannel*( proc createCommunityChannel*(
self: View, self: View,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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