mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-11-05 03:48:52 +01:00
Fix admin room processing commands from its own messages
This commit is contained in:
parent
0cec421930
commit
31918bb990
1 changed files with 12 additions and 11 deletions
|
@ -1477,17 +1477,18 @@ impl Rooms {
|
||||||
|
|
||||||
self.tokenids.insert_batch(&mut batch)?;
|
self.tokenids.insert_batch(&mut batch)?;
|
||||||
|
|
||||||
if body.starts_with(&format!("@conduit:{}: ", db.globals.server_name()))
|
let admin_room = self.id_from_alias(
|
||||||
&& self
|
<&RoomAliasId>::try_from(
|
||||||
.id_from_alias(
|
format!("#admins:{}", db.globals.server_name()).as_str(),
|
||||||
<&RoomAliasId>::try_from(
|
)
|
||||||
format!("#admins:{}", db.globals.server_name()).as_str(),
|
.expect("#admins:server_name is a valid room alias"),
|
||||||
)
|
)?;
|
||||||
.expect("#admins:server_name is a valid room alias"),
|
let server_user = format!("@conduit:{}", db.globals.server_name());
|
||||||
)?
|
|
||||||
.as_ref()
|
let to_conduit = body.starts_with(&format!("{}: ", server_user));
|
||||||
== Some(&pdu.room_id)
|
let from_conduit = pdu.sender == server_user;
|
||||||
{
|
|
||||||
|
if to_conduit && !from_conduit && admin_room.as_ref() == Some(&pdu.room_id) {
|
||||||
db.admin.process_message(body.to_string());
|
db.admin.process_message(body.to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue