ソースを参照

Dismiss the follow request notification on rejection

tags/v2.0.3^2
eugenijm rinpatch 4年前
コミット
441e28f365
2個のファイルの変更12行の追加0行の削除
  1. +10
    -0
      lib/pleroma/notification.ex
  2. +2
    -0
      lib/pleroma/web/common_api/common_api.ex

+ 10
- 0
lib/pleroma/notification.ex ファイルの表示

@@ -271,6 +271,16 @@ defmodule Pleroma.Notification do
|> Repo.delete_all()
end

def dismiss(%Pleroma.Activity{} = activity) do
Notification
|> where([n], n.activity_id == ^activity.id)
|> Repo.delete_all()
|> case do
{_, notifications} -> {:ok, notifications}
_ -> {:error, "Cannot dismiss notification"}
end
end

def dismiss(%{id: user_id} = _user, id) do
notification = Repo.get(Notification, id)



+ 2
- 0
lib/pleroma/web/common_api/common_api.ex ファイルの表示

@@ -7,6 +7,7 @@ defmodule Pleroma.Web.CommonAPI do
alias Pleroma.ActivityExpiration
alias Pleroma.Conversation.Participation
alias Pleroma.FollowingRelationship
alias Pleroma.Notification
alias Pleroma.Object
alias Pleroma.ThreadMute
alias Pleroma.User
@@ -58,6 +59,7 @@ defmodule Pleroma.Web.CommonAPI do
with %Activity{} = follow_activity <- Utils.fetch_latest_follow(follower, followed),
{:ok, follow_activity} <- Utils.update_follow_state_for_all(follow_activity, "reject"),
{:ok, _relationship} <- FollowingRelationship.update(follower, followed, :follow_reject),
{:ok, _notifications} <- Notification.dismiss(follow_activity),
{:ok, _activity} <-
ActivityPub.reject(%{
to: [follower.ap_id],


読み込み中…
キャンセル
保存