diff --git a/app/assets/javascripts/discourse/components/topic-progress.js.es6 b/app/assets/javascripts/discourse/components/topic-progress.js.es6
index 938c7085494..8321d70148c 100644
--- a/app/assets/javascripts/discourse/components/topic-progress.js.es6
+++ b/app/assets/javascripts/discourse/components/topic-progress.js.es6
@@ -37,6 +37,13 @@ export default Ember.Component.extend({
}
},
+ @computed('progressPosition', 'topic.last_read_post_id')
+ showBackButton(position, lastReadId) {
+ if (!this.site.mobileView || !lastReadId) { return; }
+ const readPos = this.get('postStream.stream').indexOf(lastReadId) || 0;
+ return readPos > position;
+ },
+
@observes('postStream.stream.[]')
_updateBar() {
Ember.run.scheduleOnce('afterRender', this, this._updateProgressBar);
@@ -140,6 +147,10 @@ export default Ember.Component.extend({
actions: {
toggleExpansion() {
this.toggleProperty('expanded');
+ },
+
+ goBack() {
+ this.attrs.jumpToPost(this.get('topic.last_read_post_number'));
}
},
diff --git a/app/assets/javascripts/discourse/templates/components/topic-progress.hbs b/app/assets/javascripts/discourse/templates/components/topic-progress.hbs
index a64af643e7b..797e12f0738 100644
--- a/app/assets/javascripts/discourse/templates/components/topic-progress.hbs
+++ b/app/assets/javascripts/discourse/templates/components/topic-progress.hbs
@@ -1,3 +1,9 @@
+{{#if showBackButton}}
+
+ {{d-button label="topic.timeline.back" class="btn-primary progress-back" action="goBack"}}
+
+{{/if}}
+