remove old buggy code see: http://meta.discourse.org/t/quoted-you-emails/2226/3
notify by display name is silly, display name is not unique in the system
This commit is contained in:
parent
99526c33da
commit
925925817f
2 changed files with 1 additions and 6 deletions
|
@ -101,7 +101,7 @@ class PostAlertObserver < ActiveRecord::Observer
|
||||||
result = []
|
result = []
|
||||||
post.raw.scan(/\[quote=\"([^,]+),.+\"\]/).uniq.each do |m|
|
post.raw.scan(/\[quote=\"([^,]+),.+\"\]/).uniq.each do |m|
|
||||||
username = m.first.strip.downcase
|
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?
|
result << user if user.present?
|
||||||
end
|
end
|
||||||
result
|
result
|
||||||
|
|
|
@ -37,11 +37,6 @@ describe PostAlertObserver do
|
||||||
|
|
||||||
|
|
||||||
context 'quotes' 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
|
it 'notifies a user by username' do
|
||||||
lambda {
|
lambda {
|
||||||
|
|
Reference in a new issue