mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
UX: Invited users should watch PM topic once topic has been visited.
https://meta.discourse.org/t/notifications-not-received-for-private-messages-im-invited-to/71577/11
This commit is contained in:
@ -187,15 +187,30 @@ SQL
|
||||
end
|
||||
|
||||
unless attrs[:notification_level]
|
||||
auto_track_after = UserOption.where(user_id: user_id).pluck(:auto_track_topics_after_msecs).first
|
||||
auto_track_after ||= SiteSetting.default_other_auto_track_topics_after_msecs
|
||||
if Topic.private_messages.where(id: topic_id).exists? &&
|
||||
Notification.where(
|
||||
user_id: user_id,
|
||||
topic_id: topic_id,
|
||||
notification_type: Notification.types[:invited_to_private_message]
|
||||
).exists?
|
||||
|
||||
if auto_track_after >= 0 && auto_track_after <= (attrs[:total_msecs_viewed].to_i || 0)
|
||||
attrs[:notification_level] ||= notification_levels[:tracking]
|
||||
attrs[:notification_level] = notification_levels[:watching]
|
||||
else
|
||||
auto_track_after = UserOption.where(user_id: user_id).pluck(:auto_track_topics_after_msecs).first
|
||||
auto_track_after ||= SiteSetting.default_other_auto_track_topics_after_msecs
|
||||
|
||||
if auto_track_after >= 0 && auto_track_after <= (attrs[:total_msecs_viewed].to_i || 0)
|
||||
attrs[:notification_level] ||= notification_levels[:tracking]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
TopicUser.create(attrs.merge!(user_id: user_id, topic_id: topic_id, first_visited_at: now , last_visited_at: now))
|
||||
TopicUser.create!(attrs.merge!(
|
||||
user_id: user_id,
|
||||
topic_id: topic_id,
|
||||
first_visited_at: now ,
|
||||
last_visited_at: now
|
||||
))
|
||||
end
|
||||
|
||||
def track_visit!(topic_id, user_id)
|
||||
|
Reference in New Issue
Block a user