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