diff --git a/app/assets/javascripts/discourse/app/models/bookmark.js b/app/assets/javascripts/discourse/app/models/bookmark.js index 52b032e2642..97d45b219ed 100644 --- a/app/assets/javascripts/discourse/app/models/bookmark.js +++ b/app/assets/javascripts/discourse/app/models/bookmark.js @@ -125,9 +125,20 @@ const Bookmark = RestModel.extend({ ).capitalize(); }, - @discourseComputed("linked_post_number", "fancy_title", "topic_id") - topicLink(linked_post_number, fancy_title, id) { - return Topic.create({ id, fancy_title, linked_post_number }); + @discourseComputed() + topicForList() { + // for topic level bookmarks we want to jump to the last unread post URL, + // which the topic-link helper does by default if no linked post number is + // provided + const linkedPostNumber = this.for_topic ? null : this.linked_post_number; + + return Topic.create({ + id: this.topic_id, + fancy_title: this.fancy_title, + linked_post_number: linkedPostNumber, + last_read_post_number: this.last_read_post_number, + highest_post_number: this.highest_post_number, + }); }, loadItems(params) { diff --git a/app/assets/javascripts/discourse/app/templates/components/bookmark-list.hbs b/app/assets/javascripts/discourse/app/templates/components/bookmark-list.hbs index 8816e46983b..9dbfd967959 100644 --- a/app/assets/javascripts/discourse/app/templates/components/bookmark-list.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/bookmark-list.hbs @@ -32,7 +32,7 @@ {{d-icon "thumbtack" class="bookmark-pinned"}} {{/if}} {{~topic-status topic=bookmark.topicStatus~}} - {{topic-link bookmark.topicLink}} + {{topic-link bookmark.topicForList}}