~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

A group's site goes when its profile is replaced without one

Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:host/profile-site
crates/group-host/src/group_config.rs+3−9
@@ -203,15 +203,9 @@ pub async fn update_profile(
if let Some(d) = text("description") {
profile["description"] = json!(d);
}
// The site is kept, like the images: an edit of the name says nothing
// of it.
match text("url") {
Some(url) => profile["url"] = json!(url),
None => {
if let Some(url) = current.get("url") {
profile["url"] = url.clone();
}
}
// The site is replaced, as the description is: left out, it goes.
if let Some(url) = text("url") {
profile["url"] = json!(url);
}
if let Some(place) = body.get("location").filter(|l| !l.is_null()) {
let kind = place["$type"].as_str().unwrap_or_default();
crates/group-host/tests/group_config.rs+3−3
@@ -121,8 +121,8 @@ async fn an_admin_changes_the_profile() {
assert_eq!(p["createdAt"], created);
assert_eq!(put["cid"].as_str().map(str::len), Some(59));
// A replace: what finds it, left out, is none; the images and site
// are kept; a policy named is taken.
// A replace: what finds it and its site, left out, are none; the
// images are kept; a policy named is taken.
let (status, _) = call(
&h,
&alice,
@@ -135,7 +135,7 @@ async fn an_admin_changes_the_profile() {
assert_eq!(p.get("topics"), None);
assert_eq!(p.get("location"), None);
assert_eq!(p.get("description"), None);
assert_eq!(p["url"], "https://riders.example");
assert_eq!(p.get("url"), None);
assert_eq!(p["avatar"]["ref"], avatar["ref"]);
assert_eq!(p["joinPolicy"], "invite");
// And `null` clears an image.
docs/design/groups.md+2−2
@@ -135,8 +135,8 @@ anyone whose roles hold `group.configure`. `updateProfile`, `uploadImage`,
switched-off group.
`updateProfile` replaces the profile. A display name is required. The
description, location, online flag, topics and languages are as given,
and removed when left out. The join policy, site, avatar and banner are
description, site, location, online flag, topics and languages are as
given, and removed when left out. The join policy, avatar and banner are
kept when left out; `null` clears an avatar or banner.
A picture must be a blob in the group's own repo, because a blob in
lexicons/fyi/opensocial/updateProfile.json+1−1
@@ -40,7 +40,7 @@
"url": {
"type": "string",
"format": "uri",
"description": "The group's own site."
"description": "The group's own site; left out, it is taken off."
},
"location": {
"type": "union",