mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: remove topic timer info on completion
This commit is contained in:
parent
fbbce235ce
commit
efc05e7224
@ -23,60 +23,59 @@ export default Ember.Component.extend(
|
|||||||
const topicStatusKnown = this.topicClosed !== undefined;
|
const topicStatusKnown = this.topicClosed !== undefined;
|
||||||
if (topicStatusKnown && topicStatus === this.statusType) return;
|
if (topicStatusKnown && topicStatus === this.statusType) return;
|
||||||
|
|
||||||
let statusUpdateAt = moment(this.executeAt);
|
const statusUpdateAt = moment(this.executeAt);
|
||||||
|
const duration = moment.duration(statusUpdateAt - moment());
|
||||||
|
const minutesLeft = duration.asMinutes();
|
||||||
|
|
||||||
let duration = moment.duration(statusUpdateAt - moment());
|
if (minutesLeft > 0) {
|
||||||
let minutesLeft = duration.asMinutes();
|
let rerenderDelay = 1000;
|
||||||
let rerenderDelay = 1000;
|
if (minutesLeft > 2160) {
|
||||||
|
rerenderDelay = 12 * 60 * 60000;
|
||||||
|
} else if (minutesLeft > 1410) {
|
||||||
|
rerenderDelay = 60 * 60000;
|
||||||
|
} else if (minutesLeft > 90) {
|
||||||
|
rerenderDelay = 30 * 60000;
|
||||||
|
} else if (minutesLeft > 2) {
|
||||||
|
rerenderDelay = 60000;
|
||||||
|
}
|
||||||
|
let autoCloseHours = this.duration || 0;
|
||||||
|
|
||||||
if (minutesLeft > 2160) {
|
buffer.push(`<h3>${iconHTML("far-clock")} `);
|
||||||
rerenderDelay = 12 * 60 * 60000;
|
|
||||||
} else if (minutesLeft > 1410) {
|
|
||||||
rerenderDelay = 60 * 60000;
|
|
||||||
} else if (minutesLeft > 90) {
|
|
||||||
rerenderDelay = 30 * 60000;
|
|
||||||
} else if (minutesLeft > 2) {
|
|
||||||
rerenderDelay = 60000;
|
|
||||||
}
|
|
||||||
|
|
||||||
let autoCloseHours = this.duration || 0;
|
let options = {
|
||||||
|
timeLeft: duration.humanize(true),
|
||||||
|
duration: moment.duration(autoCloseHours, "hours").humanize()
|
||||||
|
};
|
||||||
|
|
||||||
buffer.push(`<h3>${iconHTML("far-clock")} `);
|
const categoryId = this.categoryId;
|
||||||
|
if (categoryId) {
|
||||||
|
const category = Category.findById(categoryId);
|
||||||
|
|
||||||
let options = {
|
options = Object.assign(
|
||||||
timeLeft: duration.humanize(true),
|
{
|
||||||
duration: moment.duration(autoCloseHours, "hours").humanize()
|
categoryName: category.get("slug"),
|
||||||
};
|
categoryUrl: category.get("url")
|
||||||
|
},
|
||||||
|
options
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const categoryId = this.categoryId;
|
buffer.push(
|
||||||
|
`<span title="${moment(this.executeAt).format("LLLL")}">${I18n.t(
|
||||||
if (categoryId) {
|
this._noticeKey(),
|
||||||
const category = Category.findById(categoryId);
|
options
|
||||||
|
)}</span>`
|
||||||
options = Object.assign(
|
|
||||||
{
|
|
||||||
categoryName: category.get("slug"),
|
|
||||||
categoryUrl: category.get("url")
|
|
||||||
},
|
|
||||||
options
|
|
||||||
);
|
);
|
||||||
}
|
buffer.push("</h3>");
|
||||||
|
|
||||||
buffer.push(
|
// TODO Sam: concerned this can cause a heavy rerender loop
|
||||||
`<span title="${moment(this.executeAt).format("LLLL")}">${I18n.t(
|
if (!Ember.testing) {
|
||||||
this._noticeKey(),
|
this._delayedRerender = Ember.run.later(
|
||||||
options
|
this,
|
||||||
)}</span>`
|
this.rerender,
|
||||||
);
|
rerenderDelay
|
||||||
buffer.push("</h3>");
|
);
|
||||||
|
}
|
||||||
// TODO Sam: concerned this can cause a heavy rerender loop
|
|
||||||
if (!Ember.testing) {
|
|
||||||
this._delayedRerender = Ember.run.later(
|
|
||||||
this,
|
|
||||||
this.rerender,
|
|
||||||
rerenderDelay
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user