DEV: Avoid duplicating constant between client and server (#25179)

Why this change?

While the constant does not change very often, we should still avoid
duplicating the value of a constant used on the server side in the
client side to avoid the values going out of sync.
This commit is contained in:
Alan Guo Xiang Tan
2024-01-16 09:50:55 +08:00
committed by GitHub
parent 22614ca85b
commit c33a8d658b
3 changed files with 6 additions and 1 deletions

View File

@ -160,6 +160,8 @@ task "javascript:update_constants" => :environment do
}
export const AUTO_GROUPS = #{auto_groups.to_json};
export const MAX_NOTIFICATIONS_LIMIT_PARAMS = #{NotificationsController::INDEX_LIMIT};
JS
pretty_notifications = Notification.types.map { |n| " #{n[0]}: #{n[1]}," }.join("\n")