mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
correct ScreenTrack so it properly flushes everything that happened on stop and resets on start
This commit is contained in:
parent
cc79d22f82
commit
809594c00a
1 changed files with 5 additions and 2 deletions
|
@ -14,6 +14,9 @@ Discourse.ScreenTrack = Ember.Object.extend({
|
|||
},
|
||||
|
||||
start: function(topicId) {
|
||||
|
||||
this.reset();
|
||||
|
||||
// Create an interval timer if we don't have one.
|
||||
if (!this.get('interval')) {
|
||||
var screenTrack = this;
|
||||
|
@ -31,6 +34,7 @@ Discourse.ScreenTrack = Ember.Object.extend({
|
|||
},
|
||||
|
||||
stop: function() {
|
||||
this.tick();
|
||||
this.flush();
|
||||
this.reset();
|
||||
this.set('topicId', null);
|
||||
|
@ -60,7 +64,6 @@ Discourse.ScreenTrack = Ember.Object.extend({
|
|||
this.set('timings', {});
|
||||
this.set('totalTimings', {});
|
||||
this.set('topicTime', 0);
|
||||
this.set('cancelled', false);
|
||||
},
|
||||
|
||||
scrolled: function() {
|
||||
|
@ -77,6 +80,7 @@ Discourse.ScreenTrack = Ember.Object.extend({
|
|||
|
||||
// Update our total timings
|
||||
var totalTimings = this.get('totalTimings');
|
||||
|
||||
_.each(this.get('timings'), function(timing,key) {
|
||||
if (!totalTimings[timing.postNumber])
|
||||
totalTimings[timing.postNumber] = 0;
|
||||
|
@ -100,7 +104,6 @@ Discourse.ScreenTrack = Ember.Object.extend({
|
|||
Discourse.TopicTrackingState.current().updateSeen(topicId, highestSeen);
|
||||
}
|
||||
if (!$.isEmptyObject(newTimings)) {
|
||||
|
||||
Discourse.ajax('/topics/timings', {
|
||||
data: {
|
||||
timings: newTimings,
|
||||
|
|
Loading…
Reference in a new issue