feat(discord_import): send signal when the import was cleaned up (#4693)
This is to let the front end know that the community was deleted so it can also delete it from the UI
This commit is contained in:
parent
ca973b4aa6
commit
1c42c07760
|
@ -382,6 +382,7 @@ func (m *Messenger) cleanUpImport(communityID string) {
|
|||
if deleteErr != nil {
|
||||
m.logger.Error("clean up failed, couldn't delete community messages", zap.Error(deleteErr))
|
||||
}
|
||||
m.config.messengerSignalsHandler.DiscordCommunityImportCleanedUp(communityID)
|
||||
}
|
||||
|
||||
func (m *Messenger) cleanUpImportChannel(communityID string, channelID string) {
|
||||
|
|
|
@ -57,6 +57,7 @@ type MessengerSignalsHandler interface {
|
|||
DiscordCommunityImportProgress(importProgress *discord.ImportProgress)
|
||||
DiscordCommunityImportFinished(communityID string)
|
||||
DiscordCommunityImportCancelled(communityID string)
|
||||
DiscordCommunityImportCleanedUp(communityID string)
|
||||
DiscordChannelImportProgress(importProgress *discord.ImportProgress)
|
||||
DiscordChannelImportFinished(communityID string, channelID string)
|
||||
DiscordChannelImportCancelled(channelID string)
|
||||
|
|
|
@ -153,6 +153,10 @@ func (m *MessengerSignalsHandler) DiscordCommunityImportCancelled(id string) {
|
|||
signal.SendDiscordCommunityImportCancelled(id)
|
||||
}
|
||||
|
||||
func (m *MessengerSignalsHandler) DiscordCommunityImportCleanedUp(id string) {
|
||||
signal.SendDiscordCommunityImportCleanedUp(id)
|
||||
}
|
||||
|
||||
func (m *MessengerSignalsHandler) DiscordChannelImportCancelled(id string) {
|
||||
signal.SendDiscordChannelImportCancelled(id)
|
||||
}
|
||||
|
|
|
@ -22,6 +22,9 @@ const (
|
|||
// the discord community was cancelled
|
||||
EventDiscordCommunityImportCancelled = "community.discordCommunityImportCancelled"
|
||||
|
||||
// EventDiscordCommunityImportCleanedUp triggered when the community has been cleaned up (deleted)
|
||||
EventDiscordCommunityImportCleanedUp = "community.discordCommunityImportCleanedUp"
|
||||
|
||||
// EventDiscordChannelImportProgress is triggered during the import
|
||||
// of a discord community channel as it progresses
|
||||
EventDiscordChannelImportProgress = "community.discordChannelImportProgress"
|
||||
|
@ -54,6 +57,10 @@ type DiscordCommunityImportCancelledSignal struct {
|
|||
CommunityID string `json:"communityId"`
|
||||
}
|
||||
|
||||
type DiscordCommunityImportCleanedUpSignal struct {
|
||||
CommunityID string `json:"communityId"`
|
||||
}
|
||||
|
||||
type DiscordChannelImportProgressSignal struct {
|
||||
ImportProgress *discord.ImportProgress `json:"importProgress"`
|
||||
}
|
||||
|
@ -107,6 +114,12 @@ func SendDiscordCommunityImportCancelled(communityID string) {
|
|||
})
|
||||
}
|
||||
|
||||
func SendDiscordCommunityImportCleanedUp(communityID string) {
|
||||
send(EventDiscordCommunityImportCleanedUp, DiscordCommunityImportCleanedUpSignal{
|
||||
CommunityID: communityID,
|
||||
})
|
||||
}
|
||||
|
||||
func SendDiscordChannelImportCancelled(channelID string) {
|
||||
send(EventDiscordChannelImportCancelled, DiscordChannelImportCancelledSignal{
|
||||
ChannelID: channelID,
|
||||
|
|
Loading…
Reference in New Issue