Skip to content

Commit

Permalink
botmanagement: save management rooms to database
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Sep 14, 2024
1 parent 363c69b commit 4d17c3d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/meowlnir/botmanagement.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,12 @@ func (m *Meowlnir) PutManagementRoom(w http.ResponseWriter, r *http.Request) {
mautrix.MNotFound.WithMessage("Bot not found").Write(w)
return
}
err = m.DB.ManagementRoom.Put(r.Context(), id.RoomID(r.PathValue("roomID")), bot.Meta.Username)
if err != nil {
hlog.FromRequest(r).Err(err).Msg("Failed to save management room to database")
mautrix.MUnknown.WithMessage("Failed to save management room to database").Write(w)
return
}
didUpdate := m.loadManagementRoom(r.Context(), id.RoomID(r.PathValue("roomID")), bot)
if didUpdate {
exhttp.WriteEmptyJSONResponse(w, http.StatusCreated)
Expand Down

0 comments on commit 4d17c3d

Please sign in to comment.