This commit is contained in:
Karen Konou 2019-02-07 22:25:07 +01:00
parent f4ff4ffba2
commit 77448de492
2 changed files with 5 additions and 5 deletions

View File

@ -8,14 +8,14 @@ defmodule Pleroma.Web.ThreadMute do
alias Pleroma.{Activity, Notification, User} alias Pleroma.{Activity, Notification, User}
schema "thread_mutes" do schema "thread_mutes" do
field(:user_id, :string) belongs_to(:user, User, type: Pleroma.FlakeId)
field(:context, :string) field(:context, :string)
end end
def add_mute(user, id) do def add_mute(user, id) do
%{id: user_id} = user user_id = user.id
%{data: %{"context" => context}} = Activity.get_by_id(id) %{data: %{"context" => context}} = Activity.get_by_id(id)
Pleroma.Repo.insert(%Pleroma.Web.ThreadMute{user_id: user_id, context: context}) Pleroma.Repo.insert(%Pleroma.Web.ThreadMute{user: user_id, context: context})
end end
def remove_mute(user, id) do def remove_mute(user, id) do

View File

@ -3,10 +3,10 @@ defmodule Pleroma.Repo.Migrations.CreateThreadMutes do
def change do def change do
create table(:thread_mutes) do create table(:thread_mutes) do
add :user_id, references(:users, type: :uuid, on_delete: :delete_all) add :user, references(:users, type: :uuid, on_delete: :delete_all)
add :context, :string add :context, :string
end end
create index(:thread_mutes, [:user_id]) create index(:thread_mutes, [:user])
end end
end end