mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 04:52:45 +08:00
FIX: Don't give weird progress numbers when there are deleted posts.
This commit is contained in:
parent
b37fae50e3
commit
0c259af374
|
@ -220,12 +220,13 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected
|
|||
},
|
||||
|
||||
jumpTopDisabled: function() {
|
||||
return (this.get('progressPosition') === 1);
|
||||
}.property('postStream.filteredPostsCount', 'progressPosition'),
|
||||
return (this.get('progressPosition') <= 3);
|
||||
}.property('progressPosition'),
|
||||
|
||||
jumpBottomDisabled: function() {
|
||||
return this.get('progressPosition') >= this.get('postStream.filteredPostsCount');
|
||||
}.property('postStream.filteredPostsCount', 'progressPosition'),
|
||||
return this.get('progressPosition') >= this.get('postStream.filteredPostsCount') ||
|
||||
this.get('progressPosition') >= this.get('highest_post_number');
|
||||
}.property('postStream.filteredPostsCount', 'highest_post_number', 'progressPosition'),
|
||||
|
||||
canMergeTopic: function() {
|
||||
if (!this.get('details.can_move_posts')) return false;
|
||||
|
@ -269,9 +270,9 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected
|
|||
|
||||
streamPercentage: function() {
|
||||
if (!this.get('postStream.loaded')) { return 0; }
|
||||
if (this.get('postStream.filteredPostsCount') === 0) { return 0; }
|
||||
return this.get('progressPosition') / this.get('postStream.filteredPostsCount');
|
||||
}.property('postStream.loaded', 'progressPosition', 'postStream.filteredPostsCount'),
|
||||
if (this.get('postStream.highest_post_number') === 0) { return 0; }
|
||||
return this.get('progressPosition') / this.get('highest_post_number');
|
||||
}.property('postStream.loaded', 'progressPosition', 'highest_post_number'),
|
||||
|
||||
multiSelectChanged: function() {
|
||||
// Deselect all posts when multi select is turned off
|
||||
|
|
|
@ -188,7 +188,7 @@ Discourse.PostStream = Em.Object.extend({
|
|||
var stream = this.get('stream');
|
||||
var lastIndex = this.indexOf(lastLoadedPost);
|
||||
if (lastIndex === -1) { return []; }
|
||||
if ((lastIndex + 1) >= this.get('filteredPostsCount')) { return []; }
|
||||
if ((lastIndex + 1) >= this.get('highest_post_number')) { return []; }
|
||||
|
||||
// find our window of posts
|
||||
return stream.slice(lastIndex+1, lastIndex+Discourse.SiteSettings.posts_per_page+1);
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
<nav id='topic-progress' title="{{i18n topic.progress.title}}" {{bindAttr class="hideProgress:hidden"}}>
|
||||
<button id='jump-top' title="{{i18n topic.progress.jump_top}}" {{bindAttr disabled="jumpTopDisabled"}} {{action jumpTop}}><i class="icon-circle-arrow-up"></i></button>
|
||||
<div class='nums'>
|
||||
<h4 title="{{i18n topic.progress.current}}">{{progressPosition}}</h4> <span>{{i18n of_value}}</span> <h4>{{postStream.filteredPostsCount}}</h4>
|
||||
<h4 title="{{i18n topic.progress.current}}">{{progressPosition}}</h4> <span>{{i18n of_value}}</span> <h4>{{highest_post_number}}</h4>
|
||||
</div>
|
||||
<button id='jump-bottom' title="{{i18n topic.progress.jump_bottom}}" {{bindAttr disabled="jumpBottomDisabled"}} {{action jumpBottom}}><i class="icon-circle-arrow-down"></i></button>
|
||||
<div class='bg'> </div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user