mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 03:22:24 -05:00
[feature] Use hidesToPublicFromUnauthedWeb and hidesCcPublicFromUnauthedWeb properties for web visibility of statuses (#4315)
This pull request implements two new properties on ActivityPub actors: `hidesToPublicFromUnauthedWeb` and `hidesCcPublicFromUnauthedWeb`. As documented, these properties allow actors to signal their preference for whether or not their posts should be hidden from unauthenticated web views (ie., web pages like the GtS frontend, web apps like the Mastodon frontend, web APIs like the Mastodon public timeline API, etc). This allows remote accounts to *opt in* to having their unlisted visibility posts shown in (for example) the replies section of the web view of a GtS thread. In future, we can also use these properties to determine whether we should show boosts of a remote actor's post on a GtS profile, and that sort of thing. In keeping with our stance around privacy by default, GtS assumes `true` for `hidesCcPublicFromUnauthedWeb` if the property is not set on a remote actor, ie., hide unlisted/unlocked posts by default. `hidesToPublicFromUnauthedWeb` is assumed to be `false` if the property is not set on a remote actor, ie., show public posts by default. ~~WIP as I still want to work on the documentation for this a bit.~~ New props are already in the namespace document: https://gotosocial.org/ns Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4315 Reviewed-by: kim <gruf@noreply.codeberg.org> Co-authored-by: tobi <tobi.smethurst@protonmail.com> Co-committed-by: tobi <tobi.smethurst@protonmail.com>
This commit is contained in:
parent
c8a4ce9a88
commit
dcfc9b7885
159 changed files with 10900 additions and 2918 deletions
|
|
@ -562,6 +562,48 @@ func SetManuallyApprovesFollowers(with WithManuallyApprovesFollowers, manuallyAp
|
|||
mafProp.Set(manuallyApprovesFollowers)
|
||||
}
|
||||
|
||||
// GetHidesToPublicFromUnauthedWeb returns the boolean contained in the hidesToPublicFromUnauthedWeb property of 'with'.
|
||||
//
|
||||
// Returns default 'false' if property unusable or not set.
|
||||
func GetHidesToPublicFromUnauthedWeb(with WithHidesToPublicFromUnauthedWeb) bool {
|
||||
hidesProp := with.GetGoToSocialHidesToPublicFromUnauthedWeb()
|
||||
if hidesProp == nil || !hidesProp.IsXMLSchemaBoolean() {
|
||||
return false
|
||||
}
|
||||
return hidesProp.Get()
|
||||
}
|
||||
|
||||
// SetHidesToPublicFromUnauthedWeb sets the given boolean on the hidesToPublicFromUnauthedWeb property of 'with'.
|
||||
func SetHidesToPublicFromUnauthedWeb(with WithHidesToPublicFromUnauthedWeb, hidesToPublicFromUnauthedWeb bool) {
|
||||
hidesProp := with.GetGoToSocialHidesToPublicFromUnauthedWeb()
|
||||
if hidesProp == nil {
|
||||
hidesProp = streams.NewGoToSocialHidesToPublicFromUnauthedWebProperty()
|
||||
with.SetGoToSocialHidesToPublicFromUnauthedWeb(hidesProp)
|
||||
}
|
||||
hidesProp.Set(hidesToPublicFromUnauthedWeb)
|
||||
}
|
||||
|
||||
// GetHidesCcPublicFromUnauthedWeb returns the boolean contained in the hidesCcPublicFromUnauthedWeb property of 'with'.
|
||||
//
|
||||
// Returns default 'true' if property unusable or not set.
|
||||
func GetHidesCcPublicFromUnauthedWeb(with WithHidesCcPublicFromUnauthedWeb) bool {
|
||||
hidesProp := with.GetGoToSocialHidesCcPublicFromUnauthedWeb()
|
||||
if hidesProp == nil || !hidesProp.IsXMLSchemaBoolean() {
|
||||
return true
|
||||
}
|
||||
return hidesProp.Get()
|
||||
}
|
||||
|
||||
// SetHidesCcPublicFromUnauthedWeb sets the given boolean on the hidesCcPublicFromUnauthedWeb property of 'with'.
|
||||
func SetHidesCcPublicFromUnauthedWeb(with WithHidesCcPublicFromUnauthedWeb, hidesCcPublicFromUnauthedWeb bool) {
|
||||
hidesProp := with.GetGoToSocialHidesCcPublicFromUnauthedWeb()
|
||||
if hidesProp == nil {
|
||||
hidesProp = streams.NewGoToSocialHidesCcPublicFromUnauthedWebProperty()
|
||||
with.SetGoToSocialHidesCcPublicFromUnauthedWeb(hidesProp)
|
||||
}
|
||||
hidesProp.Set(hidesCcPublicFromUnauthedWeb)
|
||||
}
|
||||
|
||||
// GetApprovedBy returns the URL contained in
|
||||
// the ApprovedBy property of 'with', if set.
|
||||
func GetApprovedBy(with WithApprovedBy) *url.URL {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue