diff --git a/packages/client-app/internal_packages/thread-list/lib/thread-list-participants.cjsx b/packages/client-app/internal_packages/thread-list/lib/thread-list-participants.cjsx index 425286d92..bea94efbd 100644 --- a/packages/client-app/internal_packages/thread-list/lib/thread-list-participants.cjsx +++ b/packages/client-app/internal_packages/thread-list/lib/thread-list-participants.cjsx @@ -42,7 +42,7 @@ class ThreadListParticipants extends React.Component if spacer accumulate('...') else - if contact.name.length > 0 + if contact.name and contact.name.length > 0 if items.length > 1 short = contact.displayName(includeAccountLabel: false, compact: true) else @@ -52,6 +52,9 @@ class ThreadListParticipants extends React.Component if idx < items.length-1 and not items[idx+1].spacer short += ", " accumulate(short, unread) + + if not @props.thread.__messages + throw new Error("ThreadListParticipants requires __messages.") messages = (@props.thread.__messages ? []) if messages.length > 1 diff --git a/packages/client-app/spec/stores/draft-helpers-spec.es6 b/packages/client-app/spec/stores/draft-helpers-spec.es6 index 271044ffe..ced90b832 100644 --- a/packages/client-app/spec/stores/draft-helpers-spec.es6 +++ b/packages/client-app/spec/stores/draft-helpers-spec.es6 @@ -9,7 +9,7 @@ import SanitizeTransformer from '../../src/services/sanitize-transformer'; xdescribe('DraftHelpers', function describeBlock() { - describe('prepareDraftForSyncback', () => { + describe('draftPreparedForSyncback', () => { beforeEach(() => { spyOn(Actions, 'queueTask') }); @@ -30,7 +30,7 @@ xdescribe('DraftHelpers', function describeBlock() { spyOn(DraftHelpers, 'removeStaleUploads'); waitsForPromise(async () => { - await DraftHelpers.prepareDraftForSyncback(session); + await DraftHelpers.draftPreparedForSyncback(session); expect(session.ensureCorrectAccount).toHaveBeenCalled(); expect(DraftHelpers.applyExtensionTransforms).toHaveBeenCalled(); expect(DraftHelpers.removeStaleUploads).toHaveBeenCalled(); diff --git a/packages/client-app/src/flux/attributes/attribute-datetime.es6 b/packages/client-app/src/flux/attributes/attribute-datetime.es6 index 717d4b91e..eea17cf6f 100644 --- a/packages/client-app/src/flux/attributes/attribute-datetime.es6 +++ b/packages/client-app/src/flux/attributes/attribute-datetime.es6 @@ -18,7 +18,8 @@ export default class AttributeDateTime extends Attribute { } fromJSON(val) { - return val ? new Date(val * 1000) : null; + if (!val || val instanceof Date) { return val; } + return new Date(val * 1000); } columnSQL() { diff --git a/packages/client-app/src/flux/tasks/change-mail-task.es6 b/packages/client-app/src/flux/tasks/change-mail-task.es6 index 97d765e71..5915f07ed 100644 --- a/packages/client-app/src/flux/tasks/change-mail-task.es6 +++ b/packages/client-app/src/flux/tasks/change-mail-task.es6 @@ -1,6 +1,4 @@ import Task from './task'; -import Thread from '../models/thread'; -import Message from '../models/message'; /* Public: The ChangeMailTask is a base class for all tasks that modify sets @@ -68,16 +66,7 @@ export default class ChangeMailTask extends Task { return new this.constructor(this); } - objectIds() { - return [].concat(this.threadIds, this.messageIds); - } - - objectClass() { - return (this.threadIds && this.threadIds.length) ? Thread : Message; - } - numberOfImpactedItems() { - return this.objectIds().length; + return this.threadIds.length || this.messageIds.length; } - } diff --git a/packages/client-app/src/flux/tasks/change-starred-task.es6 b/packages/client-app/src/flux/tasks/change-starred-task.es6 index 4dc3adcaf..9fa3280b2 100644 --- a/packages/client-app/src/flux/tasks/change-starred-task.es6 +++ b/packages/client-app/src/flux/tasks/change-starred-task.es6 @@ -42,7 +42,7 @@ export default class ChangeStarredTask extends ChangeMailTask { if (this.source === "Mail Rules") { return } - const eventName = this.unread ? "Starred" : "Unstarred"; + const eventName = this.starred ? "Starred" : "Unstarred"; Actions.recordUserEvent(`Threads ${eventName}`, { source: this.source, numThreads: this.threadIds.length,