mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 02:02:38 +01:00
modules/m_room_redaction: Make redacts target room check an auth rule.
This commit is contained in:
parent
100f5c646a
commit
09b52a2e65
1 changed files with 20 additions and 6 deletions
|
@ -76,6 +76,26 @@ ircd::m::auth_room_redaction(const m::event &event,
|
|||
m::index(at<"redacts"_>(event), std::nothrow)
|
||||
};
|
||||
|
||||
if(!redact_target_idx)
|
||||
throw FAIL
|
||||
{
|
||||
"m.room.redaction redacts target is unknown."
|
||||
};
|
||||
|
||||
const auto target_in_room
|
||||
{
|
||||
[&event](const string_view &room_id)
|
||||
{
|
||||
return room_id == at<"room_id"_>(event);
|
||||
}
|
||||
};
|
||||
|
||||
if(!m::query(std::nothrow, redact_target_idx, "room_id", target_in_room))
|
||||
throw FAIL
|
||||
{
|
||||
"m.room.redaction redacts target is not in room."
|
||||
};
|
||||
|
||||
const auto sender_domain_match
|
||||
{
|
||||
[&event](const string_view &tgt)
|
||||
|
@ -84,12 +104,6 @@ ircd::m::auth_room_redaction(const m::event &event,
|
|||
}
|
||||
};
|
||||
|
||||
if(!redact_target_idx)
|
||||
throw FAIL
|
||||
{
|
||||
"m.room.redaction redacts target is unknown."
|
||||
};
|
||||
|
||||
if(m::query(std::nothrow, redact_target_idx, "redacts", sender_domain_match))
|
||||
{
|
||||
data.allow = true;
|
||||
|
|
Loading…
Reference in a new issue