Support "as:Public" audience identifier
This commit is contained in:
parent
5c2685c785
commit
cbc78f9532
2 changed files with 7 additions and 6 deletions
|
@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
- Added `/api/v1/settings/import_follows` API endpoint.
|
||||
- Validation of Monero subscription payout address.
|
||||
- Accept webfinger requests where `resource` is actor ID.
|
||||
- Adeed support for `as:Public` audience identifier.
|
||||
|
||||
### Removed
|
||||
|
||||
|
|
|
@ -103,23 +103,23 @@ fn get_note_visibility(
|
|||
primary_audience: Vec<String>,
|
||||
secondary_audience: Vec<String>,
|
||||
) -> Visibility {
|
||||
if primary_audience.contains(&AP_PUBLIC.to_string()) ||
|
||||
secondary_audience.contains(&AP_PUBLIC.to_string()) {
|
||||
let audience = [primary_audience, secondary_audience].concat();
|
||||
// Some servers (e.g. Takahe) use "as" namespace
|
||||
const PUBLIC_VARIANTS: [&str; 2] = [AP_PUBLIC, "as:Public"];
|
||||
if audience.iter().any(|item| PUBLIC_VARIANTS.contains(&item.as_str())) {
|
||||
return Visibility::Public;
|
||||
};
|
||||
let maybe_followers = author.actor_json.as_ref()
|
||||
.and_then(|actor| actor.followers.as_ref());
|
||||
if let Some(followers) = maybe_followers {
|
||||
if primary_audience.contains(followers) ||
|
||||
secondary_audience.contains(followers) {
|
||||
if audience.contains(followers) {
|
||||
return Visibility::Followers;
|
||||
};
|
||||
};
|
||||
let maybe_subscribers = author.actor_json.as_ref()
|
||||
.and_then(|actor| actor.subscribers.as_ref());
|
||||
if let Some(subscribers) = maybe_subscribers {
|
||||
if primary_audience.contains(subscribers) ||
|
||||
secondary_audience.contains(subscribers) {
|
||||
if audience.contains(subscribers) {
|
||||
return Visibility::Subscribers;
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue