parent
2f4b817c46
commit
fdb3ae5cb8
5 changed files with 16 additions and 3 deletions
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
* Fix mention autocomplete when pasting the username [#6510](https://github.com/diaspora/diaspora/pull/6510)
|
* Fix mention autocomplete when pasting the username [#6510](https://github.com/diaspora/diaspora/pull/6510)
|
||||||
|
* Use and update updated\_at for notifications [#6573](https://github.com/diaspora/diaspora/pull/6573)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,8 @@ private
|
||||||
begin
|
begin
|
||||||
n.actors = n.actors | [actor]
|
n.actors = n.actors | [actor]
|
||||||
n.unread = true
|
n.unread = true
|
||||||
|
# Explicitly touch the notification to update updated_at whenever new actor is inserted in notification.
|
||||||
|
n.touch
|
||||||
n.save!
|
n.save!
|
||||||
rescue ActiveRecord::RecordNotUnique
|
rescue ActiveRecord::RecordNotUnique
|
||||||
nil
|
nil
|
||||||
|
|
|
||||||
|
|
@ -10,4 +10,4 @@
|
||||||
.media-body
|
.media-body
|
||||||
= notification_message_for(note)
|
= notification_message_for(note)
|
||||||
%div
|
%div
|
||||||
= timeago(note.created_at)
|
= timeago(note.updated_at)
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ describe NotificationsController, :type => :controller do
|
||||||
describe '#index' do
|
describe '#index' do
|
||||||
before do
|
before do
|
||||||
@post = FactoryGirl.create(:status_message)
|
@post = FactoryGirl.create(:status_message)
|
||||||
FactoryGirl.create(:notification, :recipient => alice, :target => @post)
|
@notification = FactoryGirl.create(:notification, recipient: alice, target: @post)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'succeeds' do
|
it 'succeeds' do
|
||||||
|
|
@ -56,8 +56,15 @@ describe NotificationsController, :type => :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'succeeds for notification dropdown' do
|
it 'succeeds for notification dropdown' do
|
||||||
|
Timecop.travel(6.seconds.ago) do
|
||||||
|
@notification.touch
|
||||||
|
end
|
||||||
get :index, :format => :json
|
get :index, :format => :json
|
||||||
expect(response).to be_success
|
expect(response).to be_success
|
||||||
|
note_html = JSON.parse(response.body)[0]["also_commented"]["note_html"]
|
||||||
|
note_html = Nokogiri::HTML(note_html)
|
||||||
|
timeago_content = note_html.css("time")[0]["data-time-ago"]
|
||||||
|
expect(timeago_content).to include(@notification.updated_at.iso8601)
|
||||||
expect(response.body).to match(/note_html/)
|
expect(response.body).to match(/note_html/)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -84,7 +91,6 @@ describe NotificationsController, :type => :controller do
|
||||||
it "should not provide a contacts menu for standard notifications" do
|
it "should not provide a contacts menu for standard notifications" do
|
||||||
FactoryGirl.create(:notification, :recipient => alice, :target => @post)
|
FactoryGirl.create(:notification, :recipient => alice, :target => @post)
|
||||||
get :index, "per_page" => 5
|
get :index, "per_page" => 5
|
||||||
|
|
||||||
expect(Nokogiri(response.body).css('.aspect_membership')).to be_empty
|
expect(Nokogiri(response.body).css('.aspect_membership')).to be_empty
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,8 +97,10 @@ describe Notification, :type => :model do
|
||||||
p = FactoryGirl.build(:status_message, :author => @user.person)
|
p = FactoryGirl.build(:status_message, :author => @user.person)
|
||||||
person2 = FactoryGirl.build(:person)
|
person2 = FactoryGirl.build(:person)
|
||||||
notification = Notification.notify(@user, FactoryGirl.build(:like, :author => @person, :target => p), @person)
|
notification = Notification.notify(@user, FactoryGirl.build(:like, :author => @person, :target => p), @person)
|
||||||
|
earlier_updated_at = notification.updated_at
|
||||||
notification2 = Notification.notify(@user, FactoryGirl.build(:like, :author => person2, :target => p), person2)
|
notification2 = Notification.notify(@user, FactoryGirl.build(:like, :author => person2, :target => p), person2)
|
||||||
expect(notification.id).to eq(notification2.id)
|
expect(notification.id).to eq(notification2.id)
|
||||||
|
expect(earlier_updated_at).to_not eq(notification.reload.updated_at)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -107,8 +109,10 @@ describe Notification, :type => :model do
|
||||||
p = FactoryGirl.build(:status_message, :author => @user.person)
|
p = FactoryGirl.build(:status_message, :author => @user.person)
|
||||||
person2 = FactoryGirl.build(:person)
|
person2 = FactoryGirl.build(:person)
|
||||||
notification = Notification.notify(@user, FactoryGirl.build(:comment, :author => @person, :post => p), @person)
|
notification = Notification.notify(@user, FactoryGirl.build(:comment, :author => @person, :post => p), @person)
|
||||||
|
earlier_updated_at = notification.updated_at
|
||||||
notification2 = Notification.notify(@user, FactoryGirl.build(:comment, :author => person2, :post => p), person2)
|
notification2 = Notification.notify(@user, FactoryGirl.build(:comment, :author => person2, :post => p), person2)
|
||||||
expect(notification.id).to eq(notification2.id)
|
expect(notification.id).to eq(notification2.id)
|
||||||
|
expect(earlier_updated_at).to_not eq(notification.reload.updated_at)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue