fix(discord): Process `delete channel & restart import` button
Fixes: #12684
This commit is contained in:
parent
b50dfc99c3
commit
69783e173b
|
@ -142,7 +142,7 @@ proc init*(self: Controller) =
|
||||||
|
|
||||||
self.events.on(SIGNAL_DISCORD_CHANNEL_IMPORT_FINISHED) do(e:Args):
|
self.events.on(SIGNAL_DISCORD_CHANNEL_IMPORT_FINISHED) do(e:Args):
|
||||||
let args = CommunityChatIdArgs(e)
|
let args = CommunityChatIdArgs(e)
|
||||||
self.delegate.discordImportChannelFinished(args.chatId)
|
self.delegate.discordImportChannelFinished(args.communityId, args.chatId)
|
||||||
|
|
||||||
self.events.on(SIGNAL_DISCORD_CHANNEL_IMPORT_CANCELED) do(e:Args):
|
self.events.on(SIGNAL_DISCORD_CHANNEL_IMPORT_CANCELED) do(e:Args):
|
||||||
let args = ChannelIdArgs(e)
|
let args = ChannelIdArgs(e)
|
||||||
|
@ -480,4 +480,7 @@ proc runSigningOnKeycard*(self: Controller, keyUid: string, path: string, dataTo
|
||||||
self.silentSigningKeyUid = keyUid
|
self.silentSigningKeyUid = keyUid
|
||||||
self.silentSigningPath = path
|
self.silentSigningPath = path
|
||||||
self.silentSigningPin = pin
|
self.silentSigningPin = pin
|
||||||
self.runSignFlow(pin, path, finalDataToSign)
|
self.runSignFlow(pin, path, finalDataToSign)
|
||||||
|
|
||||||
|
proc removeCommunityChat*(self: Controller, communityId: string, channelId: string) =
|
||||||
|
self.communityService.deleteCommunityChat(communityId, channelId)
|
||||||
|
|
|
@ -160,7 +160,7 @@ method discordImportChannelProgressUpdated*(
|
||||||
) {.base.} =
|
) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method discordImportChannelFinished*(self: AccessInterface, channelId: string) {.base.} =
|
method discordImportChannelFinished*(self: AccessInterface, communityId: string, channelId: string) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method discordImportChannelCanceled*(self: AccessInterface, channelId: string) {.base.} =
|
method discordImportChannelCanceled*(self: AccessInterface, channelId: string) {.base.} =
|
||||||
|
@ -255,3 +255,6 @@ method onCommunityMemberRevealedAccountsLoaded*(self: AccessInterface, community
|
||||||
|
|
||||||
method onAllCommunityTokensLoaded*(self: AccessInterface, communityTokens: seq[CommunityTokenDto]) {.base.} =
|
method onAllCommunityTokensLoaded*(self: AccessInterface, communityTokens: seq[CommunityTokenDto]) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method removeCommunityChat*(self: AccessInterface, communityId: string, channelId: string) {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
|
@ -475,8 +475,12 @@ method discordImportProgressUpdated*(
|
||||||
if stopped or progress.int >= 1:
|
if stopped or progress.int >= 1:
|
||||||
self.view.setDiscordImportInProgress(false)
|
self.view.setDiscordImportInProgress(false)
|
||||||
|
|
||||||
method discordImportChannelFinished*(self: Module, channelId: string) =
|
method removeCommunityChat*(self: Module, communityId: string, channelId: string) =
|
||||||
if self.view.getDiscordImportChannelId() == channelId:
|
self.controller.removeCommunityChat(communityId, channelId)
|
||||||
|
|
||||||
|
method discordImportChannelFinished*(self: Module, communityId: string, channelId: string) =
|
||||||
|
self.view.setDiscordImportedChannelCommunityId(communityId)
|
||||||
|
self.view.setDiscordImportedChannelId(channelId)
|
||||||
self.view.setDiscordImportProgress(100)
|
self.view.setDiscordImportProgress(100)
|
||||||
self.view.setDiscordImportProgressStopped(true)
|
self.view.setDiscordImportProgressStopped(true)
|
||||||
self.view.setDiscordImportInProgress(false)
|
self.view.setDiscordImportInProgress(false)
|
||||||
|
|
|
@ -50,6 +50,8 @@ QtObject:
|
||||||
discordImportChannelId: string
|
discordImportChannelId: string
|
||||||
discordImportChannelName: string
|
discordImportChannelName: string
|
||||||
discordImportCommunityImage: string
|
discordImportCommunityImage: string
|
||||||
|
discordImportedChannelId: string
|
||||||
|
discordImportedChannelCommunityId: string
|
||||||
discordImportHasCommunityImage: bool
|
discordImportHasCommunityImage: bool
|
||||||
downloadingCommunityHistoryArchives: bool
|
downloadingCommunityHistoryArchives: bool
|
||||||
checkingPermissionsInProgress: bool
|
checkingPermissionsInProgress: bool
|
||||||
|
@ -192,6 +194,20 @@ QtObject:
|
||||||
read = getDiscordImportWarningsCount
|
read = getDiscordImportWarningsCount
|
||||||
notify = discordImportWarningsCountChanged
|
notify = discordImportWarningsCountChanged
|
||||||
|
|
||||||
|
proc discordImportedChannelIdChanged*(self: View) {.signal.}
|
||||||
|
|
||||||
|
proc setDiscordImportedChannelId*(self: View, id: string) =
|
||||||
|
if (self.discordImportedChannelId == id): return
|
||||||
|
self.discordImportedChannelId = id
|
||||||
|
self.discordImportedChannelIdChanged()
|
||||||
|
|
||||||
|
proc getDiscordImportedChannelId*(self: View): string {.slot.} =
|
||||||
|
return self.discordImportedChannelId
|
||||||
|
|
||||||
|
QtProperty[int] discordImportedChannelId:
|
||||||
|
read = getDiscordImportedChannelIdCount
|
||||||
|
notify = discordImportedChannelIdChanged
|
||||||
|
|
||||||
proc setDiscordImportErrorsCount*(self: View, count: int) =
|
proc setDiscordImportErrorsCount*(self: View, count: int) =
|
||||||
if (self.discordImportErrorsCount == count): return
|
if (self.discordImportErrorsCount == count): return
|
||||||
self.discordImportErrorsCount = count
|
self.discordImportErrorsCount = count
|
||||||
|
@ -499,6 +515,8 @@ QtObject:
|
||||||
self.setDiscordImportCommunityName("")
|
self.setDiscordImportCommunityName("")
|
||||||
self.discordImportChannelId = ""
|
self.discordImportChannelId = ""
|
||||||
self.discordImportChannelName = ""
|
self.discordImportChannelName = ""
|
||||||
|
self.discordImportedChannelId = ""
|
||||||
|
self.discordImportedChannelCommunityId = ""
|
||||||
self.setDiscordImportCommunityImage("")
|
self.setDiscordImportCommunityImage("")
|
||||||
self.setDiscordImportHasCommunityImage(false)
|
self.setDiscordImportHasCommunityImage(false)
|
||||||
self.setDiscordImportInProgress(false)
|
self.setDiscordImportInProgress(false)
|
||||||
|
@ -634,6 +652,10 @@ QtObject:
|
||||||
self.delegate.requestCancelDiscordChannelImport(discordChannelId)
|
self.delegate.requestCancelDiscordChannelImport(discordChannelId)
|
||||||
self.resetDiscordImport(true)
|
self.resetDiscordImport(true)
|
||||||
|
|
||||||
|
proc removeImportedDiscordChannel*(self: View) {.slot.} =
|
||||||
|
self.delegate.removeCommunityChat(self.discordImportedChannelCommunityId, self.discordImportedChannelId)
|
||||||
|
self.resetDiscordImport(true)
|
||||||
|
|
||||||
proc toggleDiscordCategory*(self: View, id: string, selected: bool) {.slot.} =
|
proc toggleDiscordCategory*(self: View, id: string, selected: bool) {.slot.} =
|
||||||
if selected:
|
if selected:
|
||||||
self.discordCategoriesModel.selectItem(id)
|
self.discordCategoriesModel.selectItem(id)
|
||||||
|
@ -662,6 +684,10 @@ QtObject:
|
||||||
self.discordImportChannelId = id
|
self.discordImportChannelId = id
|
||||||
self.discordImportChannelName = item.getName()
|
self.discordImportChannelName = item.getName()
|
||||||
self.discordImportChannelChanged()
|
self.discordImportChannelChanged()
|
||||||
|
|
||||||
|
proc setDiscordImportedChannelCommunityId*(self: View, id: string) =
|
||||||
|
if (self.discordImportedChannelCommunityId == id): return
|
||||||
|
self.discordImportedChannelCommunityId = id
|
||||||
|
|
||||||
proc setDiscordImportChannelId*(self: View, id: string) {.slot.} =
|
proc setDiscordImportChannelId*(self: View, id: string) {.slot.} =
|
||||||
if (self.discordImportChannelId == id): return
|
if (self.discordImportChannelId == id): return
|
||||||
|
|
|
@ -40,8 +40,12 @@ StatusScrollView {
|
||||||
type: StatusButton.Danger
|
type: StatusButton.Danger
|
||||||
text: root.importingSingleChannel ? qsTr("Delete channel & restart import") : qsTr("Delete community & restart import")
|
text: root.importingSingleChannel ? qsTr("Delete channel & restart import") : qsTr("Delete community & restart import")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
// TODO display a confirmation and restart the whole flow
|
if (root.importingSingleChannel) {
|
||||||
root.close()
|
Global.openPopup(deleteAndRestartConfirmationPopupCmp)
|
||||||
|
} else {
|
||||||
|
// TODO do similar for community import
|
||||||
|
root.close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
StatusButton {
|
StatusButton {
|
||||||
|
@ -364,4 +368,28 @@ StatusScrollView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: deleteAndRestartConfirmationPopupCmp
|
||||||
|
ConfirmationDialog {
|
||||||
|
id: deleteAndRestartConfirmationPopup
|
||||||
|
headerSettings.title: qsTr("Are you sure you want to delete the channel?")
|
||||||
|
confirmationText: qsTr("Your new Status channel will be deleted and all information entered will be lost.")
|
||||||
|
showCancelButton: true
|
||||||
|
cancelBtnType: "default"
|
||||||
|
confirmButtonLabel: qsTr("Delete channel & cancel import")
|
||||||
|
cancelButtonLabel: qsTr("Cancel")
|
||||||
|
onConfirmButtonClicked: {
|
||||||
|
root.store.removeImportedDiscordChannel()
|
||||||
|
deleteAndRestartConfirmationPopup.close()
|
||||||
|
root.close()
|
||||||
|
}
|
||||||
|
onCancelButtonClicked: {
|
||||||
|
deleteAndRestartConfirmationPopup.close()
|
||||||
|
}
|
||||||
|
onClosed: {
|
||||||
|
destroy()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,6 +195,10 @@ QtObject {
|
||||||
root.communitiesModuleInst.requestCancelDiscordChannelImport(id)
|
root.communitiesModuleInst.requestCancelDiscordChannelImport(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function removeImportedDiscordChannel() {
|
||||||
|
root.communitiesModuleInst.removeImportedDiscordChannel()
|
||||||
|
}
|
||||||
|
|
||||||
function resetDiscordImport() {
|
function resetDiscordImport() {
|
||||||
root.communitiesModuleInst.resetDiscordImport(false)
|
root.communitiesModuleInst.resetDiscordImport(false)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue