Merge branch 'next-minor' into develop

This commit is contained in:
Benjamin Neff 2018-01-05 01:50:27 +01:00
commit d3632e116a
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
3 changed files with 20 additions and 3 deletions

View file

@ -11,6 +11,7 @@
## Refactor ## Refactor
## Bug fixes ## Bug fixes
* Fix notifications when people remove their birthday date [#7691](https://github.com/diaspora/diaspora/pull/7691)
## Features ## Features
* Check if redis is running in script/server [#7685](https://github.com/diaspora/diaspora/pull/7685) * Check if redis is running in script/server [#7685](https://github.com/diaspora/diaspora/pull/7685)

View file

@ -17,7 +17,7 @@ module NotificationsHelper
.include?(note.type) .include?(note.type)
opts.merge!(opts_for_post(note.linked_object)) opts.merge!(opts_for_post(note.linked_object))
elsif note.is_a?(Notifications::ContactsBirthday) elsif note.is_a?(Notifications::ContactsBirthday)
opts.merge!(opts_for_birthday(note.linked_object)) opts.merge!(opts_for_birthday(note))
end end
end end
translation(target_type, opts) translation(target_type, opts)
@ -46,8 +46,8 @@ module NotificationsHelper
} }
end end
def opts_for_birthday(person) def opts_for_birthday(note)
{date: locale_date(person.birthday.to_s)} {date: I18n.l(note.created_at, format: I18n.t("date.formats.fullmonth_day"))}
end end
def notification_people_link(note, people=nil) def notification_people_link(note, people=nil)

View file

@ -123,6 +123,22 @@ describe NotificationsHelper, type: :helper do
expect(link).to include("#{post_path(status_message)}##{comment.guid}") expect(link).to include("#{post_path(status_message)}##{comment.guid}")
end end
end end
context "for a birthday" do
let(:notification) { Notifications::ContactsBirthday.create(recipient: alice, target: bob.person) }
it "contains the date" do
bob.profile.update_attributes(birthday: Time.zone.today)
link = object_link(notification, notification_people_link(notification))
expect(link).to include(I18n.l(Time.zone.today, format: I18n.t("date.formats.fullmonth_day")))
end
it "doesn't break, when the person removes the birthday date" do
bob.profile.update_attributes(birthday: nil)
link = object_link(notification, notification_people_link(notification))
expect(link).to include(I18n.l(Time.zone.today, format: I18n.t("date.formats.fullmonth_day")))
end
end
end end
describe '#display_year?' do describe '#display_year?' do