2019-02-05 13:35:24 +01:00
|
|
|
# Pleroma: A lightweight social networking server
|
|
|
|
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
defmodule Pleroma.Web.ThreadMute do
|
|
|
|
use Ecto.Schema
|
|
|
|
|
2019-02-07 22:38:54 +01:00
|
|
|
alias Pleroma.{Activity, Notification, User, Repo}
|
2019-02-05 13:35:24 +01:00
|
|
|
|
|
|
|
schema "thread_mutes" do
|
2019-02-07 22:25:07 +01:00
|
|
|
belongs_to(:user, User, type: Pleroma.FlakeId)
|
2019-02-05 13:35:24 +01:00
|
|
|
field(:context, :string)
|
|
|
|
end
|
|
|
|
|
|
|
|
def add_mute(user, id) do
|
|
|
|
%{data: %{"context" => context}} = Activity.get_by_id(id)
|
2019-02-07 23:44:30 +01:00
|
|
|
mute = %Pleroma.Web.ThreadMute{user_id: user.id, context: context}
|
|
|
|
Repo.insert(mute)
|
2019-02-05 13:35:24 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def remove_mute(user, id) do
|
|
|
|
end
|
|
|
|
|
|
|
|
def mute_thread() do
|
|
|
|
end
|
|
|
|
end
|