feat(ActivityCenter): Review fixed for community membership AС notifications
This commit is contained in:
parent
5d8e3ac252
commit
851dd3bc76
|
@ -1,15 +1,16 @@
|
|||
import strformat, stint
|
||||
import ../../shared_models/message_item_qobject
|
||||
import ../../../../app_service/service/activity_center/dto/notification
|
||||
|
||||
type Item* = ref object
|
||||
id: string # ID is the id of the chat, for public chats it is the name e.g. status, for one-to-one is the hex encoded public key and for group chats is a random uuid appended with the hex encoded pk of the creator of the chat
|
||||
chatId: string
|
||||
communityId: string
|
||||
membershipStatus: int
|
||||
membershipStatus: ActivityCenterMembershipStatus
|
||||
sectionId: string
|
||||
name: string
|
||||
author: string
|
||||
notificationType: int
|
||||
notificationType: ActivityCenterNotificationType
|
||||
timestamp: int64
|
||||
read: bool
|
||||
dismissed: bool
|
||||
|
@ -21,11 +22,11 @@ proc initItem*(
|
|||
id: string,
|
||||
chatId: string,
|
||||
communityId: string,
|
||||
membershipStatus: int,
|
||||
membershipStatus: ActivityCenterMembershipStatus,
|
||||
sectionId: string,
|
||||
name: string,
|
||||
author: string,
|
||||
notificationType: int,
|
||||
notificationType: ActivityCenterNotificationType,
|
||||
timestamp: int64,
|
||||
read: bool,
|
||||
dismissed: bool,
|
||||
|
@ -55,10 +56,10 @@ proc `$`*(self: Item): string =
|
|||
name: {$self.name},
|
||||
chatId: {$self.chatId},
|
||||
communityId: {$self.communityId},
|
||||
membershipStatus: {$self.membershipStatus},
|
||||
membershipStatus: {$self.membershipStatus.int},
|
||||
sectionId: {$self.sectionId},
|
||||
author: {$self.author},
|
||||
notificationType: {$self.notificationType},
|
||||
notificationType: {$self.notificationType.int},
|
||||
timestamp: {$self.timestamp},
|
||||
read: {$self.read},
|
||||
dismissed: {$self.dismissed},
|
||||
|
@ -82,13 +83,13 @@ proc chatId*(self: Item): string =
|
|||
proc communityId*(self: Item): string =
|
||||
return self.communityId
|
||||
|
||||
proc membershipStatus*(self: Item): int =
|
||||
proc membershipStatus*(self: Item): ActivityCenterMembershipStatus =
|
||||
return self.membershipStatus
|
||||
|
||||
proc sectionId*(self: Item): string =
|
||||
return self.sectionId
|
||||
|
||||
proc notificationType*(self: Item): int =
|
||||
proc notificationType*(self: Item): ActivityCenterNotificationType =
|
||||
return self.notificationType
|
||||
|
||||
proc timestamp*(self: Item): int64 =
|
||||
|
|
|
@ -128,11 +128,11 @@ method convertToItems*(
|
|||
n.id,
|
||||
n.chatId,
|
||||
n.communityId,
|
||||
n.membershipStatus.int,
|
||||
n.membershipStatus,
|
||||
sectionId,
|
||||
n.name,
|
||||
n.author,
|
||||
n.notificationType.int,
|
||||
n.notificationType,
|
||||
n.timestamp,
|
||||
n.read,
|
||||
n.dismissed,
|
||||
|
|
|
@ -624,6 +624,7 @@ QtObject:
|
|||
proc requestToJoinCommunity*(self: Service, communityId: string, ensName: string) =
|
||||
try:
|
||||
let response = status_go.requestToJoinCommunity(communityId, ensName)
|
||||
self.activityCenterService.parseACNotificationResponse(response)
|
||||
|
||||
if not self.processRequestsToJoinCommunity(response.result):
|
||||
error "error: ", procName="requestToJoinCommunity", errDesription = "no 'requestsToJoinCommunity' key in response"
|
||||
|
@ -668,6 +669,7 @@ QtObject:
|
|||
proc leaveCommunity*(self: Service, communityId: string) =
|
||||
try:
|
||||
let response = status_go.leaveCommunity(communityId)
|
||||
self.activityCenterService.parseACNotificationResponse(response)
|
||||
|
||||
if response.error != nil:
|
||||
let error = Json.decode($response.error, RpcError)
|
||||
|
|
|
@ -8,11 +8,12 @@ Rectangle {
|
|||
id: statusRoundButton
|
||||
|
||||
property StatusAssetSettings icon: StatusAssetSettings {
|
||||
id: icon
|
||||
width: 23
|
||||
height: 23
|
||||
rotation: 0
|
||||
|
||||
property color hoverColor: {
|
||||
hoverColor: {
|
||||
switch(statusRoundButton.type) {
|
||||
case StatusRoundButton.Type.Primary:
|
||||
return Theme.palette.primaryColor1;
|
||||
|
@ -32,7 +33,7 @@ Rectangle {
|
|||
case StatusRoundButton.Type.Tertiary:
|
||||
return Theme.palette.baseColor1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
disabledColor: {
|
||||
switch(statusRoundButton.type) {
|
||||
|
|
|
@ -10,6 +10,7 @@ QtObject {
|
|||
property real width
|
||||
property real height
|
||||
property color color
|
||||
property color hoverColor
|
||||
property color disabledColor
|
||||
property int rotation
|
||||
property bool isLetterIdenticon
|
||||
|
|
|
@ -65,33 +65,23 @@ StatusModal {
|
|||
title: displayName
|
||||
|
||||
components: [
|
||||
StatusRoundIcon {
|
||||
asset.name: "thumbs-up"
|
||||
asset.color: Theme.palette.white
|
||||
asset.bgWidth: 28
|
||||
asset.bgHeight: 28
|
||||
asset.bgColor: Theme.palette.successColor1
|
||||
MouseArea {
|
||||
id: thumbsUpSensor
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: communitySectionModule.acceptRequestToJoinCommunity(id, popup.communityData.id)
|
||||
}
|
||||
StatusRoundButton {
|
||||
icon.name: "thumbs-up"
|
||||
icon.color: Style.current.white
|
||||
icon.hoverColor: Style.current.white
|
||||
implicitWidth: 28
|
||||
implicitHeight: 28
|
||||
color: Theme.palette.successColor1
|
||||
onClicked: popup.store.acceptRequestToJoinCommunity(id, popup.communityData.id)
|
||||
},
|
||||
StatusRoundIcon {
|
||||
asset.name: "thumbs-down"
|
||||
asset.color: Theme.palette.white
|
||||
asset.bgWidth: 28
|
||||
asset.bgHeight: 28
|
||||
asset.bgColor: Theme.palette.dangerColor1
|
||||
MouseArea {
|
||||
id: thumbsDownSensor
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: communitySectionModule.declineRequestToJoinCommunity(id, popup.communityData.id)
|
||||
}
|
||||
StatusRoundButton {
|
||||
icon.name: "thumbs-down"
|
||||
icon.color: Style.current.white
|
||||
icon.hoverColor: Style.current.white
|
||||
implicitWidth: 28
|
||||
implicitHeight: 28
|
||||
color: Theme.palette.dangerColor1
|
||||
onClicked: popup.store.declineRequestToJoinCommunity(id, popup.communityData.id)
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -9,11 +9,10 @@ Rectangle {
|
|||
id: root
|
||||
|
||||
z: 100 // NOTE: workaround for message overlay
|
||||
implicitWidth: childrenRect.width + Style.current.smallPadding
|
||||
implicitWidth: childrenRect.width + Style.current.smallPadding * 2
|
||||
implicitHeight: visible ? 24 : 0
|
||||
radius: height / 2
|
||||
border.width: 1
|
||||
border.color: Style.current.borderSecondary
|
||||
color: Style.current.transparent
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ Item {
|
|||
id: listView
|
||||
// NOTE: some entries are hidden until implimentation
|
||||
model: [ { text: qsTr("All"), category: ActivityCenterPopup.ActivityCategory.All, visible: true, enabled: true },
|
||||
{ text: qsTr("Admin"), category: ActivityCenterPopup.ActivityCategory.Admin, visible: true, enabled: root.hasAdmin },
|
||||
{ text: qsTr("Admin"), category: ActivityCenterPopup.ActivityCategory.Admin, visible: root.hasAdmin, enabled: root.hasAdmin },
|
||||
{ text: qsTr("Mentions"), category: ActivityCenterPopup.ActivityCategory.Mentions, visible: true, enabled: root.hasMentions },
|
||||
{ text: qsTr("Replies"), category: ActivityCenterPopup.ActivityCategory.Replies, visible: true, enabled: root.hasReplies },
|
||||
{ text: qsTr("Contact requests"), category: ActivityCenterPopup.ActivityCategory.ContactRequests, visible: true, enabled: root.hasContactRequests },
|
||||
|
|
|
@ -19,8 +19,8 @@ Item {
|
|||
signal blockClicked()
|
||||
signal profileClicked()
|
||||
|
||||
width: Math.max(textItem.width, buttons.width)
|
||||
height: Math.max(textItem.height, buttons.height)
|
||||
implicitWidth: Math.max(textItem.width, buttons.width)
|
||||
implicitHeight: Math.max(textItem.height, buttons.height)
|
||||
|
||||
StatusBaseText {
|
||||
id: textItem
|
||||
|
|
|
@ -2,6 +2,7 @@ import QtQuick 2.14
|
|||
|
||||
import StatusQ.Core 0.1
|
||||
import StatusQ.Core.Theme 0.1
|
||||
import StatusQ.Controls 0.1
|
||||
import StatusQ.Components 0.1
|
||||
|
||||
import utils 1.0
|
||||
|
@ -17,8 +18,8 @@ Item {
|
|||
signal acceptRequestToJoinCommunity()
|
||||
signal declineRequestToJoinCommunity()
|
||||
|
||||
width: Math.max(textItem.width, buttons.width)
|
||||
height: Math.max(textItem.height, buttons.height)
|
||||
implicitWidth: Math.max(textItem.width, buttons.width)
|
||||
implicitHeight: Math.max(textItem.height, buttons.height)
|
||||
|
||||
StatusBaseText {
|
||||
id: textItem
|
||||
|
@ -28,7 +29,8 @@ Item {
|
|||
text: {
|
||||
if (root.accepted) {
|
||||
return qsTr("Accepted")
|
||||
} else if (root.declined) {
|
||||
}
|
||||
if (root.declined) {
|
||||
return qsTr("Declined")
|
||||
}
|
||||
return ""
|
||||
|
@ -36,7 +38,8 @@ Item {
|
|||
color: {
|
||||
if (root.accepted) {
|
||||
return Theme.palette.successColor1
|
||||
} else if (root.declined) {
|
||||
}
|
||||
if (root.declined) {
|
||||
return Theme.palette.dangerColor1
|
||||
}
|
||||
return Theme.palette.directColor1
|
||||
|
@ -49,34 +52,24 @@ Item {
|
|||
visible: pending
|
||||
spacing: Style.current.padding
|
||||
|
||||
StatusRoundIcon {
|
||||
asset.name: "thumbs-up"
|
||||
asset.color: Theme.palette.white
|
||||
asset.bgWidth: 28
|
||||
asset.bgHeight: 28
|
||||
asset.bgColor: Theme.palette.successColor1
|
||||
MouseArea {
|
||||
id: thumbsUpSensor
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.acceptRequestToJoinCommunity()
|
||||
}
|
||||
StatusRoundButton {
|
||||
icon.name: "thumbs-up"
|
||||
icon.color: Style.current.white
|
||||
icon.hoverColor: Style.current.white
|
||||
implicitWidth: 28
|
||||
implicitHeight: 28
|
||||
color: Theme.palette.successColor1
|
||||
onClicked: root.acceptRequestToJoinCommunity()
|
||||
}
|
||||
|
||||
StatusRoundIcon {
|
||||
asset.name: "thumbs-down"
|
||||
asset.color: Theme.palette.white
|
||||
asset.bgWidth: 28
|
||||
asset.bgHeight: 28
|
||||
asset.bgColor: Theme.palette.dangerColor1
|
||||
MouseArea {
|
||||
id: thumbsDownSensor
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.declineRequestToJoinCommunity()
|
||||
}
|
||||
StatusRoundButton {
|
||||
icon.name: "thumbs-down"
|
||||
icon.color: Style.current.white
|
||||
icon.hoverColor: Style.current.white
|
||||
implicitWidth: 28
|
||||
implicitHeight: 28
|
||||
color: Theme.palette.dangerColor1
|
||||
onClicked: root.declineRequestToJoinCommunity()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,9 +19,9 @@ Item {
|
|||
property alias ctaComponent: ctaLoader.sourceComponent
|
||||
property alias previousNotificationIndex: dateGroupLabel.previousMessageIndex
|
||||
|
||||
height: Math.max(60, bodyLoader.height +
|
||||
(dateGroupLabel.visible ? dateGroupLabel.height : 0) +
|
||||
(badgeLoader.item ? badgeLoader.height : 0))
|
||||
implicitHeight: Math.max(60, bodyLoader.height +
|
||||
(dateGroupLabel.visible ? dateGroupLabel.height : 0) +
|
||||
(badgeLoader.item ? badgeLoader.height : 0))
|
||||
|
||||
StatusDateGroupLabel {
|
||||
id: dateGroupLabel
|
||||
|
|
|
@ -17,7 +17,7 @@ ActivityNotificationMessage {
|
|||
badgeComponent: CommunityBadge {
|
||||
id: communityBadge
|
||||
|
||||
property var community: root.store.getCommunityDetailsAsJson(notification.message.communityId)
|
||||
readonly property var community: root.store.getCommunityDetailsAsJson(notification.message.communityId)
|
||||
|
||||
communityName: community.name
|
||||
communityImage: community.image
|
||||
|
|
|
@ -21,7 +21,7 @@ ActivityNotificationBase {
|
|||
signal activityCenterClose()
|
||||
|
||||
bodyComponent: MessageView {
|
||||
readonly property var contactDetails: Utils.getContactDetailsAsJson(senderId)
|
||||
readonly property var contactDetails: Utils.getContactDetailsAsJson(notification.author)
|
||||
|
||||
rootStore: root.store
|
||||
messageStore: root.store.messageStore
|
||||
|
@ -30,11 +30,11 @@ ActivityNotificationBase {
|
|||
messageTimestamp: notification.timestamp
|
||||
senderId: notification.author
|
||||
senderIcon: contactDetails.displayIcon
|
||||
senderDisplayName: contactDetails.name
|
||||
senderDisplayName: contactDetails.displayName
|
||||
senderOptionalName: contactDetails.localNickname
|
||||
messageContextMenu: root.messageContextMenu
|
||||
activityCenterMessage: true
|
||||
activityCenterMessageRead: false
|
||||
scrollToBottom: null
|
||||
onImageClicked: Global.openImagePopup(image, root.messageContextMenu)
|
||||
messageClickHandler: (sender,
|
||||
point,
|
||||
|
|
Loading…
Reference in New Issue