Fix readability issues

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2024-10-03 20:59:56 +02:00
parent fe43990226
commit 91c7d7914b
6 changed files with 9 additions and 9 deletions

View file

@ -10,9 +10,9 @@ defmodule Pleroma.Hashtag do
alias Ecto.Multi
alias Pleroma.Hashtag
alias Pleroma.User.HashtagFollow
alias Pleroma.Object
alias Pleroma.Repo
alias Pleroma.User.HashtagFollow
schema "hashtags" do
field(:name, :string)

View file

@ -21,7 +21,6 @@ defmodule Pleroma.User do
alias Pleroma.FollowingRelationship
alias Pleroma.Formatter
alias Pleroma.Hashtag
alias Pleroma.User.HashtagFollow
alias Pleroma.HTML
alias Pleroma.Keys
alias Pleroma.MFA
@ -31,6 +30,7 @@ defmodule Pleroma.User do
alias Pleroma.Repo
alias Pleroma.User
alias Pleroma.UserRelationship
alias Pleroma.User.HashtagFollow
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.Builder
alias Pleroma.Web.ActivityPub.Pipeline
@ -1167,7 +1167,7 @@ def needs_update?(_), do: true
# "Locked" (self-locked) users demand explicit authorization of follow requests
@spec can_direct_follow_local(User.t(), User.t()) :: true | false
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
@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()
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
|> get_friends_query()
|> where(id: ^potential_friend.id)

View file

@ -3,9 +3,9 @@ defmodule Pleroma.User.HashtagFollow do
import Ecto.Query
import Ecto.Changeset
alias Pleroma.User
alias Pleroma.Hashtag
alias Pleroma.Repo
alias Pleroma.User
schema "user_follows_hashtag" do
belongs_to(:user, User, type: FlakeId.Ecto.CompatType)

View file

@ -13,7 +13,7 @@ def open_api_operation(action) do
end
# 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{
tags: ["Akkoma compatibility routes"],
summary: "Get translation languages",
@ -54,7 +54,7 @@ defp languages_schema do
}
end
def translate_operation() do
def translate_operation do
%Operation{
tags: ["Akkoma compatibility routes"],
summary: "Translate status",

View file

@ -8,10 +8,10 @@ defmodule Pleroma.Web.MastodonAPI.FollowRequestController do
import Pleroma.Web.ControllerHelper,
only: [add_link_headers: 2]
alias Pleroma.Pagination
alias Pleroma.User
alias Pleroma.Web.CommonAPI
alias Pleroma.Web.Plugs.OAuthScopesPlug
alias Pleroma.Pagination
plug(Pleroma.Web.ApiSpec.CastAndValidate, replace_params: false)
plug(:assign_follower when action != :index)

View file

@ -2,9 +2,9 @@ defmodule Pleroma.Web.MastodonAPI.TagController do
@moduledoc "Hashtag routes for mastodon API"
use Pleroma.Web, :controller
alias Pleroma.User
alias Pleroma.Hashtag
alias Pleroma.Pagination
alias Pleroma.User
import Pleroma.Web.ControllerHelper,
only: [