X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Flist.ex;h=110be8355985f2d628160bd36ce43114765620ca;hb=8f93d4c42366ccce1949717ad2a9e1de0f91011b;hp=891c73f5a7ede5a8dc521cc5846c33998bba6ea0;hpb=fe2759bc9f2dad044b49f4954693ac09f9368041;p=akkoma diff --git a/lib/pleroma/list.ex b/lib/pleroma/list.ex index 891c73f5a..110be8355 100644 --- a/lib/pleroma/list.ex +++ b/lib/pleroma/list.ex @@ -1,10 +1,19 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2019 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.List do use Ecto.Schema - import Ecto.{Changeset, Query} - alias Pleroma.{User, Repo, Activity} + + import Ecto.Query + import Ecto.Changeset + + alias Pleroma.Activity + alias Pleroma.Repo + alias Pleroma.User schema "lists" do - belongs_to(:user, Pleroma.User) + belongs_to(:user, User, type: Pleroma.FlakeId) field(:title, :string) field(:following, {:array, :string}, default: []) @@ -23,7 +32,7 @@ defmodule Pleroma.List do |> validate_required([:following]) end - def for_user(user, opts) do + def for_user(user, _opts) do query = from( l in Pleroma.List, @@ -46,7 +55,7 @@ defmodule Pleroma.List do Repo.one(query) end - def get_following(%Pleroma.List{following: following} = list) do + def get_following(%Pleroma.List{following: following} = _list) do q = from( u in User, @@ -71,7 +80,7 @@ defmodule Pleroma.List do # Get lists to which the account belongs. def get_lists_account_belongs(%User{} = owner, account_id) do - user = Repo.get(User, account_id) + user = User.get_by_id(account_id) query = from(