Add command to delete all own portals for a fresh start

This commit is contained in:
Tulir Asokan
2019-05-31 19:33:18 +03:00
parent 37cd34e4bf
commit a40584db41
2 changed files with 60 additions and 9 deletions

View File

@ -416,14 +416,12 @@ func (portal *Portal) ensureUserInvited(user *User) {
}
func (portal *Portal) Sync(user *User, contact whatsapp.Contact) {
if portal.IsPrivateChat() {
portal.ensureUserInvited(user)
return
}
portal.log.Infoln("Syncing portal for", user.MXID)
if len(portal.MXID) == 0 {
portal.Name = contact.Name
if !portal.IsPrivateChat() {
portal.Name = contact.Name
}
err := portal.CreateMatrixRoom(user)
if err != nil {
portal.log.Errorln("Failed to create portal room:", err)
@ -433,6 +431,10 @@ func (portal *Portal) Sync(user *User, contact whatsapp.Contact) {
portal.ensureUserInvited(user)
}
if portal.IsPrivateChat() {
return
}
update := false
update = portal.UpdateMetadata(user) || update
if !portal.IsStatusBroadcastRoom() {