feat(ActivityCenter): Remove UI-side AC notifications filtering & sorting
Close #8510
This commit is contained in:
parent
7d9a6f5a71
commit
a0647d241e
|
@ -8,7 +8,7 @@ include ../../../common/json_utils
|
|||
include ../../../common/utils
|
||||
|
||||
type ActivityCenterNotificationType* {.pure.}= enum
|
||||
Unknown = 0,
|
||||
NoType = 0,
|
||||
NewOneToOne = 1,
|
||||
NewPrivateGroupChat = 2,
|
||||
Mention = 3,
|
||||
|
@ -81,7 +81,7 @@ proc toActivityCenterNotificationDto*(jsonObj: JsonNode): ActivityCenterNotifica
|
|||
|
||||
discard jsonObj.getProp("author", result.author)
|
||||
|
||||
result.notificationType = ActivityCenterNotificationType.Unknown
|
||||
result.notificationType = ActivityCenterNotificationType.NoType
|
||||
var notificationTypeInt: int
|
||||
if (jsonObj.getProp("type", notificationTypeInt) and
|
||||
(notificationTypeInt >= ord(low(ActivityCenterNotificationType)) or
|
||||
|
|
|
@ -6,8 +6,6 @@ import Qt.labs.qmlmodels 1.0
|
|||
import StatusQ.Core 0.1
|
||||
import StatusQ.Controls 0.1
|
||||
|
||||
import SortFilterProxyModel 0.2
|
||||
|
||||
import shared 1.0
|
||||
import shared.popups 1.0
|
||||
import shared.views.chat 1.0
|
||||
|
@ -46,30 +44,6 @@ Popup {
|
|||
|
||||
readonly property int unreadNotificationsCount: root.activityCenterStore.unreadNotificationsCount
|
||||
|
||||
function filterActivityCategories(notificationType) {
|
||||
switch (root.currentActivityCategory) {
|
||||
case ActivityCenterPopup.ActivityCategory.All:
|
||||
return true
|
||||
case ActivityCenterPopup.ActivityCategory.Admin:
|
||||
return notificationType === Constants.activityCenterNotificationTypeCommunityMembershipRequest
|
||||
case ActivityCenterPopup.ActivityCategory.Mentions:
|
||||
return notificationType === Constants.activityCenterNotificationTypeMention
|
||||
case ActivityCenterPopup.ActivityCategory.Replies:
|
||||
return notificationType === Constants.activityCenterNotificationTypeReply
|
||||
case ActivityCenterPopup.ActivityCategory.ContactRequests:
|
||||
return notificationType === Constants.activityCenterNotificationTypeContactRequest
|
||||
case ActivityCenterPopup.ActivityCategory.IdentityVerification:
|
||||
return notificationType === Constants.activityCenterNotificationTypeContactVerification
|
||||
case ActivityCenterPopup.ActivityCategory.Membership:
|
||||
return notificationType === Constants.activityCenterNotificationTypeCommunityInvitation ||
|
||||
notificationType === Constants.activityCenterNotificationTypeCommunityMembershipRequest ||
|
||||
notificationType === Constants.activityCenterNotificationTypeCommunityRequest ||
|
||||
notificationType === Constants.activityCenterNotificationTypeCommunityKicked
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function calcNotificationType(notificationType, cnt) {
|
||||
switch (notificationType) {
|
||||
case Constants.activityCenterNotificationTypeMention:
|
||||
|
@ -136,7 +110,7 @@ Popup {
|
|||
|
||||
Repeater {
|
||||
id: notificationTypeCounter
|
||||
model: root.activityCenterStore.activityCenterList
|
||||
model: root.activityCenterStore.activityCenterNotifications
|
||||
|
||||
delegate: Item {
|
||||
Component.onCompleted: calcNotificationType(model.notificationType, 1)
|
||||
|
@ -170,19 +144,7 @@ Popup {
|
|||
anchors.margins: Style.current.smallPadding
|
||||
spacing: 1
|
||||
|
||||
model: SortFilterProxyModel {
|
||||
sourceModel: root.activityCenterStore.activityCenterList
|
||||
|
||||
filters: ExpressionFilter { expression: filterActivityCategories(model.notificationType) &&
|
||||
!(activityCenterStore.hideReadNotifications && model.read) }
|
||||
|
||||
sorters: [
|
||||
RoleSorter {
|
||||
roleName: "timestamp"
|
||||
sortOrder: Qt.DescendingOrder
|
||||
}
|
||||
]
|
||||
}
|
||||
model: root.activityCenterStore.activityCenterNotifications
|
||||
|
||||
delegate: Loader {
|
||||
width: listView.availableWidth
|
||||
|
|
|
@ -6,7 +6,7 @@ QtObject {
|
|||
property bool hideReadNotifications: false
|
||||
|
||||
readonly property var activityCenterModuleInst: activityCenterModule
|
||||
readonly property var activityCenterList: activityCenterModuleInst.activityNotificationsModel
|
||||
readonly property var activityCenterNotifications: activityCenterModuleInst.activityNotificationsModel
|
||||
readonly property int unreadNotificationsCount: activityCenterModuleInst.unreadActivityCenterNotificationsCount
|
||||
readonly property bool hasUnseenNotifications: activityCenterModuleInst.hasUnseenActivityCenterNotifications
|
||||
|
||||
|
|
|
@ -613,6 +613,7 @@ QtObject {
|
|||
readonly property int communityChatInvitationOnlyAccess: 2
|
||||
readonly property int communityChatOnRequestAccess: 3
|
||||
|
||||
readonly property int activityCenterNotificationTypeNoType: 0
|
||||
readonly property int activityCenterNotificationTypeOneToOne: 1
|
||||
readonly property int activityCenterNotificationTypeGroupRequest: 2
|
||||
readonly property int activityCenterNotificationTypeMention: 3
|
||||
|
|
Loading…
Reference in New Issue