notify by display name is silly, display name is not unique in the system
This commit is contained in:
Sam Saffron 2013-02-12 18:49:57 +11:00
parent 99526c33da
commit 925925817f
2 changed files with 1 additions and 6 deletions

View File

@ -101,7 +101,7 @@ class PostAlertObserver < ActiveRecord::Observer
result = []
post.raw.scan(/\[quote=\"([^,]+),.+\"\]/).uniq.each do |m|
username = m.first.strip.downcase
user = User.where("(LOWER(username_lower) = :username or LOWER(name) = :username) and id != :id", username: username, id: post.user_id).first
user = User.where("username_lower = :username and id != :id", username: username, id: post.user_id).first
result << user if user.present?
end
result

View File

@ -37,11 +37,6 @@ describe PostAlertObserver do
context 'quotes' do
it 'notifies a user by display username' do
lambda {
Fabricate(:post, raw: '[quote="Evil Trout, post:1"]whatup[/quote]')
}.should change(evil_trout.notifications, :count).by(1)
end
it 'notifies a user by username' do
lambda {