FIX: Topic Timeline was impossible to close if you used the back button

This commit is contained in:
Robin Ward 2017-04-07 14:37:05 -04:00
parent ff530d6fb3
commit 616e1dcd16
2 changed files with 15 additions and 17 deletions

View File

@ -3,7 +3,12 @@ import showModal from 'discourse/lib/show-modal';
export default Ember.Component.extend({
composerOpen: null,
info: Em.Object.create(),
info: null,
init() {
this._super();
this.set('info', Ember.Object.create());
},
_performCheckSize() {
if (!this.element || this.isDestroying || this.isDestroyed) { return; }

View File

@ -154,8 +154,7 @@ createWidget('timeline-scrollarea', {
if (this.state.position !== result.current) {
this.state.position = result.current;
const timeline = this._findAncestorWithProperty('updatePosition');
timeline.updatePosition.call(timeline, result.current);
this.sendWidgetAction('updatePosition', result.current);
}
return result;
@ -287,8 +286,6 @@ export default createWidget('topic-timeline', {
this.state.position = pos;
this.state.excerpt = "";
this.scheduleRerender();
const stream = this.attrs.topic.get('postStream');
// a little debounce to avoid flashing
@ -300,7 +297,6 @@ export default createWidget('topic-timeline', {
// we have an off by one, stream is zero based,
// pos is 1 based
stream.excerpt(pos-1).then(info => {
if (info && this.state.position === pos) {
let excerpt = "";
@ -308,9 +304,7 @@ export default createWidget('topic-timeline', {
excerpt = "<span class='username'>" + info.username + ":</span> ";
}
excerpt += info.excerpt;
this.state.excerpt = excerpt;
this.state.excerpt = excerpt + info.excerpt;
this.scheduleRerender();
}
});
@ -332,16 +326,15 @@ export default createWidget('topic-timeline', {
}
let elems = [h('h2', this.attach('link', {
contents: ()=>titleHTML,
className: 'fancy-title',
action: 'jumpTop'}))];
contents: () => titleHTML,
className: 'fancy-title',
action: 'jumpTop'
}))];
if (this.state.excerpt) {
elems.push(
new RawHtml({
html: "<div class='post-excerpt'>" + this.state.excerpt + "</div>"
}));
elems.push(new RawHtml({
html: "<div class='post-excerpt'>" + this.state.excerpt + "</div>"
}));
}
result.push(h('div.title', elems));