The following lines caused issues for some users, specifically those who
signed up in 2021 when audio alerts were implemented as a flag. The data
type update for the flag was not handled correctly. This PR fixes the
issue by updating it to a compatible value.
9410b3bcbb/app/javascript/dashboard/helper/AudioAlerts/DashboardAudioNotificationHelper.js (L76-L81)
19 lines
658 B
Ruby
19 lines
658 B
Ruby
class FixOldAudioAlertData < ActiveRecord::Migration[7.0]
|
|
def change
|
|
# rubocop:disable Rails/SkipsModelValidations
|
|
|
|
# Update users with audio alerts enabled to 'mine'
|
|
User.where(
|
|
"users.ui_settings #>> '{enable_audio_alerts}' = ?", 'true'
|
|
).update_all(
|
|
"ui_settings = jsonb_set(ui_settings, '{enable_audio_alerts}', '\"mine\"')"
|
|
)
|
|
|
|
# Update users with audio alerts enabled to 'none'
|
|
User
|
|
.where("users.ui_settings #>> '{enable_audio_alerts}' = ?", 'true')
|
|
.update_all("ui_settings = jsonb_set(ui_settings, '{enable_audio_alerts}', '\"mine\"')")
|
|
# rubocop:enable Rails/SkipsModelValidations
|
|
end
|
|
end
|