A platform for community discussion. Free, open, simple.
FIX: Link in activity cell of bookmark page will return /t/undefined when bookmarkable_type != Topic (#36843)
small-lovely-cat73324846532c
diff --git a/frontend/discourse/app/models/bookmark.js b/frontend/discourse/app/models/bookmark.jsindex d8dfd6b1998..687361e5a67 100644--- a/frontend/discourse/app/models/bookmark.js+++ b/frontend/discourse/app/models/bookmark.js@@ -97,12 +97,13 @@ export default class Bookmark extends RestModel {return this.pinned ? "unpin" : "pin";}- @discourseComputed("highest_post_number", "url")- lastPostUrl(highestPostNumber) {- return this.urlForPostNumber(highestPostNumber);+ @discourseComputed("topic_id", "highest_post_number", "bookmarkable_url")+ lastPostUrl(topic_id, highest_post_number, bookmarkable_url) {+ return topic_id+ ? this.urlForPostNumber(highest_post_number)+ : bookmarkable_url;}- // Helper to build a Url with a post numberurlForPostNumber(postNumber) {let url = getURL(`/t/${this.topic_id}`);if (postNumber > 0) {@@ -111,14 +112,9 @@ export default class Bookmark extends RestModel {return url;}- // returns createdAt if there's no bumped date@discourseComputed("bumped_at", "createdAt")bumpedAt(bumped_at, createdAt) {- if (bumped_at) {- return new Date(bumped_at);- } else {- return createdAt;- }+ return bumped_at ? new Date(bumped_at) : createdAt;}@discourseComputed("bumpedAt", "createdAt")