X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fbookmark.ex;h=d976f949c4f549cae5be55bf43eb05470cab70f9;hb=209395c7e60afe7115f22afd6936d9c6bdd7bb72;hp=c5c3e078b67cfd055b25b8d0b5a5894eb382db11;hpb=002ea343f8c6dc9669bce91942f835a2c7cc6ae7;p=akkoma diff --git a/lib/pleroma/bookmark.ex b/lib/pleroma/bookmark.ex index c5c3e078b..d976f949c 100644 --- a/lib/pleroma/bookmark.ex +++ b/lib/pleroma/bookmark.ex @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2019 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Bookmark do use Ecto.Schema @@ -41,6 +45,13 @@ defmodule Pleroma.Bookmark do |> preload([b, a], activity: a) end + def get(user_id, activity_id) do + Bookmark + |> where(user_id: ^user_id) + |> where(activity_id: ^activity_id) + |> Repo.one() + end + @spec destroy(FlakeId.t(), FlakeId.t()) :: {:ok, Bookmark.t()} | {:error, Changeset.t()} def destroy(user_id, activity_id) do from(b in Bookmark,