-
Notifications
You must be signed in to change notification settings - Fork 505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 4106 i18n kudos email #1878
Conversation
I18n.with_locale(Locale.find(@user.preference.prefered_locale).iso) do | ||
mail( | ||
:to => @user.email, | ||
:subject => "#{t 'user_mailer.invite_increase_notification.subject' ,app_name: ArchiveConfig.APP_SHORT_NAME}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know which way around these will be merged so that the code they have in common will no longer appear in the diff for this or the one for Issue 4100, so here is the same comment again:
The space always goes after the comma, never before.
Please move the space between 'user_mailer.invite_increase_notification.subject' and "app_name:" so that this part reads 'user_mailer.invite_increase_notification.subject', app_name
I am not going to look at these until the first one is merged. |
) | ||
I18n.with_locale(Locale.find(user.preference.prefered_locale).iso) do | ||
mail( | ||
:to => user.email, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the new Ruby 1.9 hash syntax.
if guest_count.to_i == 1 | ||
return "1111 #{t 'mailer.kudos.guest'}" | ||
end | ||
return "1111 #{guest_count} #{t 'mailer.kudos.guests'}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant return
detected.
if guest_count.to_i == 1 | ||
return "#{t 'mailer.kudos.guest'}" | ||
end | ||
return "#{guest_count} #{t 'mailer.kudos.guests'}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant return
detected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find the extra return to be helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've found that you get used to the absence of return
keywords when you start seeing the methods as functions that "are" their return values, rather than separate procedures that have to "return" a value.
The way you've formatted this, the first return
is indeed necessary, but I'd personally find the logic easier to follow if the whole thing was one if
statement:
if guest_count.to_i == 1
"#{t 'mailer.kudos.guest'}"
else
"#{guest_count} #{t 'mailer.kudos.guests'}"
end
# If we have a commentable, extract names and process guest kudos text - skip if no kudos givers | ||
names = kudo_givers_hash['names'] | ||
guest_count = kudo_givers_hash['guest_count'] | ||
kudo_givers = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it turns out kudos_givers needs to be an empty array []
so that both appending with <<
and to_sentence
will work
next if kudo_givers.empty? | ||
|
||
@commentables << commentable | ||
@kudo_givers[commentable_info] = kudo_givers.to_sentance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to_sentence
, not to_sentance
Issue 4106 i18n kudos email
Part of https://code.google.com/p/otwarchive/issues/detail?id=4106
merge after 4099 and 4100