mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 08:12:37 +01:00
modules/client/sync/rooms: Assertions for membership query on membership event.
This commit is contained in:
parent
1209705b04
commit
45409428e6
1 changed files with 19 additions and 1 deletions
|
@ -59,7 +59,8 @@ ircd::m::sync::rooms_linear(data &data)
|
|||
{
|
||||
json::get<"room_id"_>(*data.event)?
|
||||
m::membership(membuf, room, data.user):
|
||||
string_view{}
|
||||
|
||||
string_view{}
|
||||
};
|
||||
|
||||
const scope_restore their_membership
|
||||
|
@ -67,6 +68,23 @@ ircd::m::sync::rooms_linear(data &data)
|
|||
data.membership, membership
|
||||
};
|
||||
|
||||
const bool is_own_membership
|
||||
{
|
||||
json::get<"room_id"_>(*data.event)
|
||||
&& json::get<"type"_>(*data.event) == "m.room.member"
|
||||
&& json::get<"state_key"_>(*data.event) == data.user.user_id
|
||||
};
|
||||
|
||||
const bool is_own_join
|
||||
{
|
||||
is_own_membership
|
||||
&& membership == "join"
|
||||
};
|
||||
|
||||
//assert(!is_own_join || m::membership(*data.event) == "join");
|
||||
assert(!is_own_join || !!m::membership(membuf, room, data.user));
|
||||
assert(is_own_join || !json::get<"room_id"_>(*data.event) || m::exists(room));
|
||||
|
||||
if(should_ignore(data))
|
||||
return false;
|
||||
|
||||
|
|
Loading…
Reference in a new issue