mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 12:12:46 +08:00
d69c5eebcf
* UI: Mass grant a badge from the admin ui * Send the uploaded CSV and badge ID to the backend * Read the CSV and grant badge in batches * UX: Communicate the result to the user * Don't award if badge is disabled * Create a 'send_notification' method to remove duplicated code, slightly shrink badge image. Replace router transition with href. * Dynamically discover current route
15 lines
341 B
Ruby
15 lines
341 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Jobs
|
|
class MassAwardBadge < ::Jobs::Base
|
|
def execute(args)
|
|
badge = Badge.find_by(id: args[:badge_id])
|
|
users = User.select(:id, :username, :locale).with_email(args[:user_emails])
|
|
|
|
return if users.empty? || badge.nil?
|
|
|
|
BadgeGranter.mass_grant(badge, users)
|
|
end
|
|
end
|
|
end
|