Minor fixes

This commit is contained in:
Ben Gotow 2017-07-07 11:57:37 -07:00
parent c00cc1c882
commit 036d9f5943
5 changed files with 10 additions and 17 deletions

View file

@ -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

View file

@ -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();

View file

@ -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() {

View file

@ -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;
}
}

View file

@ -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,