mackk
September 29, 2016, 7:54pm
1
Eu não sou do Brasil, mas eu falo um pouco português
Seems like this might actually be a bug? This is what I’m seeing.
So the translation is pulled on the badges page, but not in the notifications dropdown, for some reason… (but some translations are pulled in the notifications dropdown).
Falco
(Falco)
September 29, 2016, 8:12pm
2
This is a legit bug it looks like!
The call here:
builder.map_exec(OpenStruct, id: badge.id,
multiple_grant: badge.multiple_grant,
backfill: full_backfill,
post_ids: post_ids || [-2],
user_ids: user_ids || [-2]).each do |row|
# old bronze badges do not matter
next if badge.badge_type_id == BadgeType::Bronze and row.granted_at < 2.days.ago
notification = Notification.create!(
user_id: row.user_id,
notification_type: Notification.types[:granted_badge],
data: {
badge_id: badge.id,
badge_name: badge.name,
badge_slug: badge.slug,
username: row.username
}.to_json )
Badge.exec_sql("UPDATE user_badges SET notification_id = :notification_id WHERE id = :id",
isn’t wrapped on i18n as this one:
user_badge = UserBadge.find_by(find_by)
if user_badge.nil? || (@badge.multiple_grant? && @post_id.nil?)
UserBadge.transaction do
seq = 0
if @badge.multiple_grant?
seq = UserBadge.where(badge: @badge, user: @user).maximum(:seq)
seq = (seq || -1) + 1
end
user_badge = UserBadge.create!(badge: @badge,
user: @user,
granted_by: @granted_by,
granted_at: @opts[:created_at] || Time.now,
post_id: @post_id,
seq: seq)
if @granted_by != Discourse.system_user
StaffActionLogger.new(@granted_by).log_badge_grant(user_badge)
end
So, some badges get translated while the ones that are granted trough the big granter job aren’t.
4 Likes
mackk
September 29, 2016, 9:16pm
3
Should we post this as a bug? I don’t fully understand the issue, so if you don’t mind posting it, that would be great! Thanks so much for looking in to this! I thought I was losing my mind…
1 Like
Falco
(Falco)
September 29, 2016, 10:00pm
4
Ok, I have a fix:
master ← xfalcox:localize-badge-notifications
merged 04:16AM - 12 Oct 16 UTC
Since this can be pretty perf sensitive, when we make this you gonna have your badge notifications all localized!
3 Likes