Allow user to forget a room, even if they never were a member (#2166)

* Allow user to forget a room, even if they never were a member

* Return "M_UNKNOWN" as per the spec

Co-authored-by: kegsay <kegan@matrix.org>
This commit is contained in:
S7evinK 2022-02-10 11:05:37 +01:00 committed by GitHub
parent 2782ae3d56
commit 432c35a307
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,7 @@ package routing
import (
"context"
"errors"
"fmt"
"net/http"
"time"
@ -459,13 +460,7 @@ func SendForget(
if membershipRes.IsInRoom {
return util.JSONResponse{
Code: http.StatusBadRequest,
JSON: jsonerror.Forbidden("user is still a member of the room"),
}
}
if !membershipRes.HasBeenInRoom {
return util.JSONResponse{
Code: http.StatusBadRequest,
JSON: jsonerror.Forbidden("user did not belong to room"),
JSON: jsonerror.Unknown(fmt.Sprintf("User %s is in room %s", device.UserID, roomID)),
}
}