parent
9be598ee32
commit
cdac45010a
|
@ -636,8 +636,8 @@ proc muteCategory*(self: Controller, categoryId: string, interval: int) =
|
||||||
proc unmuteCategory*(self: Controller, categoryId: string) =
|
proc unmuteCategory*(self: Controller, categoryId: string) =
|
||||||
self.communityService.unmuteCategory(self.sectionId, categoryId)
|
self.communityService.unmuteCategory(self.sectionId, categoryId)
|
||||||
|
|
||||||
proc setCommunityMuted*(self: Controller, muted: bool) =
|
proc setCommunityMuted*(self: Controller, mutedType: int) =
|
||||||
self.communityService.setCommunityMuted(self.sectionId, muted)
|
self.communityService.setCommunityMuted(self.sectionId, mutedType)
|
||||||
|
|
||||||
proc inviteUsersToCommunity*(self: Controller, pubKeys: string, inviteMessage: string): string =
|
proc inviteUsersToCommunity*(self: Controller, pubKeys: string, inviteMessage: string): string =
|
||||||
result = self.communityService.inviteUsersToCommunityById(self.sectionId, pubKeys, inviteMessage)
|
result = self.communityService.inviteUsersToCommunityById(self.sectionId, pubKeys, inviteMessage)
|
||||||
|
|
|
@ -304,7 +304,7 @@ method unbanUserFromCommunity*(self: AccessInterface, pubKey: string) {.base.} =
|
||||||
method exportCommunity*(self: AccessInterface): string {.base.} =
|
method exportCommunity*(self: AccessInterface): string {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method setCommunityMuted*(self: AccessInterface, muted: bool) {.base.} =
|
method setCommunityMuted*(self: AccessInterface, mutedType: int) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method inviteUsersToCommunity*(self: AccessInterface, pubKeysJSON: string, inviteMessage: string): string {.base.} =
|
method inviteUsersToCommunity*(self: AccessInterface, pubKeysJSON: string, inviteMessage: string): string {.base.} =
|
||||||
|
|
|
@ -1164,8 +1164,8 @@ method editCommunity*(self: Module, name: string,
|
||||||
method exportCommunity*(self: Module): string =
|
method exportCommunity*(self: Module): string =
|
||||||
self.controller.exportCommunity()
|
self.controller.exportCommunity()
|
||||||
|
|
||||||
method setCommunityMuted*(self: Module, muted: bool) =
|
method setCommunityMuted*(self: Module, mutedType: int) =
|
||||||
self.controller.setCommunityMuted(muted)
|
self.controller.setCommunityMuted(mutedType)
|
||||||
|
|
||||||
method inviteUsersToCommunity*(self: Module, pubKeysJSON: string, inviteMessage: string): string =
|
method inviteUsersToCommunity*(self: Module, pubKeysJSON: string, inviteMessage: string): string =
|
||||||
result = self.controller.inviteUsersToCommunity(pubKeysJSON, inviteMessage)
|
result = self.controller.inviteUsersToCommunity(pubKeysJSON, inviteMessage)
|
||||||
|
|
|
@ -324,8 +324,8 @@ QtObject:
|
||||||
proc exportCommunity*(self: View): string {.slot.} =
|
proc exportCommunity*(self: View): string {.slot.} =
|
||||||
self.delegate.exportCommunity()
|
self.delegate.exportCommunity()
|
||||||
|
|
||||||
proc setCommunityMuted*(self: View, muted: bool) {.slot.} =
|
proc setCommunityMuted*(self: View, mutedType: int) {.slot.} =
|
||||||
self.delegate.setCommunityMuted(muted)
|
self.delegate.setCommunityMuted(mutedType)
|
||||||
|
|
||||||
proc inviteUsersToCommunity*(self: View, pubKeysJSON: string, inviteMessage: string): string {.slot.} =
|
proc inviteUsersToCommunity*(self: View, pubKeysJSON: string, inviteMessage: string): string {.slot.} =
|
||||||
result = self.delegate.inviteUsersToCommunity(pubKeysJSON, inviteMessage)
|
result = self.delegate.inviteUsersToCommunity(pubKeysJSON, inviteMessage)
|
||||||
|
|
|
@ -210,8 +210,8 @@ proc requestCommunityInfo*(self: Controller, communityId: string, importing: boo
|
||||||
proc importCommunity*(self: Controller, communityKey: string) =
|
proc importCommunity*(self: Controller, communityKey: string) =
|
||||||
self.communityService.importCommunity(communityKey)
|
self.communityService.importCommunity(communityKey)
|
||||||
|
|
||||||
proc setCommunityMuted*(self: Controller, communityId: string, muted: bool) =
|
proc setCommunityMuted*(self: Controller, communityId: string, mutedType: int) =
|
||||||
self.communityService.setCommunityMuted(communityId, muted)
|
self.communityService.setCommunityMuted(communityId, mutedType)
|
||||||
|
|
||||||
proc getContactNameAndImage*(self: Controller, contactId: string):
|
proc getContactNameAndImage*(self: Controller, contactId: string):
|
||||||
tuple[name: string, image: string, largeImage: string] =
|
tuple[name: string, image: string, largeImage: string] =
|
||||||
|
|
|
@ -23,6 +23,6 @@ proc inviteUsersToCommunity*(self: Controller, communityID: string, pubKeys: str
|
||||||
proc leaveCommunity*(self: Controller, communityID: string) =
|
proc leaveCommunity*(self: Controller, communityID: string) =
|
||||||
self.communityService.leaveCommunity(communityID)
|
self.communityService.leaveCommunity(communityID)
|
||||||
|
|
||||||
method setCommunityMuted*(self: Controller, communityID: string, muted: bool) =
|
method setCommunityMuted*(self: Controller, communityID: string, mutedType: int) =
|
||||||
self.communityService.setCommunityMuted(communityID, muted)
|
self.communityService.setCommunityMuted(communityID, mutedType)
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,6 @@ method inviteUsersToCommunity*(self: AccessInterface, communityID: string, pubKe
|
||||||
method leaveCommunity*(self: AccessInterface, communityID: string) {.base.} =
|
method leaveCommunity*(self: AccessInterface, communityID: string) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method setCommunityMuted*(self: AccessInterface, communityID: string, muted: bool) {.base.} =
|
method setCommunityMuted*(self: AccessInterface, communityID: string, mutedType: int) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
|
|
@ -48,5 +48,5 @@ method inviteUsersToCommunity*(self: Module, communityID: string, pubKeysJSON: s
|
||||||
method leaveCommunity*(self: Module, communityID: string) =
|
method leaveCommunity*(self: Module, communityID: string) =
|
||||||
self.controller.leaveCommunity(communityID)
|
self.controller.leaveCommunity(communityID)
|
||||||
|
|
||||||
method setCommunityMuted*(self: Module, communityID: string, muted: bool) =
|
method setCommunityMuted*(self: Module, communityID: string, mutedType: int) =
|
||||||
self.controller.setCommunityMuted(communityID, muted)
|
self.controller.setCommunityMuted(communityID, mutedType)
|
||||||
|
|
|
@ -25,5 +25,5 @@ QtObject:
|
||||||
method leaveCommunity*(self: View, communityID: string) {.slot.} =
|
method leaveCommunity*(self: View, communityID: string) {.slot.} =
|
||||||
self.delegate.leaveCommunity(communityID)
|
self.delegate.leaveCommunity(communityID)
|
||||||
|
|
||||||
method setCommunityMuted*(self: View, communityID: string, muted: bool) {.slot.} =
|
method setCommunityMuted*(self: View, communityID: string, mutedType: int) {.slot.} =
|
||||||
self.delegate.setCommunityMuted(communityID, muted)
|
self.delegate.setCommunityMuted(communityID, mutedType)
|
|
@ -16,6 +16,15 @@ type RequestToJoinType* {.pure.}= enum
|
||||||
Accepted = 3,
|
Accepted = 3,
|
||||||
Canceled = 4
|
Canceled = 4
|
||||||
|
|
||||||
|
type MutedType* {.pure.}= enum
|
||||||
|
For15min = 1,
|
||||||
|
For1hr = 2,
|
||||||
|
For8hr = 3,
|
||||||
|
For1week = 4,
|
||||||
|
TillUnmuted = 5,
|
||||||
|
For1min = 6,
|
||||||
|
Unmuted = 7
|
||||||
|
|
||||||
type CommunityMembershipRequestDto* = object
|
type CommunityMembershipRequestDto* = object
|
||||||
id*: string
|
id*: string
|
||||||
publicKey*: string
|
publicKey*: string
|
||||||
|
|
|
@ -1813,10 +1813,14 @@ QtObject:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error "Error banning user from community", msg = e.msg
|
error "Error banning user from community", msg = e.msg
|
||||||
|
|
||||||
proc setCommunityMuted*(self: Service, communityId: string, muted: bool) =
|
proc setCommunityMuted*(self: Service, communityId: string, mutedType: int) =
|
||||||
try:
|
try:
|
||||||
discard status_go.setCommunityMuted(communityId, muted)
|
let response = status_go.setCommunityMuted(communityId, mutedType)
|
||||||
|
if not response.error.isNil:
|
||||||
|
error "error muting the community", msg = response.error.message
|
||||||
|
return
|
||||||
|
|
||||||
|
let muted = if (MutedType(mutedType) == MutedType.Unmuted): false else: true
|
||||||
self.events.emit(SIGNAL_COMMUNITY_MUTED,
|
self.events.emit(SIGNAL_COMMUNITY_MUTED,
|
||||||
CommunityMutedArgs(communityId: communityId, muted: muted))
|
CommunityMutedArgs(communityId: communityId, muted: muted))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
@ -370,8 +370,11 @@ proc unbanUserFromCommunity*(communityId: string, pubKey: string): RpcResponse[J
|
||||||
"user": pubKey
|
"user": pubKey
|
||||||
}])
|
}])
|
||||||
|
|
||||||
proc setCommunityMuted*(communityId: string, muted: bool): RpcResponse[JsonNode] {.raises: [Exception].} =
|
proc setCommunityMuted*(communityId: string, mutedType: int): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
return callPrivateRPC("setCommunityMuted".prefix, %*[communityId, muted])
|
return callPrivateRPC("setCommunityMuted".prefix, %*[{
|
||||||
|
"communityId": communityId,
|
||||||
|
"mutedType": mutedType
|
||||||
|
}])
|
||||||
|
|
||||||
proc inviteUsersToCommunity*(communityId: string, pubKeys: seq[string]): RpcResponse[JsonNode] {.raises: [Exception].} =
|
proc inviteUsersToCommunity*(communityId: string, pubKeys: seq[string]): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
return callPrivateRPC("inviteUsersToCommunity".prefix, %*[{
|
return callPrivateRPC("inviteUsersToCommunity".prefix, %*[{
|
||||||
|
|
|
@ -9,15 +9,20 @@ import StatusQ.Popups 0.1
|
||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
|
|
||||||
|
import shared.controls.chat.menuItems 1.0
|
||||||
|
|
||||||
StatusListView {
|
StatusListView {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property bool hasAddedContacts: false
|
property bool hasAddedContacts: false
|
||||||
|
|
||||||
signal inviteFriends(var communityData)
|
signal inviteFriends(var communityData)
|
||||||
|
|
||||||
signal closeCommunityClicked(string communityId)
|
signal closeCommunityClicked(string communityId)
|
||||||
signal leaveCommunityClicked(string community, string communityId, string outroMessage)
|
signal leaveCommunityClicked(string community, string communityId, string outroMessage)
|
||||||
signal setCommunityMutedClicked(string communityId, bool muted)
|
|
||||||
|
signal setCommunityMutedClicked(string communityId, int mutedType)
|
||||||
|
|
||||||
signal setActiveCommunityClicked(string communityId)
|
signal setActiveCommunityClicked(string communityId)
|
||||||
|
|
||||||
interactive: false
|
interactive: false
|
||||||
|
@ -43,27 +48,50 @@ StatusListView {
|
||||||
onClicked: setActiveCommunityClicked(model.id)
|
onClicked: setActiveCommunityClicked(model.id)
|
||||||
|
|
||||||
components: [
|
components: [
|
||||||
|
|
||||||
StatusFlatButton {
|
StatusFlatButton {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
objectName: "CommunitiesListPanel_leaveCommunityPopupButton"
|
|
||||||
size: StatusBaseButton.Size.Small
|
size: StatusBaseButton.Size.Small
|
||||||
type: StatusBaseButton.Type.Danger
|
icon.name: "dots-icon"
|
||||||
borderColor: "transparent"
|
onClicked: menu.popup(0, height)
|
||||||
enabled: model.memberRole !== Constants.memberRole.owner
|
|
||||||
|
property StatusMenu menu: StatusMenu {
|
||||||
|
id: communityContextMenu
|
||||||
|
width: 180
|
||||||
|
|
||||||
|
StatusAction {
|
||||||
|
text: qsTr("Invite People")
|
||||||
|
icon.name: "share-ios"
|
||||||
|
enabled: model.canManageUsers
|
||||||
|
onTriggered: root.inviteFriends(model)
|
||||||
|
}
|
||||||
|
|
||||||
|
MuteChatMenuItem {
|
||||||
|
enabled: !model.muted
|
||||||
|
title: qsTr("Mute Community")
|
||||||
|
onMuteTriggered: {
|
||||||
|
root.setCommunityMutedClicked(model.id, interval)
|
||||||
|
communityContextMenu.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StatusAction {
|
||||||
|
enabled: model.muted
|
||||||
|
text: qsTr("Unmute Community")
|
||||||
|
icon.name: "notification-muted"
|
||||||
|
onTriggered: root.setCommunityMutedClicked(model.id, Constants.MutingVariations.Unmuted)
|
||||||
|
}
|
||||||
|
|
||||||
|
StatusMenuSeparator {}
|
||||||
|
|
||||||
|
StatusAction {
|
||||||
text: model.spectated ? qsTr("Close Community") : qsTr("Leave Community")
|
text: model.spectated ? qsTr("Close Community") : qsTr("Leave Community")
|
||||||
onClicked: model.spectated ? root.closeCommunityClicked(model.id) : root.leaveCommunityClicked(model.name, model.id, model.outroMessage)
|
icon.name: "arrow-left"
|
||||||
},
|
type: StatusAction.Type.Danger
|
||||||
StatusFlatButton {
|
onTriggered: model.spectated ? root.closeCommunityClicked(model.id)
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
: root.leaveCommunityClicked(model.name, model.id, model.outroMessage)
|
||||||
size: StatusBaseButton.Size.Small
|
}
|
||||||
icon.name: model.muted ? "notification-muted" : "notification"
|
}
|
||||||
onClicked: root.setCommunityMutedClicked(model.id, !model.muted)
|
|
||||||
},
|
|
||||||
StatusFlatButton {
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
size: StatusBaseButton.Size.Small
|
|
||||||
icon.name: "invite-users"
|
|
||||||
onClicked: root.inviteFriends(model)
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ SettingsContentBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
onSetCommunityMutedClicked: {
|
onSetCommunityMutedClicked: {
|
||||||
root.profileSectionStore.communitiesProfileModule.setCommunityMuted(communityId, muted)
|
root.profileSectionStore.communitiesProfileModule.setCommunityMuted(communityId, mutedType)
|
||||||
}
|
}
|
||||||
|
|
||||||
onSetActiveCommunityClicked: {
|
onSetActiveCommunityClicked: {
|
||||||
|
|
|
@ -17,6 +17,7 @@ import AppLayouts.CommunitiesPortal 1.0
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
import shared 1.0
|
import shared 1.0
|
||||||
import shared.controls 1.0
|
import shared.controls 1.0
|
||||||
|
import shared.controls.chat.menuItems 1.0
|
||||||
import shared.panels 1.0
|
import shared.panels 1.0
|
||||||
import shared.popups 1.0
|
import shared.popups 1.0
|
||||||
import shared.popups.keycard 1.0
|
import shared.popups.keycard 1.0
|
||||||
|
@ -327,7 +328,7 @@ Item {
|
||||||
popupMenu: Component {
|
popupMenu: Component {
|
||||||
StatusMenu {
|
StatusMenu {
|
||||||
id: communityContextMenu
|
id: communityContextMenu
|
||||||
|
width: 180
|
||||||
property var chatCommunitySectionModule
|
property var chatCommunitySectionModule
|
||||||
|
|
||||||
openHandler: function () {
|
openHandler: function () {
|
||||||
|
@ -356,11 +357,21 @@ Item {
|
||||||
|
|
||||||
StatusMenuSeparator {}
|
StatusMenuSeparator {}
|
||||||
|
|
||||||
|
MuteChatMenuItem {
|
||||||
|
enabled: !model.muted
|
||||||
|
title: qsTr("Mute Community")
|
||||||
|
onMuteTriggered: {
|
||||||
|
communityContextMenu.chatCommunitySectionModule.setCommunityMuted(interval)
|
||||||
|
communityContextMenu.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
StatusAction {
|
StatusAction {
|
||||||
text: model.muted ? qsTr("Unmute Community") : qsTr("Mute Community")
|
enabled: model.muted
|
||||||
icon.name: model.muted ? "notification-muted" : "notification"
|
text: qsTr("Unmute Community")
|
||||||
|
icon.name: "notification-muted"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
communityContextMenu.chatCommunitySectionModule.setCommunityMuted(!model.muted)
|
communityContextMenu.chatCommunitySectionModule.setCommunityMuted(Constants.MutingVariations.Unmuted)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1078,6 +1078,7 @@ QtObject {
|
||||||
For8hr = 3,
|
For8hr = 3,
|
||||||
For1week = 4,
|
For1week = 4,
|
||||||
TillUnmuted = 5,
|
TillUnmuted = 5,
|
||||||
For1min = 6
|
For1min = 6,
|
||||||
|
Unmuted = 7
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit ea7a3890755b25856ec8f8da7bdda0189a3fcc68
|
Subproject commit 3e7d1a5f34183ea9f2ebf3b3d6a8143c98674d62
|
Loading…
Reference in New Issue