mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 11:22:04 +00:00
drafts: Iterate over drafts with Object.entries.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
committed by
Tim Abbott
parent
0d05decbe4
commit
a9f5730270
@@ -189,11 +189,11 @@ const DRAFT_LIFETIME = 30;
|
||||
exports.remove_old_drafts = function () {
|
||||
const old_date = new Date().setDate(new Date().getDate() - DRAFT_LIFETIME);
|
||||
const drafts = draft_model.get();
|
||||
_.each(drafts, function (draft, id) {
|
||||
for (const [id, draft] of Object.entries(drafts)) {
|
||||
if (draft.updatedAt < old_date) {
|
||||
draft_model.deleteDraft(id);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
exports.format_draft = function (draft) {
|
||||
@@ -295,9 +295,9 @@ function remove_draft(draft_row) {
|
||||
|
||||
exports.launch = function () {
|
||||
function format_drafts(data) {
|
||||
_.each(data, function (draft, id) {
|
||||
for (const [id, draft] of Object.entries(data)) {
|
||||
draft.id = id;
|
||||
});
|
||||
}
|
||||
|
||||
const unsorted_raw_drafts = _.values(data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user