From 951d6ac28f15bd0a5ca3fbfddccf0d50792bca84 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 30 Jun 2015 14:14:45 -0400 Subject: [PATCH] FIX: Don't reload a topic when clicking the first post search result --- app/assets/javascripts/discourse/models/post.js.es6 | 6 ++++++ .../discourse/templates/components/search-result-post.hbs | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/models/post.js.es6 b/app/assets/javascripts/discourse/models/post.js.es6 index 9e720b36d16..d7ee374c869 100644 --- a/app/assets/javascripts/discourse/models/post.js.es6 +++ b/app/assets/javascripts/discourse/models/post.js.es6 @@ -50,6 +50,12 @@ const Post = RestModel.extend({ return Discourse.Utilities.postUrl(this.get('topic.slug') || this.get('topic_slug'), this.get('topic_id'), this.get('post_number')); }.property('post_number', 'topic_id', 'topic.slug'), + // Don't drop the /1 + urlWithNumber: function() { + const url = this.get('url'); + return (this.get('post_number') === 1) ? url + "/1" : url; + }.property('post_number', 'url'), + usernameUrl: Discourse.computed.url('username', '/users/%@'), showUserReplyTab: function() { diff --git a/app/assets/javascripts/discourse/templates/components/search-result-post.hbs b/app/assets/javascripts/discourse/templates/components/search-result-post.hbs index da9737daf42..969ea53a65b 100644 --- a/app/assets/javascripts/discourse/templates/components/search-result-post.hbs +++ b/app/assets/javascripts/discourse/templates/components/search-result-post.hbs @@ -1,5 +1,6 @@ {{#each results as |result|}} - + {{log result}} + {{i18n 'search.post_format' post_number=result.post_number username=result.username}}