Somehow fixed the repo insert [skip-ci]
[akkoma] / lib / pleroma / web / thread_mute.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.ThreadMute do
6 use Ecto.Schema
7
8 alias Pleroma.{Activity, Notification, User, Repo}
9
10 schema "thread_mutes" do
11 belongs_to(:user, User, type: Pleroma.FlakeId)
12 field(:context, :string)
13 end
14
15 def add_mute(user, id) do
16 %{data: %{"context" => context}} = Activity.get_by_id(id)
17 mute = %Pleroma.Web.ThreadMute{user_id: user.id, context: context}
18 Repo.insert(mute)
19 end
20
21 def remove_mute(user, id) do
22 end
23
24 def mute_thread() do
25 end
26 end