mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-01 13:52:46 +00:00
Peeking updates (#1607)
* Add unpeek * Don't allow peeks into encrypted rooms * Fix send tests * Update consumers
This commit is contained in:
parent
2b03d24358
commit
be7d8595be
16 changed files with 300 additions and 2 deletions
|
@ -163,8 +163,7 @@ func (r *Peeker) performPeekRoomByID(
|
|||
// XXX: we should probably factor out history_visibility checks into a common utility method somewhere
|
||||
// which handles the default value etc.
|
||||
var worldReadable = false
|
||||
ev, _ := r.DB.GetStateEvent(ctx, roomID, "m.room.history_visibility", "")
|
||||
if ev != nil {
|
||||
if ev, _ := r.DB.GetStateEvent(ctx, roomID, "m.room.history_visibility", ""); ev != nil {
|
||||
content := map[string]string{}
|
||||
if err = json.Unmarshal(ev.Content(), &content); err != nil {
|
||||
util.GetLogger(ctx).WithError(err).Error("json.Unmarshal for history visibility failed")
|
||||
|
@ -182,6 +181,13 @@ func (r *Peeker) performPeekRoomByID(
|
|||
}
|
||||
}
|
||||
|
||||
if ev, _ := r.DB.GetStateEvent(ctx, roomID, "m.room.encryption", ""); ev != nil {
|
||||
return "", &api.PerformError{
|
||||
Code: api.PerformErrorNotAllowed,
|
||||
Msg: "Cannot peek into an encrypted room",
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: handle federated peeks
|
||||
|
||||
err = r.Inputer.WriteOutputEvents(roomID, []api.OutputEvent{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue