Skip to content

Commit

Permalink
add sync-portal helper command
Browse files Browse the repository at this point in the history
  • Loading branch information
maltee1 committed Feb 13, 2024
1 parent 1d1b505 commit f7193d4
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func (br *SignalBridge) RegisterCommands() {
cmdDeletePortal,
cmdDeleteAllPortals,
cmdCleanupLostPortals,
cmdSyncPortal,
)
}

Expand Down Expand Up @@ -642,3 +643,22 @@ func fnCleanupLostPortals(ce *WrappedCommandEvent) {
}
ce.Reply("Finished cleaning up portals")
}

var cmdSyncPortal = &commands.FullHandler{
Func: wrapCommand(fnSyncPortal),
Name: "sync-portal",
Help: commands.HelpMeta{
Section: HelpSectionPortalManagement,
Description: "Sync this portal.",
},
RequiresPortal: true,
RequiresLogin: true,
RequiresAdmin: true,
}

func fnSyncPortal(ce *WrappedCommandEvent) {
info, _ := ce.User.Client.RetrieveGroupByID(ce.Ctx, ce.Portal.GroupID(), ce.Portal.Revision)
if info != nil {
ce.Portal.UpdateInfo(ce.Ctx, ce.User, info, ce.Portal.Revision)
}
}

0 comments on commit f7193d4

Please sign in to comment.