From c43f414a79ff9b276b8162ac1ab10e84651e881d Mon Sep 17 00:00:00 2001 From: Karen Konou Date: Thu, 7 Feb 2019 23:44:30 +0100 Subject: [PATCH] Somehow fixed the repo insert [skip-ci] --- lib/pleroma/web/thread_mute.ex | 3 ++- priv/repo/migrations/20190205114625_create_thread_mutes.exs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/web/thread_mute.ex b/lib/pleroma/web/thread_mute.ex index 333b26246..b37dda58b 100644 --- a/lib/pleroma/web/thread_mute.ex +++ b/lib/pleroma/web/thread_mute.ex @@ -14,7 +14,8 @@ defmodule Pleroma.Web.ThreadMute do def add_mute(user, id) do %{data: %{"context" => context}} = Activity.get_by_id(id) - Repo.insert(%Pleroma.Web.ThreadMute{}, %{user_id: user.id, context: context}) + mute = %Pleroma.Web.ThreadMute{user_id: user.id, context: context} + Repo.insert(mute) 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 16083332b..b16f557f0 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, references(:users, type: :uuid, on_delete: :delete_all) + add :user_id, references(:users, type: :uuid, on_delete: :delete_all) add :context, :string end - create index(:thread_mutes, [:user]) + create index(:thread_mutes, [:user_id]) end end