mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
fix(room_member): Strip join_authorized_via_users_server (#1542)
Realized code for fix did in fact require a check for `join_authorized_via_users_server` before stripping. Otherwise, waste processing power, most of the time. Signed-off-by: Jonathan Sutton <jonathansutton91@proton.me>
This commit is contained in:
committed by
Ellis Git
parent
dab50b1ec3
commit
b9854662f3
+16
-13
@@ -376,21 +376,24 @@ async fn allowed_to_send_state_event(
|
|||||||
)));
|
)));
|
||||||
};
|
};
|
||||||
|
|
||||||
// join_authorized_via_users_server must be thrown away, if user is already a
|
if let Some(authorising_user) =
|
||||||
// member of the room.
|
|
||||||
if services
|
|
||||||
.rooms
|
|
||||||
.state_cache
|
|
||||||
.is_joined(state_key, room_id)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
membership_content.join_authorized_via_users_server = None;
|
|
||||||
*json = Raw::<AnyStateEventContent>::from_json_string(
|
|
||||||
serde_json::to_string(&membership_content)?,
|
|
||||||
)?;
|
|
||||||
} else if let Some(authorising_user) =
|
|
||||||
membership_content.join_authorized_via_users_server
|
membership_content.join_authorized_via_users_server
|
||||||
{
|
{
|
||||||
|
// join_authorized_via_users_server must be thrown away, if user is already a
|
||||||
|
// member of the room.
|
||||||
|
if services
|
||||||
|
.rooms
|
||||||
|
.state_cache
|
||||||
|
.is_joined(state_key, room_id)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
membership_content.join_authorized_via_users_server = None;
|
||||||
|
*json = Raw::<AnyStateEventContent>::from_json_string(
|
||||||
|
serde_json::to_string(&membership_content)?,
|
||||||
|
)?;
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
if membership_content.membership != MembershipState::Join {
|
if membership_content.membership != MembershipState::Join {
|
||||||
return Err!(Request(BadJson(
|
return Err!(Request(BadJson(
|
||||||
"join_authorised_via_users_server is only for member joins"
|
"join_authorised_via_users_server is only for member joins"
|
||||||
|
|||||||
Reference in New Issue
Block a user