parent
5001f36e86
commit
2e98724641
|
@ -425,6 +425,16 @@ QtObject:
|
||||||
for community in self.joinedCommunityList.communities:
|
for community in self.joinedCommunityList.communities:
|
||||||
for chat in community.chats:
|
for chat in community.chats:
|
||||||
if (chat.id == channelId):
|
if (chat.id == channelId):
|
||||||
|
if community.muted:
|
||||||
|
chat.muted = true
|
||||||
return chat
|
return chat
|
||||||
|
|
||||||
|
proc setCommunityMuted*(self: CommunitiesView, communityId: string, muted: bool) {.slot.} =
|
||||||
|
self.status.chat.setCommunityMuted(communityId, muted)
|
||||||
|
if (communityId == self.activeCommunity.communityItem.id):
|
||||||
|
self.activeCommunity.setMuted(muted)
|
||||||
|
|
||||||
|
var community = self.joinedCommunityList.getCommunityById(communityId)
|
||||||
|
community.muted = muted
|
||||||
|
self.joinedCommunityList.replaceCommunity(community)
|
||||||
|
|
|
@ -55,7 +55,6 @@ QtObject:
|
||||||
self.status.events.emit("communityActiveChanged", CommunityActiveChangedArgs(active: value))
|
self.status.events.emit("communityActiveChanged", CommunityActiveChangedArgs(active: value))
|
||||||
self.activeChanged()
|
self.activeChanged()
|
||||||
|
|
||||||
|
|
||||||
proc removeMember*(self: CommunityItemView, pubKey: string) =
|
proc removeMember*(self: CommunityItemView, pubKey: string) =
|
||||||
self.members.removeMember(pubKey)
|
self.members.removeMember(pubKey)
|
||||||
self.nbMembersChanged()
|
self.nbMembersChanged()
|
||||||
|
@ -102,6 +101,18 @@ QtObject:
|
||||||
QtProperty[bool] verified:
|
QtProperty[bool] verified:
|
||||||
read = verified
|
read = verified
|
||||||
|
|
||||||
|
proc mutedChanged*(self: CommunityItemView) {.signal.}
|
||||||
|
|
||||||
|
proc setMuted*(self: CommunityItemView, muted: bool) {.slot.} =
|
||||||
|
self.communityItem.muted = muted
|
||||||
|
self.mutedChanged()
|
||||||
|
|
||||||
|
proc muted*(self: CommunityItemView): bool {.slot.} = result = ?.self.communityItem.muted
|
||||||
|
|
||||||
|
QtProperty[bool] muted:
|
||||||
|
read = muted
|
||||||
|
notify = mutedChanged
|
||||||
|
|
||||||
proc ensOnly*(self: CommunityItemView): bool {.slot.} = result = ?.self.communityItem.ensOnly
|
proc ensOnly*(self: CommunityItemView): bool {.slot.} = result = ?.self.communityItem.ensOnly
|
||||||
|
|
||||||
QtProperty[bool] ensOnly:
|
QtProperty[bool] ensOnly:
|
||||||
|
@ -216,4 +227,4 @@ QtObject:
|
||||||
result = self.communityItem.communityImage.large
|
result = self.communityItem.communityImage.large
|
||||||
|
|
||||||
QtProperty[string] largeImage:
|
QtProperty[string] largeImage:
|
||||||
read = largeImage
|
read = largeImage
|
||||||
|
|
|
@ -26,6 +26,7 @@ type
|
||||||
IsMember = UserRole + 15
|
IsMember = UserRole + 15
|
||||||
UnviewedMessagesCount = UserRole + 16
|
UnviewedMessagesCount = UserRole + 16
|
||||||
CommunityColor = UserRole + 17
|
CommunityColor = UserRole + 17
|
||||||
|
Muted = UserRole + 18
|
||||||
|
|
||||||
QtObject:
|
QtObject:
|
||||||
type
|
type
|
||||||
|
@ -106,6 +107,7 @@ QtObject:
|
||||||
of CommunityRoles.CanRequestAccess: result = newQVariant(communityItem.canRequestAccess.bool)
|
of CommunityRoles.CanRequestAccess: result = newQVariant(communityItem.canRequestAccess.bool)
|
||||||
of CommunityRoles.CanManageUsers: result = newQVariant(communityItem.canManageUsers.bool)
|
of CommunityRoles.CanManageUsers: result = newQVariant(communityItem.canManageUsers.bool)
|
||||||
of CommunityRoles.CanJoin: result = newQVariant(communityItem.canJoin.bool)
|
of CommunityRoles.CanJoin: result = newQVariant(communityItem.canJoin.bool)
|
||||||
|
of CommunityRoles.Muted: result = newQVariant(communityItem.muted.bool)
|
||||||
of CommunityRoles.IsMember: result = newQVariant(communityItem.isMember.bool)
|
of CommunityRoles.IsMember: result = newQVariant(communityItem.isMember.bool)
|
||||||
of CommunityRoles.NumMembers: result = newQVariant(communityItem.members.len)
|
of CommunityRoles.NumMembers: result = newQVariant(communityItem.members.len)
|
||||||
of CommunityRoles.UnviewedMessagesCount: result = newQVariant(communityItem.unviewedMessagesCount)
|
of CommunityRoles.UnviewedMessagesCount: result = newQVariant(communityItem.unviewedMessagesCount)
|
||||||
|
@ -140,6 +142,7 @@ QtObject:
|
||||||
CommunityRoles.CanManageUsers.int: "canManageUsers",
|
CommunityRoles.CanManageUsers.int: "canManageUsers",
|
||||||
CommunityRoles.CanJoin.int: "canJoin",
|
CommunityRoles.CanJoin.int: "canJoin",
|
||||||
CommunityRoles.IsMember.int: "isMember",
|
CommunityRoles.IsMember.int: "isMember",
|
||||||
|
CommunityRoles.Muted.int: "muted",
|
||||||
CommunityRoles.NumMembers.int: "nbMembers",
|
CommunityRoles.NumMembers.int: "nbMembers",
|
||||||
CommunityRoles.UnviewedMessagesCount.int: "unviewedMessagesCount",
|
CommunityRoles.UnviewedMessagesCount.int: "unviewedMessagesCount",
|
||||||
CommunityRoles.ThumbnailImage.int:"thumbnailImage",
|
CommunityRoles.ThumbnailImage.int:"thumbnailImage",
|
||||||
|
|
|
@ -520,6 +520,9 @@ proc declineRequestToJoinCommunity*(self: ChatModel, requestId: string) =
|
||||||
proc pendingRequestsToJoinForCommunity*(self: ChatModel, communityKey: string): seq[CommunityMembershipRequest] =
|
proc pendingRequestsToJoinForCommunity*(self: ChatModel, communityKey: string): seq[CommunityMembershipRequest] =
|
||||||
result = status_chat.pendingRequestsToJoinForCommunity(communityKey)
|
result = status_chat.pendingRequestsToJoinForCommunity(communityKey)
|
||||||
|
|
||||||
|
proc setCommunityMuted*(self: ChatModel, communityId: string, muted: bool) =
|
||||||
|
status_chat.setCommunityMuted(communityId, muted)
|
||||||
|
|
||||||
proc myPendingRequestsToJoin*(self: ChatModel): seq[CommunityMembershipRequest] =
|
proc myPendingRequestsToJoin*(self: ChatModel): seq[CommunityMembershipRequest] =
|
||||||
result = status_chat.myPendingRequestsToJoin()
|
result = status_chat.myPendingRequestsToJoin()
|
||||||
|
|
||||||
|
|
|
@ -125,6 +125,7 @@ type Community* = object
|
||||||
canManageUsers*: bool
|
canManageUsers*: bool
|
||||||
canJoin*: bool
|
canJoin*: bool
|
||||||
isMember*: bool
|
isMember*: bool
|
||||||
|
muted*: bool
|
||||||
communityImage*: IdentityImage
|
communityImage*: IdentityImage
|
||||||
membershipRequests*: seq[CommunityMembershipRequest]
|
membershipRequests*: seq[CommunityMembershipRequest]
|
||||||
communityColor*: string
|
communityColor*: string
|
||||||
|
|
|
@ -524,6 +524,8 @@ proc banUserFromCommunity*(pubKey: string, communityId: string): string =
|
||||||
"user": pubKey
|
"user": pubKey
|
||||||
}])
|
}])
|
||||||
|
|
||||||
|
proc setCommunityMuted*(communityId: string, muted: bool) =
|
||||||
|
discard callPrivateRPC("setCommunityMuted".prefix, %*[communityId, muted])
|
||||||
|
|
||||||
proc parseChatPinnedMessagesResponse*(rpcResult: JsonNode): (string, seq[Message]) =
|
proc parseChatPinnedMessagesResponse*(rpcResult: JsonNode): (string, seq[Message]) =
|
||||||
var messages: seq[Message] = @[]
|
var messages: seq[Message] = @[]
|
||||||
|
|
|
@ -212,6 +212,7 @@ proc toCommunity*(jsonCommunity: JsonNode): Community =
|
||||||
canManageUsers: jsonCommunity{"canManageUsers"}.getBool,
|
canManageUsers: jsonCommunity{"canManageUsers"}.getBool,
|
||||||
canJoin: jsonCommunity{"canJoin"}.getBool,
|
canJoin: jsonCommunity{"canJoin"}.getBool,
|
||||||
isMember: jsonCommunity{"isMember"}.getBool,
|
isMember: jsonCommunity{"isMember"}.getBool,
|
||||||
|
muted: jsonCommunity{"muted"}.getBool,
|
||||||
chats: newSeq[Chat](),
|
chats: newSeq[Chat](),
|
||||||
members: newSeq[string](),
|
members: newSeq[string](),
|
||||||
communityColor: jsonCommunity{"color"}.getStr,
|
communityColor: jsonCommunity{"color"}.getStr,
|
||||||
|
|
|
@ -246,7 +246,23 @@ Rectangle {
|
||||||
anchors.top: emptyViewAndSuggestionsLoader.bottom
|
anchors.top: emptyViewAndSuggestionsLoader.bottom
|
||||||
anchors.topMargin: active ? Style.current.padding : 0
|
anchors.topMargin: active ? Style.current.padding : 0
|
||||||
sourceComponent: Component {
|
sourceComponent: Component {
|
||||||
BackUpCommuntyBanner {}
|
Item {
|
||||||
|
width: parent.width
|
||||||
|
height: backupBanner.height
|
||||||
|
|
||||||
|
BackUpCommuntyBanner {
|
||||||
|
id: backupBanner
|
||||||
|
}
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: backupBanner
|
||||||
|
acceptedButtons: Qt.RightButton
|
||||||
|
onClicked: {
|
||||||
|
/* Prevents sending events to the component beneath
|
||||||
|
if Right Mouse Button is clicked. */
|
||||||
|
mouse.accepted = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,16 +15,6 @@ Rectangle {
|
||||||
radius: 16
|
radius: 16
|
||||||
color: Style.current.transparent
|
color: Style.current.transparent
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
acceptedButtons: Qt.RightButton
|
|
||||||
onClicked: {
|
|
||||||
/* Prevents sending events to the component beneath
|
|
||||||
if Right Mouse Button is clicked. */
|
|
||||||
mouse.accepted = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: 66
|
width: 66
|
||||||
height: 4
|
height: 4
|
||||||
|
|
|
@ -158,29 +158,28 @@ Item {
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// TODO re-add when this is supported
|
CommunityPopupButton {
|
||||||
// CommunityPopupButton {
|
id: notificationsBtn
|
||||||
// id: notificationsBtn
|
//% "Notifications"
|
||||||
// //% "Notifications"
|
label: qsTrId("notifications")
|
||||||
// label: qsTrId("notifications")
|
iconName: "notifications"
|
||||||
// iconName: "notifications"
|
width: parent.width
|
||||||
// width: parent.width
|
txtColor: Style.current.textColor
|
||||||
// txtColor: Style.current.textColor
|
type: globalSettings.theme === Universal.Dark ? "secondary" : "primary"
|
||||||
// type: globalSettings.theme === Universal.Dark ? "secondary" : "primary"
|
onClicked: function(){
|
||||||
// onClicked: function(){
|
notificationSwitch.clicked()
|
||||||
// notificationSwitch.checked = !notificationSwitch.checked
|
}
|
||||||
// }
|
StatusSwitch {
|
||||||
// StatusSwitch {
|
id: notificationSwitch
|
||||||
// id: notificationSwitch
|
checked: !chatsModel.communities.activeCommunity.muted
|
||||||
// anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
// anchors.rightMargin: Style.current.padding
|
anchors.rightMargin: Style.current.padding
|
||||||
// anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
// onCheckedChanged: function(value) {
|
onClicked: function () {
|
||||||
// // TODO: enable/disable notifications
|
chatsModel.communities.setCommunityMuted(chatsModel.communities.activeCommunity.id, notificationSwitch.checked)
|
||||||
// console.log("TODO: toggle")
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: spacer1
|
id: spacer1
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 7c1765786a96f5683e7e34323216f9098eec596b
|
Subproject commit 11c46edd8b25bb6b313b71378f1b3ac842ad1908
|
Loading…
Reference in New Issue