FIX: broken specs after new link alerting code

This commit is contained in:
Sam
2014-03-18 15:22:39 +11:00
parent 9fd7b0b814
commit 5c26b3dad1
10 changed files with 129 additions and 91 deletions

View File

@ -48,24 +48,6 @@ class PostAlertObserver < ActiveRecord::Observer
alerter.create_notification(post.user, Notification.types[:edited], post, display_username: post_revision.user.username)
end
def after_create_post(post)
if post.topic.private_message?
# If it's a private message, notify the topic_allowed_users
post.topic.all_allowed_users.reject{ |user| user.id == post.user_id }.each do |user|
next if user.blank?
if TopicUser.get(post.topic, user).try(:notification_level) == TopicUser.notification_levels[:tracking]
next unless post.reply_to_post_number
next unless post.reply_to_post.user_id == user.id
end
alerter.create_notification(user, Notification.types[:private_message], post)
end
elsif post.post_type != Post.types[:moderator_action]
# If it's not a private message and it's not an automatic post caused by a moderator action, notify the users
alerter.notify_post_users(post)
end
end
protected