Merge branch 'stable' into develop
This commit is contained in:
commit
c8a8110cf1
4 changed files with 22 additions and 9 deletions
|
|
@ -146,6 +146,7 @@ Contributions are very welcome, the hard work is done!
|
|||
* Fix internal server error when trying to log out of an expired session [#6707](https://github.com/diaspora/diaspora/pull/6707)
|
||||
* Only mark unread notifications as read [#6711](https://github.com/diaspora/diaspora/pull/6711)
|
||||
* Use https for OEmbeds [#6748](https://github.com/diaspora/diaspora/pull/6748)
|
||||
* Fix birthday issues on leap days [#6738](https://github.com/diaspora/diaspora/pull/6738)
|
||||
|
||||
## Features
|
||||
* Added the footer to conversation pages [#6710](https://github.com/diaspora/diaspora/pull/6710)
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ module PeopleHelper
|
|||
end
|
||||
|
||||
def birthday_format(bday)
|
||||
if bday.year == 1000
|
||||
I18n.l bday, :format => I18n.t('date.formats.birthday')
|
||||
if bday.year <= 1004
|
||||
I18n.l bday, format: I18n.t("date.formats.birthday")
|
||||
else
|
||||
I18n.l bday, :format => I18n.t('date.formats.birthday_with_year')
|
||||
I18n.l bday, format: I18n.t("date.formats.birthday_with_year")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -113,20 +113,20 @@ class Profile < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def date= params
|
||||
if ['month', 'day'].all? { |key| params[key].present? }
|
||||
params['year'] = '1000' if params['year'].blank?
|
||||
if Date.valid_civil?(params['year'].to_i, params['month'].to_i, params['day'].to_i)
|
||||
self.birthday = Date.new(params['year'].to_i, params['month'].to_i, params['day'].to_i)
|
||||
if %w(month day).all? {|key| params[key].present? }
|
||||
params["year"] = "1004" if params["year"].blank?
|
||||
if Date.valid_civil?(params["year"].to_i, params["month"].to_i, params["day"].to_i)
|
||||
self.birthday = Date.new(params["year"].to_i, params["month"].to_i, params["day"].to_i)
|
||||
else
|
||||
@invalid_birthday_date = true
|
||||
end
|
||||
elsif [ 'year', 'month', 'day'].all? { |key| params[key].blank? }
|
||||
elsif %w(year month day).all? {|key| params[key].blank? }
|
||||
self.birthday = nil
|
||||
end
|
||||
end
|
||||
|
||||
def formatted_birthday
|
||||
birthday.to_s(:long).gsub(', 1000', '') if birthday.present?
|
||||
birthday.to_s(:long).gsub(/, 100[0|4]/, "") if birthday.present?
|
||||
end
|
||||
|
||||
def bio_message
|
||||
|
|
|
|||
|
|
@ -10,6 +10,18 @@ describe PeopleHelper, :type => :helper do
|
|||
@person = FactoryGirl.create(:person)
|
||||
end
|
||||
|
||||
describe "#birthday_format" do
|
||||
it "contains the birth year if available" do
|
||||
birthday = Date.new 2016, 3, 5
|
||||
expect(birthday_format(birthday)).to include "2016"
|
||||
end
|
||||
|
||||
it "does not contain the birth year if placeholder year is used" do
|
||||
birthday = Date.new 1004, 3, 5
|
||||
expect(birthday_format(birthday)).not_to include "1004"
|
||||
end
|
||||
end
|
||||
|
||||
describe "#person_image_link" do
|
||||
it "returns an empty string if person is nil" do
|
||||
expect(person_image_link(nil)).to eq("")
|
||||
|
|
|
|||
Loading…
Reference in a new issue