FIX: Ensure first post is loaded before trying to bookmark topic (PR #9382)

Load first post if not loaded when trying to bookmark topic

  • if the first post was not loaded we could not bookmark it because now we call the toggleBookmarkReminder function on an actual post to open the modal window
  • add a firstPost function to the topic model to get the first post from the stream if it is loaded and if not do a GET request to load it
  • use the firstPost promise when bookmarking topic

GitHub

can be one line

can’t we just do this.model ?

    if (firstPost.post_number === 1) {
                    post.bookmarked_with_reminder
                  if (post.bookmarked) {
            (post.bookmarked || post.bookmarked_with_reminder) &&

I know this is not related to this PR, but shouldn’t removing a bookmark be a DELETE request and not a PUT ?

Any reason we don’t do this.postStream.posts here ?

Good point, will open another PR to fix this

This pull request has been mentioned on Discourse Meta. There might be relevant details there: