forked from YokaiRick/akkoma
ugghhhh
This commit is contained in:
parent
f4ff4ffba2
commit
77448de492
2 changed files with 5 additions and 5 deletions
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue