Send output event for purge

This commit is contained in:
Neil Alexander 2022-08-22 12:27:17 +01:00
parent 4c4de0dfc6
commit c45bf118a8
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -28,6 +28,7 @@ import (
"github.com/matrix-org/dendrite/roomserver/storage" "github.com/matrix-org/dendrite/roomserver/storage"
"github.com/matrix-org/dendrite/setup/config" "github.com/matrix-org/dendrite/setup/config"
"github.com/matrix-org/gomatrixserverlib" "github.com/matrix-org/gomatrixserverlib"
"github.com/sirupsen/logrus"
) )
type Admin struct { type Admin struct {
@ -245,6 +246,9 @@ func (r *Admin) PerformAdminPurgeRoom(
return nil return nil
} }
logrus.WithField("room_id", req.RoomID).Warn("Purging room from roomserver")
defer logrus.WithField("room_id", req.RoomID).Warn("Room purged from roomserver")
if err := r.DB.PurgeRoom(ctx, req.RoomID); err != nil { if err := r.DB.PurgeRoom(ctx, req.RoomID); err != nil {
res.Error = &api.PerformError{ res.Error = &api.PerformError{
Code: api.PerformErrorBadRequest, Code: api.PerformErrorBadRequest,
@ -253,5 +257,12 @@ func (r *Admin) PerformAdminPurgeRoom(
return nil return nil
} }
return nil return r.Inputer.OutputProducer.ProduceRoomEvents(req.RoomID, []api.OutputEvent{
{
Type: api.OutputTypePurgeRoom,
PurgeRoom: &api.OutputPurgeRoom{
RoomID: req.RoomID,
},
},
})
} }