constants: add as_public constant and use it everywhere
This commit is contained in:
parent
9d78b3b281
commit
b93498eb52
26 changed files with 104 additions and 89 deletions
|
|
@ -9,6 +9,7 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenter do
|
|||
alias Pleroma.Web.OStatus.UserRepresenter
|
||||
|
||||
require Logger
|
||||
require Pleroma.Constants
|
||||
|
||||
defp get_href(id) do
|
||||
with %Object{data: %{"external_url" => external_url}} <- Object.get_cached_by_ap_id(id) do
|
||||
|
|
@ -34,7 +35,7 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenter do
|
|||
Enum.map(to, fn id ->
|
||||
cond do
|
||||
# Special handling for the AP/Ostatus public collections
|
||||
"https://www.w3.org/ns/activitystreams#Public" == id ->
|
||||
Pleroma.Constants.as_public() == id ->
|
||||
{:link,
|
||||
[
|
||||
rel: "mentioned",
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
defmodule Pleroma.Web.OStatus.NoteHandler do
|
||||
require Logger
|
||||
require Pleroma.Constants
|
||||
|
||||
alias Pleroma.Activity
|
||||
alias Pleroma.Object
|
||||
|
|
@ -49,7 +50,7 @@ defmodule Pleroma.Web.OStatus.NoteHandler do
|
|||
def get_collection_mentions(entry) do
|
||||
transmogrify = fn
|
||||
"http://activityschema.org/collection/public" ->
|
||||
"https://www.w3.org/ns/activitystreams#Public"
|
||||
Pleroma.Constants.as_public()
|
||||
|
||||
group ->
|
||||
group
|
||||
|
|
@ -126,7 +127,7 @@ defmodule Pleroma.Web.OStatus.NoteHandler do
|
|||
to <- make_to_list(actor, mentions),
|
||||
date <- XML.string_from_xpath("//published", entry),
|
||||
unlisted <- XML.string_from_xpath("//mastodon:scope", entry) == "unlisted",
|
||||
cc <- if(unlisted, do: ["https://www.w3.org/ns/activitystreams#Public"], else: []),
|
||||
cc <- if(unlisted, do: [Pleroma.Constants.as_public()], else: []),
|
||||
note <-
|
||||
CommonAPI.Utils.make_note_data(
|
||||
actor.ap_id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue