parent
2f4b817c46
commit
fdb3ae5cb8
5 changed files with 16 additions and 3 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
## Bug fixes
|
||||
* 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
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@ private
|
|||
begin
|
||||
n.actors = n.actors | [actor]
|
||||
n.unread = true
|
||||
# Explicitly touch the notification to update updated_at whenever new actor is inserted in notification.
|
||||
n.touch
|
||||
n.save!
|
||||
rescue ActiveRecord::RecordNotUnique
|
||||
nil
|
||||
|
|
|
|||
|
|
@ -10,4 +10,4 @@
|
|||
.media-body
|
||||
= notification_message_for(note)
|
||||
%div
|
||||
= timeago(note.created_at)
|
||||
= timeago(note.updated_at)
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ describe NotificationsController, :type => :controller do
|
|||
describe '#index' do
|
||||
before do
|
||||
@post = FactoryGirl.create(:status_message)
|
||||
FactoryGirl.create(:notification, :recipient => alice, :target => @post)
|
||||
@notification = FactoryGirl.create(:notification, recipient: alice, target: @post)
|
||||
end
|
||||
|
||||
it 'succeeds' do
|
||||
|
|
@ -56,8 +56,15 @@ describe NotificationsController, :type => :controller do
|
|||
end
|
||||
|
||||
it 'succeeds for notification dropdown' do
|
||||
Timecop.travel(6.seconds.ago) do
|
||||
@notification.touch
|
||||
end
|
||||
get :index, :format => :json
|
||||
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/)
|
||||
end
|
||||
|
||||
|
|
@ -84,7 +91,6 @@ describe NotificationsController, :type => :controller do
|
|||
it "should not provide a contacts menu for standard notifications" do
|
||||
FactoryGirl.create(:notification, :recipient => alice, :target => @post)
|
||||
get :index, "per_page" => 5
|
||||
|
||||
expect(Nokogiri(response.body).css('.aspect_membership')).to be_empty
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -97,8 +97,10 @@ describe Notification, :type => :model do
|
|||
p = FactoryGirl.build(:status_message, :author => @user.person)
|
||||
person2 = FactoryGirl.build(: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)
|
||||
expect(notification.id).to eq(notification2.id)
|
||||
expect(earlier_updated_at).to_not eq(notification.reload.updated_at)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -107,8 +109,10 @@ describe Notification, :type => :model do
|
|||
p = FactoryGirl.build(:status_message, :author => @user.person)
|
||||
person2 = FactoryGirl.build(: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)
|
||||
expect(notification.id).to eq(notification2.id)
|
||||
expect(earlier_updated_at).to_not eq(notification.reload.updated_at)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue