forked from MirrorHub/mautrix-whatsapp
Make delete-all-portals temporarily admin-only
This commit is contained in:
parent
b874d324eb
commit
7aa838dce6
1 changed files with 8 additions and 3 deletions
11
commands.go
11
commands.go
|
@ -712,18 +712,23 @@ func (handler *CommandHandler) CommandDeletePortal(ce *CommandEvent) {
|
|||
ce.Portal.Cleanup(false)
|
||||
}
|
||||
|
||||
const cmdDeleteAllPortalsHelp = `delete-all-portals - Delete all your portals that aren't used by any other user.'`
|
||||
const cmdDeleteAllPortalsHelp = `delete-all-portals - Delete all your portals that aren't used by any other user.`
|
||||
|
||||
func (handler *CommandHandler) CommandDeleteAllPortals(ce *CommandEvent) {
|
||||
portals := ce.User.GetPortals()
|
||||
portalsToDelete := make([]*Portal, 0, len(portals))
|
||||
// TODO reimplement
|
||||
//portals := ce.User.GetPortals()
|
||||
//portalsToDelete := make([]*Portal, 0, len(portals))
|
||||
//for _, portal := range portals {
|
||||
// users := portal.GetUserIDs()
|
||||
// if len(users) == 1 && users[0] == ce.User.MXID {
|
||||
// portalsToDelete = append(portalsToDelete, portal)
|
||||
// }
|
||||
//}
|
||||
if !ce.User.Admin {
|
||||
return
|
||||
}
|
||||
portalsToDelete := handler.bridge.GetAllPortals()
|
||||
|
||||
leave := func(portal *Portal) {
|
||||
if len(portal.MXID) > 0 {
|
||||
_, _ = portal.MainIntent().KickUser(portal.MXID, &mautrix.ReqKickUser{
|
||||
|
|
Loading…
Reference in a new issue