diff --git a/app/assets/javascripts/discourse/models/category.js.es6 b/app/assets/javascripts/discourse/models/category.js.es6 index 8a5997f4a14..0afa3fd9bc3 100644 --- a/app/assets/javascripts/discourse/models/category.js.es6 +++ b/app/assets/javascripts/discourse/models/category.js.es6 @@ -115,7 +115,10 @@ const Category = RestModel.extend({ default_view: this.get("default_view"), subcategory_list_style: this.get("subcategory_list_style"), default_top_period: this.get("default_top_period"), - minimum_required_tags: this.get("minimum_required_tags") + minimum_required_tags: this.get("minimum_required_tags"), + navigate_to_first_post_after_read: this.get( + "navigate_to_first_post_after_read" + ) }, type: id ? "PUT" : "POST" }); diff --git a/app/assets/javascripts/discourse/models/topic.js.es6 b/app/assets/javascripts/discourse/models/topic.js.es6 index a47192b7e71..68be7f9b016 100644 --- a/app/assets/javascripts/discourse/models/topic.js.es6 +++ b/app/assets/javascripts/discourse/models/topic.js.es6 @@ -212,11 +212,18 @@ const Topic = RestModel.extend({ }.property("url", "last_read_post_number"), lastUnreadUrl: function() { - const postNumber = Math.min( - this.get("last_read_post_number") + 1, - this.get("highest_post_number") - ); - return this.urlForPostNumber(postNumber); + const highest = this.get("highest_post_number"); + const lastRead = this.get("last_read_post_number"); + + if (highest <= lastRead) { + if (this.get("category.navigate_to_first_post_after_read")) { + return this.urlForPostNumber(1); + } else { + return this.urlForPostNumber(lastRead + 1); + } + } else { + return this.urlForPostNumber(lastRead + 1); + } }.property("url", "last_read_post_number", "highest_post_number"), lastPostUrl: function() { diff --git a/app/assets/javascripts/discourse/templates/components/edit-category-settings.hbs b/app/assets/javascripts/discourse/templates/components/edit-category-settings.hbs index e08271dfff4..778ddcbfda7 100644 --- a/app/assets/javascripts/discourse/templates/components/edit-category-settings.hbs +++ b/app/assets/javascripts/discourse/templates/components/edit-category-settings.hbs @@ -1,3 +1,19 @@ +{{#if showPositionInput}} +
+ +
+{{/if}} + +{{#unless showPositionInput}} +
+ {{i18n 'category.position_disabled'}} + {{i18n 'category.position_disabled_click'}} +
+{{/unless}} +
- +
+ +
+ {{#if siteSettings.topic_featured_link_enabled}}