mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 08:09:33 +08:00
DEV: Handle null notification level when generating data attribute (#8851)
This happens in tests, but handling it properly will make the production code more robust. Followup to ebdebf152d
This commit is contained in:
parent
095e3d8946
commit
fec1c0f097
|
@ -88,9 +88,10 @@ const Category = RestModel.extend({
|
|||
@discourseComputed("notification_level")
|
||||
notificationLevelString(notificationLevel) {
|
||||
// Get the key from the value
|
||||
return Object.keys(NotificationLevels)
|
||||
.find(key => NotificationLevels[key] === notificationLevel)
|
||||
.toLowerCase();
|
||||
const notificationLevelString = Object.keys(NotificationLevels).find(
|
||||
key => NotificationLevels[key] === notificationLevel
|
||||
);
|
||||
if (notificationLevelString) return notificationLevelString.toLowerCase();
|
||||
},
|
||||
|
||||
@discourseComputed("name")
|
||||
|
|
Loading…
Reference in New Issue
Block a user