Skip to content

policyeval/commands: Fall back to continuwuityadmin when blocking rooms#52

Open
timedoutuk wants to merge 3 commits into
mainfrom
nexy7574/c10y-room-blocking
Open

policyeval/commands: Fall back to continuwuityadmin when blocking rooms#52
timedoutuk wants to merge 3 commits into
mainfrom
nexy7574/c10y-room-blocking

Conversation

@timedoutuk

Copy link
Copy Markdown
Collaborator

Depends on mautrix/go#452

Falls back to continuwuity's admin API when using the synapse admin API fails (it should return M_UNRECOGNIZED for unknown routes). I also considered just specifying a software in the config but that feels hacky.

Ideally MSC4390: Room Blocking API will allow for this to be removed and unified in the future.

Comment thread policyeval/commands.go
resp, err := ce.Meta.Bot.SynapseAdmin.DeleteRoomSync(ce.Ctx, roomID, req)
_, _ = ce.Meta.Bot.RedactEvent(ce.Ctx, ce.RoomID, reactionID)
if err != nil {
if errors.Is(err, mautrix.MUnrecognized) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be moved 2 lines up (between DeleteRoomSync and RedactEvent). errors.Is is fine with nil errors being passed so no need to gate the check. The response/error handling can also be shared (no need for a custom reply)

Comment thread policyeval/commands.go
}

func formatDeleteResult(resp synapseadmin.RespDeleteRoomResult) string {
func formatDeleteResult(kicked, failed []id.UserID, aliases []id.RoomAlias) string {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes can be undone after mautrix/go#452 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants