Skip to content

Commit

Permalink
Fix readability issues
Browse files Browse the repository at this point in the history
Signed-off-by: marcin mikołajczak <[email protected]>
  • Loading branch information
mkljczk committed Oct 3, 2024
1 parent fe43990 commit 91c7d79
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/pleroma/hashtag.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions lib/pleroma/user.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -1167,7 +1167,7 @@ defmodule Pleroma.User do
# "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()) ::
Expand Down Expand Up @@ -1552,7 +1552,7 @@ defmodule Pleroma.User do
|> 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)
Expand Down
2 changes: 1 addition & 1 deletion lib/pleroma/user/hashtag_follow.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ defmodule Pleroma.Web.ApiSpec.AkkomaCompatOperation 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",
Expand Down Expand Up @@ -54,7 +54,7 @@ defmodule Pleroma.Web.ApiSpec.AkkomaCompatOperation do
}
end

def translate_operation() do
def translate_operation do
%Operation{
tags: ["Akkoma compatibility routes"],
summary: "Translate status",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/pleroma/web/mastodon_api/controllers/tag_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down

0 comments on commit 91c7d79

Please sign in to comment.