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
|
|
@ -15,6 +15,8 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
|
|||
|
||||
import Ecto.Query
|
||||
|
||||
require Pleroma.Constants
|
||||
|
||||
def create_status(%User{} = user, %{"status" => _} = data) do
|
||||
CommonAPI.post(user, data)
|
||||
end
|
||||
|
|
@ -286,7 +288,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
|
|||
from(
|
||||
[a, o] in Activity.with_preloaded_object(Activity),
|
||||
where: fragment("?->>'type' = 'Create'", a.data),
|
||||
where: "https://www.w3.org/ns/activitystreams#Public" in a.recipients,
|
||||
where: ^Pleroma.Constants.as_public() in a.recipients,
|
||||
where:
|
||||
fragment(
|
||||
"to_tsvector('english', ?->>'content') @@ plainto_tsquery('english', ?)",
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ defmodule Pleroma.Web.TwitterAPI.ActivityView do
|
|||
|
||||
import Ecto.Query
|
||||
require Logger
|
||||
require Pleroma.Constants
|
||||
|
||||
defp query_context_ids([]), do: []
|
||||
|
||||
|
|
@ -91,7 +92,7 @@ defmodule Pleroma.Web.TwitterAPI.ActivityView do
|
|||
String.ends_with?(ap_id, "/followers") ->
|
||||
nil
|
||||
|
||||
ap_id == "https://www.w3.org/ns/activitystreams#Public" ->
|
||||
ap_id == Pleroma.Constants.as_public() ->
|
||||
nil
|
||||
|
||||
user = User.get_cached_by_ap_id(ap_id) ->
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ defmodule Pleroma.Web.TwitterAPI.NotificationView do
|
|||
alias Pleroma.Web.TwitterAPI.ActivityView
|
||||
alias Pleroma.Web.TwitterAPI.UserView
|
||||
|
||||
require Pleroma.Constants
|
||||
|
||||
defp get_user(ap_id, opts) do
|
||||
cond do
|
||||
user = opts[:users][ap_id] ->
|
||||
|
|
@ -18,7 +20,7 @@ defmodule Pleroma.Web.TwitterAPI.NotificationView do
|
|||
String.ends_with?(ap_id, "/followers") ->
|
||||
nil
|
||||
|
||||
ap_id == "https://www.w3.org/ns/activitystreams#Public" ->
|
||||
ap_id == Pleroma.Constants.as_public() ->
|
||||
nil
|
||||
|
||||
true ->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue