Disable autojoining threads

This commit is contained in:
Tulir Asokan
2022-05-29 00:32:02 +03:00
parent a7c969b7bc
commit 49b5f77a03
2 changed files with 8 additions and 8 deletions

View File

@@ -644,11 +644,11 @@ func (portal *Portal) handleDiscordMessageUpdate(user *User, msg *discordgo.Mess
if msg.Flags == discordgo.MessageFlagsHasThread { if msg.Flags == discordgo.MessageFlagsHasThread {
portal.bridge.GetThreadByID(msg.ID, existing) portal.bridge.GetThreadByID(msg.ID, existing)
portal.log.Debugfln("Marked %s as a thread root", msg.ID) portal.log.Debugfln("Marked %s as a thread root", msg.ID)
// TODO make autojoining optional // TODO make autojoining configurable
err := user.Session.ThreadJoinWithLocation(msg.ID, discordgo.ThreadJoinLocationContextMenu) //err := user.Session.ThreadJoinWithLocation(msg.ID, discordgo.ThreadJoinLocationContextMenu)
if err != nil { //if err != nil {
user.log.Warnfln("Error autojoining thread %s@%s: %v", msg.ChannelID, portal.Key.ChannelID, err) // user.log.Warnfln("Error autojoining thread %s@%s: %v", msg.ChannelID, portal.Key.ChannelID, err)
} //}
} }
// There's a few scenarios where the author is nil but I haven't figured // There's a few scenarios where the author is nil but I haven't figured
@@ -665,7 +665,7 @@ func (portal *Portal) handleDiscordMessageUpdate(user *User, msg *discordgo.Mess
return return
} }
portal.log.Errorfln("author is nil: %#v", msg) //portal.log.Errorfln("author is nil: %#v", msg)
return return
} }

View File

@@ -290,7 +290,7 @@ func (user *User) getSpaceRoom(ptr *id.RoomID, checked *bool, name, topic string
} else { } else {
*ptr = resp.RoomID *ptr = resp.RoomID
user.Update() user.Update()
user.ensureInvited(user.bridge.Bot, *ptr, false) user.ensureInvited(nil, *ptr, false)
if parent != "" { if parent != "" {
_, err = user.bridge.Bot.SendStateEvent(parent, event.StateSpaceChild, resp.RoomID.String(), &event.SpaceChildEventContent{ _, err = user.bridge.Bot.SendStateEvent(parent, event.StateSpaceChild, resp.RoomID.String(), &event.SpaceChildEventContent{
@@ -303,7 +303,7 @@ func (user *User) getSpaceRoom(ptr *id.RoomID, checked *bool, name, topic string
} }
} }
} else if !*checked && !user.bridge.StateStore.IsInRoom(*ptr, user.MXID) { } else if !*checked && !user.bridge.StateStore.IsInRoom(*ptr, user.MXID) {
user.ensureInvited(user.bridge.Bot, *ptr, false) user.ensureInvited(nil, *ptr, false)
} }
*checked = true *checked = true