diff options
author | Dennis Schubert <mail@dennis-schubert.de> | 2018-01-12 19:53:58 +0300 |
---|---|---|
committer | Dennis Schubert <mail@dennis-schubert.de> | 2018-01-12 19:54:27 +0300 |
commit | a40824cd2b303075cdcfe34f52d2a6065797003a (patch) | |
tree | 5f3e1c26bcea29c6f3efc04d2d14f8e82106f4d5 | |
parent | cf2bd66005f7fd4397e8e15d666549d430d39d38 (diff) | |
parent | 5bc4473e11698b9dedd33876369c3e74e85ff7fa (diff) |
Merge branch 'hotfix/0.7.2.1'v0.7.2.1
-rw-r--r-- | Changelog.md | 4 | ||||
-rw-r--r-- | app/helpers/notifications_helper.rb | 6 | ||||
-rw-r--r-- | config/defaults.yml | 2 | ||||
-rw-r--r-- | spec/helpers/notifications_helper_spec.rb | 16 |
4 files changed, 24 insertions, 4 deletions
diff --git a/Changelog.md b/Changelog.md index 1096744f0..b89f734f9 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,7 @@ +# 0.7.2.1 + +Fixes notifications when people remove their birthday date [#7691](https://github.com/diaspora/diaspora/pull/7691) + # 0.7.2.0 ## Bug fixes diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index dd1a4cf9a..ffe10a951 100644 --- a/app/helpers/notifications_helper.rb +++ b/app/helpers/notifications_helper.rb @@ -17,7 +17,7 @@ module NotificationsHelper .include?(note.type) opts.merge!(opts_for_post(note.linked_object)) elsif note.is_a?(Notifications::ContactsBirthday) - opts.merge!(opts_for_birthday(note.linked_object)) + opts.merge!(opts_for_birthday(note)) end end translation(target_type, opts) @@ -46,8 +46,8 @@ module NotificationsHelper } end - def opts_for_birthday(person) - {date: locale_date(person.birthday.to_s)} + def opts_for_birthday(note) + {date: I18n.l(note.created_at, format: I18n.t("date.formats.fullmonth_day"))} end def notification_people_link(note, people=nil) diff --git a/config/defaults.yml b/config/defaults.yml index d888ddfb3..cb43d5981 100644 --- a/config/defaults.yml +++ b/config/defaults.yml @@ -4,7 +4,7 @@ defaults: version: - number: "0.7.2.0" # Do not touch unless doing a release, do not backport the version number that's in master + number: "0.7.2.1" # Do not touch unless doing a release, do not backport the version number that's in master heroku: false environment: url: "http://localhost:3000/" diff --git a/spec/helpers/notifications_helper_spec.rb b/spec/helpers/notifications_helper_spec.rb index 356092b18..dea069ef6 100644 --- a/spec/helpers/notifications_helper_spec.rb +++ b/spec/helpers/notifications_helper_spec.rb @@ -123,6 +123,22 @@ describe NotificationsHelper, type: :helper do expect(link).to include("#{post_path(status_message)}##{comment.guid}") 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 describe '#display_year?' do |