Slightly better wording

This commit is contained in:
Kegan Dougal 2020-07-03 17:24:35 +01:00
parent 6292df9c80
commit b6f07431b6

View file

@ -74,14 +74,16 @@ func SendRedaction(
if plEvent == nil { if plEvent == nil {
return util.JSONResponse{ return util.JSONResponse{
Code: 403, Code: 403,
JSON: jsonerror.Forbidden("cannot redact event, missing pl event"), JSON: jsonerror.Forbidden("You don't have permission to redact this event, no power_levels event in this room."),
} }
} }
pl, err := plEvent.PowerLevels() pl, err := plEvent.PowerLevels()
if err != nil { if err != nil {
return util.JSONResponse{ return util.JSONResponse{
Code: 403, Code: 403,
JSON: jsonerror.Forbidden("cannot redact event, malformed pl event"), JSON: jsonerror.Forbidden(
"You don't have permission to redact this event, the power_levels event for this room is malformed so auth checks cannot be performed.",
),
} }
} }
allowedToRedact = pl.UserLevel(device.UserID) >= pl.Redact allowedToRedact = pl.UserLevel(device.UserID) >= pl.Redact
@ -89,7 +91,7 @@ func SendRedaction(
if !allowedToRedact { if !allowedToRedact {
return util.JSONResponse{ return util.JSONResponse{
Code: 403, Code: 403,
JSON: jsonerror.Forbidden("cannot redact event"), JSON: jsonerror.Forbidden("You don't have permission to redact this event, power level too low."),
} }
} }