Fix readability issues
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
fe43990226
commit
91c7d7914b
6 changed files with 9 additions and 9 deletions
|
@ -10,9 +10,9 @@ defmodule Pleroma.Hashtag do
|
||||||
|
|
||||||
alias Ecto.Multi
|
alias Ecto.Multi
|
||||||
alias Pleroma.Hashtag
|
alias Pleroma.Hashtag
|
||||||
alias Pleroma.User.HashtagFollow
|
|
||||||
alias Pleroma.Object
|
alias Pleroma.Object
|
||||||
alias Pleroma.Repo
|
alias Pleroma.Repo
|
||||||
|
alias Pleroma.User.HashtagFollow
|
||||||
|
|
||||||
schema "hashtags" do
|
schema "hashtags" do
|
||||||
field(:name, :string)
|
field(:name, :string)
|
||||||
|
|
|
@ -21,7 +21,6 @@ defmodule Pleroma.User do
|
||||||
alias Pleroma.FollowingRelationship
|
alias Pleroma.FollowingRelationship
|
||||||
alias Pleroma.Formatter
|
alias Pleroma.Formatter
|
||||||
alias Pleroma.Hashtag
|
alias Pleroma.Hashtag
|
||||||
alias Pleroma.User.HashtagFollow
|
|
||||||
alias Pleroma.HTML
|
alias Pleroma.HTML
|
||||||
alias Pleroma.Keys
|
alias Pleroma.Keys
|
||||||
alias Pleroma.MFA
|
alias Pleroma.MFA
|
||||||
|
@ -31,6 +30,7 @@ defmodule Pleroma.User do
|
||||||
alias Pleroma.Repo
|
alias Pleroma.Repo
|
||||||
alias Pleroma.User
|
alias Pleroma.User
|
||||||
alias Pleroma.UserRelationship
|
alias Pleroma.UserRelationship
|
||||||
|
alias Pleroma.User.HashtagFollow
|
||||||
alias Pleroma.Web.ActivityPub.ActivityPub
|
alias Pleroma.Web.ActivityPub.ActivityPub
|
||||||
alias Pleroma.Web.ActivityPub.Builder
|
alias Pleroma.Web.ActivityPub.Builder
|
||||||
alias Pleroma.Web.ActivityPub.Pipeline
|
alias Pleroma.Web.ActivityPub.Pipeline
|
||||||
|
@ -1167,7 +1167,7 @@ def needs_update?(_), do: true
|
||||||
# "Locked" (self-locked) users demand explicit authorization of follow requests
|
# "Locked" (self-locked) users demand explicit authorization of follow requests
|
||||||
@spec can_direct_follow_local(User.t(), User.t()) :: true | false
|
@spec can_direct_follow_local(User.t(), User.t()) :: true | false
|
||||||
def can_direct_follow_local(%User{} = follower, %User{local: true} = followed) do
|
def can_direct_follow_local(%User{} = follower, %User{local: true} = followed) do
|
||||||
!followed.is_locked || (followed.permit_followback and is_friend_of(follower, followed))
|
!followed.is_locked || (followed.permit_followback and friend_of?(follower, followed))
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec maybe_direct_follow(User.t(), User.t()) ::
|
@spec maybe_direct_follow(User.t(), User.t()) ::
|
||||||
|
@ -1552,7 +1552,7 @@ def get_familiar_followers(%User{} = user, %User{} = current_user, page \\ nil)
|
||||||
|> Repo.all()
|
|> Repo.all()
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_friend_of(%User{} = potential_friend, %User{local: true} = user) do
|
def friend_of?(%User{} = potential_friend, %User{local: true} = user) do
|
||||||
user
|
user
|
||||||
|> get_friends_query()
|
|> get_friends_query()
|
||||||
|> where(id: ^potential_friend.id)
|
|> where(id: ^potential_friend.id)
|
||||||
|
|
|
@ -3,9 +3,9 @@ defmodule Pleroma.User.HashtagFollow do
|
||||||
import Ecto.Query
|
import Ecto.Query
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
|
|
||||||
alias Pleroma.User
|
|
||||||
alias Pleroma.Hashtag
|
alias Pleroma.Hashtag
|
||||||
alias Pleroma.Repo
|
alias Pleroma.Repo
|
||||||
|
alias Pleroma.User
|
||||||
|
|
||||||
schema "user_follows_hashtag" do
|
schema "user_follows_hashtag" do
|
||||||
belongs_to(:user, User, type: FlakeId.Ecto.CompatType)
|
belongs_to(:user, User, type: FlakeId.Ecto.CompatType)
|
||||||
|
|
|
@ -13,7 +13,7 @@ def open_api_operation(action) do
|
||||||
end
|
end
|
||||||
|
|
||||||
# Adapted from https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/pleroma/web/api_spec/operations/translate_operation.ex
|
# Adapted from https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/pleroma/web/api_spec/operations/translate_operation.ex
|
||||||
def translation_languages_operation() do
|
def translation_languages_operation do
|
||||||
%Operation{
|
%Operation{
|
||||||
tags: ["Akkoma compatibility routes"],
|
tags: ["Akkoma compatibility routes"],
|
||||||
summary: "Get translation languages",
|
summary: "Get translation languages",
|
||||||
|
@ -54,7 +54,7 @@ defp languages_schema do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def translate_operation() do
|
def translate_operation do
|
||||||
%Operation{
|
%Operation{
|
||||||
tags: ["Akkoma compatibility routes"],
|
tags: ["Akkoma compatibility routes"],
|
||||||
summary: "Translate status",
|
summary: "Translate status",
|
||||||
|
|
|
@ -8,10 +8,10 @@ defmodule Pleroma.Web.MastodonAPI.FollowRequestController do
|
||||||
import Pleroma.Web.ControllerHelper,
|
import Pleroma.Web.ControllerHelper,
|
||||||
only: [add_link_headers: 2]
|
only: [add_link_headers: 2]
|
||||||
|
|
||||||
|
alias Pleroma.Pagination
|
||||||
alias Pleroma.User
|
alias Pleroma.User
|
||||||
alias Pleroma.Web.CommonAPI
|
alias Pleroma.Web.CommonAPI
|
||||||
alias Pleroma.Web.Plugs.OAuthScopesPlug
|
alias Pleroma.Web.Plugs.OAuthScopesPlug
|
||||||
alias Pleroma.Pagination
|
|
||||||
|
|
||||||
plug(Pleroma.Web.ApiSpec.CastAndValidate, replace_params: false)
|
plug(Pleroma.Web.ApiSpec.CastAndValidate, replace_params: false)
|
||||||
plug(:assign_follower when action != :index)
|
plug(:assign_follower when action != :index)
|
||||||
|
|
|
@ -2,9 +2,9 @@ defmodule Pleroma.Web.MastodonAPI.TagController do
|
||||||
@moduledoc "Hashtag routes for mastodon API"
|
@moduledoc "Hashtag routes for mastodon API"
|
||||||
use Pleroma.Web, :controller
|
use Pleroma.Web, :controller
|
||||||
|
|
||||||
alias Pleroma.User
|
|
||||||
alias Pleroma.Hashtag
|
alias Pleroma.Hashtag
|
||||||
alias Pleroma.Pagination
|
alias Pleroma.Pagination
|
||||||
|
alias Pleroma.User
|
||||||
|
|
||||||
import Pleroma.Web.ControllerHelper,
|
import Pleroma.Web.ControllerHelper,
|
||||||
only: [
|
only: [
|
||||||
|
|
Loading…
Reference in a new issue