From 40686b560517fc78be8a5affb809729890d30408 Mon Sep 17 00:00:00 2001 From: Cuong Phung Manh Date: Tue, 8 Oct 2024 15:40:19 +0800 Subject: [PATCH] fix(forum-post-anonymous): do not create course-activity for anonymous topic creator --- app/notifiers/course/forum/topic_notifier.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/notifiers/course/forum/topic_notifier.rb b/app/notifiers/course/forum/topic_notifier.rb index 251cf9bd0c9..9af73629766 100644 --- a/app/notifiers/course/forum/topic_notifier.rb +++ b/app/notifiers/course/forum/topic_notifier.rb @@ -7,7 +7,8 @@ def topic_created(user, course_user, topic) return unless email_enabled.regular || email_enabled.phantom activity = create_activity(actor: user, object: topic, event: :created) - activity.notify(course, :feed) unless course_user.phantom? + activity.notify(course, :feed) if course_user && !course_user.phantom? && + !topic.posts.first.is_anonymous topic.forum.subscriptions.includes(:user).each do |subscription| course_user = course.course_users.find_by(user: subscription.user)