feat(@desktop/group-chat): remove explicit join for groups

closes: #5717
This commit is contained in:
Patryk Osmaczko 2022-05-19 22:09:55 +02:00 committed by Iuri Matias
parent 0e1357b78e
commit cdd06b05eb
11 changed files with 0 additions and 113 deletions

View File

@ -253,12 +253,6 @@ proc getTransactionDetails*(self: Controller, message: MessageDto): (string,stri
proc getWalletAccounts*(self: Controller): seq[wallet_account_service.WalletAccountDto] =
return self.messageService.getWalletAccounts()
proc joinGroupChat*(self: Controller) =
var communityId = ""
if (self.belongsToCommunity):
communityId = self.sectionId
self.chatService.confirmJoiningGroup(communityId, self.chatId)
proc leaveChat*(self: Controller) =
self.chatService.leaveChat(self.chatId)

View File

@ -118,9 +118,6 @@ method requestMoreMessages*(self: AccessInterface) {.base.} =
method fillGaps*(self: AccessInterface, messageId: string) {.base.} =
raise newException(ValueError, "No implementation available")
method joinGroupChat*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method leaveChat*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")

View File

@ -472,23 +472,9 @@ method requestMoreMessages*(self: Module) =
method fillGaps*(self: Module, messageId: string) =
self.controller.fillGaps(messageId)
method joinGroupChat*(self: Module) =
self.controller.joinGroupChat()
method leaveChat*(self: Module) =
self.controller.leaveChat()
method didIJoinedChat*(self: Module): bool =
let chatDto = self.controller.getChatDetails()
if(chatDto.chatType != ChatType.PrivateGroupChat):
return true
let myPublicKey = singletonInstance.userProfile.getPubKey()
for member in chatDto.members:
if (member.id == myPublicKey):
return member.joined
return true
method onChatMemberUpdated*(self: Module, publicKey: string, admin: bool, joined: bool) =
let chatDto = self.controller.getChatDetails()
if(chatDto.chatType != ChatType.PrivateGroupChat):

View File

@ -157,15 +157,9 @@ QtObject:
proc fillGaps(self: View, messageId: string) {.slot.} =
self.delegate.fillGaps(messageId)
proc joinGroupChat*(self: View) {.slot.} =
self.delegate.joinGroupChat()
proc leaveChat*(self: View) {.slot.} =
self.delegate.leaveChat()
proc didIJoinedChat(self: View): bool {.slot.} =
return self.delegate.didIJoinedChat()
proc refreshAMessageUserRespondedTo(self: View, msgId: string) {.signal.}
proc emitRefreshAMessageUserRespondedToSignal*(self: View, msgId: string) =
self.refreshAMessageUserRespondedTo(msgId)

View File

@ -310,9 +310,6 @@ proc createGroupChat*(self: Controller, communityID: string, groupName: string,
self.contactService, self.chatService, self.communityService, self.messageService,
self.gifService, self.mailserversService)
proc confirmJoiningGroup*(self: Controller, communityID: string, chatID: string) =
self.chatService.confirmJoiningGroup(communityID, self.getActiveChatId())
proc joinGroupChatFromInvitation*(self: Controller, groupName: string, chatId: string, adminPK: string) =
let response = self.chatService.createGroupChatFromInvitation(groupName, chatId, adminPK)
if(response.success):

View File

@ -502,14 +502,6 @@ QtObject:
except Exception as e:
error "error while making user admin: ", msg = e.msg
proc confirmJoiningGroup*(self: Service, communityID: string, chatID: string) =
try:
let response = status_group_chat.confirmJoiningGroup(communityID, chatId)
self.emitUpdate(response)
except Exception as e:
error "error while confirmation joining to group: ", msg = e.msg
proc createGroupChatFromInvitation*(self: Service, groupName: string, chatId: string, adminPK: string): tuple[chatDto: ChatDto, success: bool] =
try:
let response = status_group_chat.createGroupChatFromInvitation(groupName, chatId, adminPK)

View File

@ -124,10 +124,6 @@ proc createGroupChat*(communityID: string, groupName: string, pubKeys: seq[strin
let payload = %* [nil, communityID, groupName, pubKeys]
result = callPrivateRPC("createGroupChatWithMembers".prefix, payload)
proc confirmJoiningGroup*(communityID: string, chatId: string): RpcResponse[JsonNode] {.raises: [Exception].} =
let payload = %* [communityID, chatId]
result = callPrivateRPC("confirmJoiningGroup".prefix, payload)
proc createGroupChatFromInvitation*(groupName: string, chatId: string, adminPK: string): RpcResponse[JsonNode] {.raises: [Exception].} =
let payload = %* [groupName, chatId, adminPK]
result = callPrivateRPC("createGroupChatFromInvitation".prefix, payload)

View File

@ -39,11 +39,6 @@ proc makeAdmin*(communityID: string, chatID: string, member: string): RpcRespons
return core.callPrivateRPC("chat_makeAdmin", payload)
proc confirmJoiningGroup*(communityID: string, chatID: string): RpcResponse[JsonNode] {.raises: [Exception].} =
let payload = %* [communityID, chatID]
return core.callPrivateRPC("chat_confirmJoiningGroup", payload)
proc renameChat*(communityID: string, chatID: string, name: string): RpcResponse[JsonNode] {.raises: [Exception].} =
let payload = %* [communityID, chatID, name]

View File

@ -234,24 +234,12 @@ QtObject {
return messageModule.fillGaps(messageId);
}
function joinGroupChat() {
if(!messageModule)
return
messageModule.joinGroupChat();
}
function leaveChat() {
if(!messageModule)
return
messageModule.leaveChat();
}
function didIJoinedChat() {
if(!messageModule)
return true
return messageModule.didIJoinedChat();
}
property bool playAnimation: {
if(!Global.applicationWindow.active)
return false

View File

@ -21,10 +21,6 @@ Column {
property string chatColor: ""
property string chatEmoji: ""
property string chatIcon: ""
property bool didIJoinedChat: true
signal joinChatClicked()
signal rejectJoiningChatClicked()
StatusSmartIdenticon {
anchors.horizontalCenter: parent.horizontalCenter
@ -75,48 +71,4 @@ Column {
horizontalAlignment: Text.AlignHCenter
textFormat: Text.RichText
}
Item {
id: joinOrDecline
visible: root.chatType === Constants.chatType.privateGroupChat && !root.amIChatAdmin && !root.didIJoinedChat
anchors.horizontalCenter: parent.horizontalCenter
width: visible ? joinChat.width : 0
height: visible ? 100 : 0
StyledText {
id: joinChat
//% "Join chat"
text: qsTrId("join-chat")
font.pixelSize: 20
color: Style.current.blue
anchors.horizontalCenter: parent.horizontalCenter
MouseArea {
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
onClicked: {
root.joinChatClicked()
joinOrDecline.visible = false // Once we start getting member `joined` updates from `status-go` we can remove this
}
}
}
StyledText {
//% "Decline invitation"
text: qsTrId("group-chat-decline-invitation")
font.pixelSize: 20
color: Style.current.blue
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: joinChat.bottom
anchors.topMargin: Style.current.padding
MouseArea {
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
onClicked: {
root.rejectJoiningChatClicked()
joinOrDecline.visible = false // Once we start getting member `joined` updates from `status-go` we can remove this
}
}
}
}
}

View File

@ -290,10 +290,6 @@ Column {
chatEmoji: root.channelEmoji
amIChatAdmin: root.messageStore.amIChatAdmin()
chatIcon: root.senderIcon
didIJoinedChat: root.messageStore.didIJoinedChat()
onJoinChatClicked: root.messageStore.joinGroupChat()
onRejectJoiningChatClicked: root.messageStore.leaveChat()
}
}