chadtmiller.com/group-host
atmosphere group host
0
0
Show someone asking to join only a group that is switched on
crates/group-host/src/actors.rs+3−2
| @@ -74,9 +74,10 @@ impl Host { | ||
} | ||
| ||
impl Store { | ||
/// Whether `did` is asking to join any group here. | ||
/// Whether `did` is asking to join any group here that is switched on. | ||
pub fn asking_anywhere(&self, did: &str) -> anyhow::Result<bool> { | ||
let sql = "SELECT 1 FROM join_request WHERE did = ?1 LIMIT 1"; | ||
let sql = "SELECT 1 FROM join_request j WHERE j.did = ?1 | ||
AND NOT EXISTS (SELECT 1 FROM deactivation d WHERE d.did = j.grp) LIMIT 1"; | ||
let found = self.conn().query_row(sql, [did], |_| Ok(())); | ||
Ok(rusqlite::OptionalExtension::optional(found)?.is_some()) | ||
} | ||
crates/group-host/tests/actors.rs+4−0
| @@ -247,6 +247,10 @@ async fn names_a_person_the_host_shows() { | ||
assert_eq!(view["did"], who.did.as_str()); | ||
assert!(view.get("canCreateGroup").is_none()); | ||
} | ||
// Asking to join a group switched off is asking nowhere it shows. | ||
h.host.deactivate_account(&group, &alice.did, &[]).unwrap(); | ||
let said = actor(&alice, &carol.did).await; | ||
assert_eq!(said.1["error"], "ActorNotFound"); | ||
let said = get(&h, &lxm, &format!("actor={}", bob.did), &[]).await; | ||
assert_eq!(said.0, 401); | ||
| ||
docs/design/groups.md+1−1
| @@ -63,7 +63,7 @@ group for someone or lets them read it themselves. | ||
- `fyi.opensocial.getActor` names a person, by their DID, as their DID | ||
document does, for someone signed in: themselves (with whether the host | ||
starts groups for them), or anyone the host shows, a member of one of | ||
its groups or someone asking to join one; no one else. | ||
its groups or someone asking to join one, switched on; no one else. | ||
| ||
## Changing its face | ||