mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-27 02:19:46 +08:00
fix(lint): fix linter issues
This commit is contained in:
parent
1bd3fc74e9
commit
388fd455ea
10 changed files with 31 additions and 27 deletions
|
@ -2,7 +2,7 @@ import request from 'request';
|
|||
import {Actions} from 'nylas-exports';
|
||||
import {PLUGIN_ID, PLUGIN_URL} from './link-tracking-constants'
|
||||
|
||||
export default class LinkTrackingAfterSend{
|
||||
export default class LinkTrackingAfterSend {
|
||||
static post = Promise.promisify(request.post, {multiArgs: true});
|
||||
|
||||
static afterDraftSend({message}) {
|
||||
|
@ -34,4 +34,5 @@ export default class LinkTrackingAfterSend{
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import request from 'request';
|
||||
import {ComponentRegistry, ExtensionRegistry, Actions} from 'nylas-exports';
|
||||
import LinkTrackingButton from './link-tracking-button';
|
||||
import LinkTrackingComposerExtension from './link-tracking-composer-extension';
|
||||
|
|
|
@ -23,14 +23,13 @@ const testBody = `<body>${testContent}${quote}</body>`;
|
|||
const replacedBody = (accountId, messageUid, unquoted) => `<body>${replacedContent(accountId, messageUid)}${unquoted ? "" : quote}</body>`;
|
||||
|
||||
describe("Open tracking composer extension", () => {
|
||||
|
||||
// Set up a draft, session that returns the draft, and metadata
|
||||
beforeEach(()=>{
|
||||
this.draft = new Message({accountId: "test"});
|
||||
this.draft.body = testBody;
|
||||
this.session = {
|
||||
draft: () => this.draft,
|
||||
changes: jasmine.createSpyObj('changes', ['add', 'commit'])
|
||||
changes: jasmine.createSpyObj('changes', ['add', 'commit']),
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -83,3 +82,4 @@ describe("Open tracking composer extension", () => {
|
|||
})
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -34,4 +34,5 @@ export default class OpenTrackingAfterSend {
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,3 +52,4 @@ export default class OpenTrackingMessageStatus extends React.Component {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,14 +5,13 @@ import {Message, QuotedHTMLTransformer} from 'nylas-exports';
|
|||
const quote = `<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> On Feb 25 2016, at 3:38 pm, Drew <drew@nylas.com> wrote: <br> twst </blockquote>`;
|
||||
|
||||
describe("Open tracking composer extension", () => {
|
||||
|
||||
// Set up a draft, session that returns the draft, and metadata
|
||||
beforeEach(()=>{
|
||||
this.draft = new Message();
|
||||
this.draft.body = `<body>TEST_BODY ${quote}</body>`;
|
||||
this.session = {
|
||||
draft: () => this.draft,
|
||||
changes: jasmine.createSpyObj('changes', ['add', 'commit'])
|
||||
changes: jasmine.createSpyObj('changes', ['add', 'commit']),
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -60,5 +59,5 @@ describe("Open tracking composer extension", () => {
|
|||
OpenTrackingComposerExtension.finalizeSessionBeforeSending({session: this.session});
|
||||
expect(NylasEnv.reportError).toHaveBeenCalled()
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ function addOpenMetadata(obj, openCount) {
|
|||
|
||||
describe("Open tracking icon", () => {
|
||||
beforeEach(() => {
|
||||
this.thread = {metadata:[]};
|
||||
this.thread = {metadata: []};
|
||||
});
|
||||
|
||||
|
||||
|
@ -65,7 +65,6 @@ describe("Open tracking icon", () => {
|
|||
expect(icon.children.length).toEqual(1);
|
||||
expect(icon.querySelector("img.unopened")).not.toBeNull();
|
||||
expect(icon.querySelector("img.opened")).toBeNull();
|
||||
|
||||
});
|
||||
|
||||
it("shows an opened icon if all messages with metadata are opened", () => {
|
||||
|
@ -77,4 +76,5 @@ describe("Open tracking icon", () => {
|
|||
expect(icon.querySelector("img.opened")).not.toBeNull();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -51,4 +51,5 @@ describe("Open tracking message status", () => {
|
|||
expect(icon.querySelector("img.unopened")).toBeNull();
|
||||
expect(icon.querySelector("img.opened")).not.toBeNull();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -557,7 +557,6 @@ describe "ChangeMailTask", ->
|
|||
b.threads = ['t3', 't4', 't7']
|
||||
b.sequentialId = 1
|
||||
c = new ChangeMailTask()
|
||||
console.log([a,b,c].map((x) -> x.sequentialId))
|
||||
c.threads = ['t0', 't7']
|
||||
c.sequentialId = 2
|
||||
expect(a.isDependentOnTask(b)).toEqual(false)
|
||||
|
|
|
@ -30,23 +30,26 @@ const TaskFactory = {
|
|||
byAccount[accountId].threadsToUpdate.push(thread)
|
||||
})
|
||||
|
||||
_.each(byAccount, ({categoriesToAdd, categoriesToRemove, threadsToUpdate}, accountId)=> {
|
||||
const account = AccountStore.accountForId(accountId)
|
||||
if (!(categoriesToAdd instanceof Array)) {
|
||||
throw new Error("tasksForApplyingCategories: `categoriesToAdd` must return an array of Categories")
|
||||
_.each(byAccount, (data, accountId) => {
|
||||
const catToAdd = data.categoriesToAdd;
|
||||
const catToRemove = data.categoriesToRemove;
|
||||
const threadsToUpdate = data.threadsToUpdate;
|
||||
const account = AccountStore.accountForId(accountId);
|
||||
if (!(catToAdd instanceof Array)) {
|
||||
throw new Error("tasksForApplyingCategories: `catToAdd` must return an array of Categories")
|
||||
}
|
||||
if (!(categoriesToRemove instanceof Array)) {
|
||||
throw new Error("tasksForApplyingCategories: `categoriesToRemove` must return an array of Categories")
|
||||
if (!(catToRemove instanceof Array)) {
|
||||
throw new Error("tasksForApplyingCategories: `catToRemove` must return an array of Categories")
|
||||
}
|
||||
|
||||
if (account.usesFolders()) {
|
||||
if (categoriesToAdd.length === 0) return;
|
||||
if (categoriesToAdd.length > 1) {
|
||||
throw new Error("tasksForApplyingCategories: `categoriesToAdd` must return a single `Category` (folder) for Exchange accounts")
|
||||
if (catToAdd.length === 0) return;
|
||||
if (catToAdd.length > 1) {
|
||||
throw new Error("tasksForApplyingCategories: `catToAdd` must return a single `Category` (folder) for Exchange accounts")
|
||||
}
|
||||
const folder = categoriesToAdd[0]
|
||||
const folder = catToAdd[0]
|
||||
if (!(folder instanceof Category)) {
|
||||
throw new Error("tasksForApplyingCategories: `categoriesToAdd` must return a Categories")
|
||||
throw new Error("tasksForApplyingCategories: `catToAdd` must return a Categories")
|
||||
}
|
||||
|
||||
tasks.push(new ChangeFolderTask({
|
||||
|
@ -55,8 +58,8 @@ const TaskFactory = {
|
|||
taskDescription,
|
||||
}))
|
||||
} else {
|
||||
const labelsToAdd = categoriesToAdd
|
||||
const labelsToRemove = categoriesToRemove
|
||||
const labelsToAdd = catToAdd
|
||||
const labelsToRemove = catToRemove
|
||||
if (labelsToAdd.length === 0 && labelsToRemove.length === 0) return;
|
||||
|
||||
tasks.push(new ChangeLabelsTask({
|
||||
|
|
Loading…
Reference in a new issue