Skip to content

A platform for community discussion. Free, open, simple.

DEV: Handle null notification level when generating data attribute (#8851)

David Taylorfec1c0f0970b
diff --git a/app/assets/javascripts/discourse/models/category.js.es6 b/app/assets/javascripts/discourse/models/category.js.es6
index faeaf1d9263..8dfdc4cf9e8 100644
--- a/app/assets/javascripts/discourse/models/category.js.es6
+++ b/app/assets/javascripts/discourse/models/category.js.es6
@@ -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")