diff --git a/app/assets/javascripts/discourse/models/user.js.es6 b/app/assets/javascripts/discourse/models/user.js.es6 index 99aca34d6fc..223ebc19661 100644 --- a/app/assets/javascripts/discourse/models/user.js.es6 +++ b/app/assets/javascripts/discourse/models/user.js.es6 @@ -184,12 +184,15 @@ const User = RestModel.extend({ ['muted','watched','tracked','watched_first_post'].forEach(s => { let prop = s === "watched_first_post" ? "watchedFirstPostCategories" : s + "Categories"; - let cats = this.get(prop).map(c => c.get('id')); - updatedState[s + '_category_ids'] = cats; + let cats = this.get(prop); + if (cats) { + let cat_ids = cats.map(c => c.get('id')); + updatedState[s + '_category_ids'] = cat_ids; - // HACK: denote lack of categories - if (cats.length === 0) { cats = [-1]; } - data[s + '_category_ids'] = cats; + // HACK: denote lack of categories + if (cats.length === 0) { cat_ids = [-1]; } + data[s + '_category_ids'] = cat_ids; + } }); if (!Discourse.SiteSettings.edit_history_visible_to_public) {