mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
change topic notification to post notification (derpibooru/philomena#191, derpibooru/philomena#39)
This commit is contained in:
parent
a075576740
commit
c766ac9d3f
2 changed files with 8 additions and 8 deletions
|
@ -73,7 +73,7 @@ defmodule Philomena.Topics do
|
||||||
|> Repo.transaction()
|
|> Repo.transaction()
|
||||||
end
|
end
|
||||||
|
|
||||||
def notify_topic(topic) do
|
def notify_topic(topic, post) do
|
||||||
spawn(fn ->
|
spawn(fn ->
|
||||||
forum =
|
forum =
|
||||||
topic
|
topic
|
||||||
|
@ -86,14 +86,14 @@ defmodule Philomena.Topics do
|
||||||
|> Map.fetch!(:subscriptions)
|
|> Map.fetch!(:subscriptions)
|
||||||
|
|
||||||
Notifications.notify(
|
Notifications.notify(
|
||||||
topic,
|
post,
|
||||||
subscriptions,
|
subscriptions,
|
||||||
%{
|
%{
|
||||||
actor_id: forum.id,
|
actor_id: topic.id,
|
||||||
actor_type: "Forum",
|
actor_type: "Topic",
|
||||||
actor_child_id: topic.id,
|
actor_child_id: post.id,
|
||||||
actor_child_type: "Topic",
|
actor_child_type: "Post",
|
||||||
action: "posted a new topic"
|
action: "posted a new topic in #{forum.name}"
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -113,7 +113,7 @@ defmodule PhilomenaWeb.TopicController do
|
||||||
{:ok, %{topic: topic}} ->
|
{:ok, %{topic: topic}} ->
|
||||||
post = hd(topic.posts)
|
post = hd(topic.posts)
|
||||||
Posts.reindex_post(post)
|
Posts.reindex_post(post)
|
||||||
Topics.notify_topic(topic)
|
Topics.notify_topic(topic, post)
|
||||||
|
|
||||||
if forum.access_level == "normal" do
|
if forum.access_level == "normal" do
|
||||||
PhilomenaWeb.Endpoint.broadcast!(
|
PhilomenaWeb.Endpoint.broadcast!(
|
||||||
|
|
Loading…
Reference in a new issue