From 77448de4925f3793bde201a49d204f881163b1b8 Mon Sep 17 00:00:00 2001 From: Karen Konou Date: Thu, 7 Feb 2019 22:25:07 +0100 Subject: [PATCH] ugghhhh --- lib/pleroma/web/thread_mute.ex | 6 +++--- priv/repo/migrations/20190205114625_create_thread_mutes.exs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/pleroma/web/thread_mute.ex b/lib/pleroma/web/thread_mute.ex index 8892155cd..50a6219d1 100644 --- a/lib/pleroma/web/thread_mute.ex +++ b/lib/pleroma/web/thread_mute.ex @@ -8,14 +8,14 @@ defmodule Pleroma.Web.ThreadMute do alias Pleroma.{Activity, Notification, User} schema "thread_mutes" do - field(:user_id, :string) + belongs_to(:user, User, type: Pleroma.FlakeId) field(:context, :string) end def add_mute(user, id) do - %{id: user_id} = user + user_id = user.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 def remove_mute(user, id) do diff --git a/priv/repo/migrations/20190205114625_create_thread_mutes.exs b/priv/repo/migrations/20190205114625_create_thread_mutes.exs index b16f557f0..16083332b 100644 --- a/priv/repo/migrations/20190205114625_create_thread_mutes.exs +++ b/priv/repo/migrations/20190205114625_create_thread_mutes.exs @@ -3,10 +3,10 @@ defmodule Pleroma.Repo.Migrations.CreateThreadMutes do def change 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 end - create index(:thread_mutes, [:user_id]) + create index(:thread_mutes, [:user]) end end