chore: Move to prettier standard double quotes (#1309)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// @flow
|
||||
import { Document, Collection, Event } from '../models';
|
||||
import { sequelize } from '../sequelize';
|
||||
import { type Context } from 'koa';
|
||||
import { Document, Collection, Event } from "../models";
|
||||
import { sequelize } from "../sequelize";
|
||||
import { type Context } from "koa";
|
||||
|
||||
export default async function documentMover({
|
||||
user,
|
||||
@@ -77,7 +77,7 @@ export default async function documentMover({
|
||||
await transaction.commit();
|
||||
|
||||
await Event.create({
|
||||
name: 'documents.move',
|
||||
name: "documents.move",
|
||||
actorId: user.id,
|
||||
documentId: document.id,
|
||||
collectionId,
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
/* eslint-disable flowtype/require-valid-file-annotation */
|
||||
import documentMover from '../commands/documentMover';
|
||||
import { flushdb, seed } from '../test/support';
|
||||
import { buildDocument, buildCollection } from '../test/factories';
|
||||
import documentMover from "../commands/documentMover";
|
||||
import { flushdb, seed } from "../test/support";
|
||||
import { buildDocument, buildCollection } from "../test/factories";
|
||||
|
||||
beforeEach(flushdb);
|
||||
|
||||
describe('documentMover', async () => {
|
||||
const ip = '127.0.0.1';
|
||||
describe("documentMover", async () => {
|
||||
const ip = "127.0.0.1";
|
||||
|
||||
it('should move within a collection', async () => {
|
||||
it("should move within a collection", async () => {
|
||||
const { document, user, collection } = await seed();
|
||||
|
||||
const response = await documentMover({
|
||||
@@ -22,15 +22,15 @@ describe('documentMover', async () => {
|
||||
expect(response.documents.length).toEqual(1);
|
||||
});
|
||||
|
||||
it('should move with children', async () => {
|
||||
it("should move with children", async () => {
|
||||
const { document, user, collection } = await seed();
|
||||
const newDocument = await buildDocument({
|
||||
parentDocumentId: document.id,
|
||||
collectionId: collection.id,
|
||||
teamId: collection.teamId,
|
||||
userId: collection.creatorId,
|
||||
title: 'Child document',
|
||||
text: 'content',
|
||||
title: "Child document",
|
||||
text: "content",
|
||||
});
|
||||
await collection.addDocumentToStructure(newDocument);
|
||||
|
||||
@@ -50,7 +50,7 @@ describe('documentMover', async () => {
|
||||
expect(response.documents.length).toEqual(1);
|
||||
});
|
||||
|
||||
it('should move with children to another collection', async () => {
|
||||
it("should move with children to another collection", async () => {
|
||||
const { document, user, collection } = await seed();
|
||||
const newCollection = await buildCollection({
|
||||
teamId: collection.teamId,
|
||||
@@ -60,8 +60,8 @@ describe('documentMover', async () => {
|
||||
collectionId: collection.id,
|
||||
teamId: collection.teamId,
|
||||
userId: collection.creatorId,
|
||||
title: 'Child document',
|
||||
text: 'content',
|
||||
title: "Child document",
|
||||
text: "content",
|
||||
});
|
||||
await collection.addDocumentToStructure(newDocument);
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// @flow
|
||||
import { uniqBy } from 'lodash';
|
||||
import { User, Event, Team } from '../models';
|
||||
import mailer from '../mailer';
|
||||
import { sequelize } from '../sequelize';
|
||||
import { uniqBy } from "lodash";
|
||||
import { User, Event, Team } from "../models";
|
||||
import mailer from "../mailer";
|
||||
import { sequelize } from "../sequelize";
|
||||
|
||||
type Invite = { name: string, email: string, guest: boolean };
|
||||
|
||||
@@ -19,7 +19,7 @@ export default async function userInviter({
|
||||
|
||||
// filter out empties and obvious non-emails
|
||||
const compactedInvites = invites.filter(
|
||||
invite => !!invite.email.trim() && invite.email.match('@')
|
||||
invite => !!invite.email.trim() && invite.email.match("@")
|
||||
);
|
||||
|
||||
// normalize to lowercase and remove duplicates
|
||||
@@ -28,7 +28,7 @@ export default async function userInviter({
|
||||
...invite,
|
||||
email: invite.email.toLowerCase(),
|
||||
})),
|
||||
'email'
|
||||
"email"
|
||||
);
|
||||
|
||||
// filter out any existing users in the system
|
||||
@@ -63,7 +63,7 @@ export default async function userInviter({
|
||||
users.push(newUser);
|
||||
await Event.create(
|
||||
{
|
||||
name: 'users.invite',
|
||||
name: "users.invite",
|
||||
actorId: user.id,
|
||||
teamId: user.teamId,
|
||||
data: {
|
||||
|
||||
@@ -1,49 +1,49 @@
|
||||
/* eslint-disable flowtype/require-valid-file-annotation */
|
||||
import userInviter from '../commands/userInviter';
|
||||
import { flushdb } from '../test/support';
|
||||
import { buildUser } from '../test/factories';
|
||||
import userInviter from "../commands/userInviter";
|
||||
import { flushdb } from "../test/support";
|
||||
import { buildUser } from "../test/factories";
|
||||
|
||||
beforeEach(flushdb);
|
||||
|
||||
describe('userInviter', async () => {
|
||||
const ip = '127.0.0.1';
|
||||
describe("userInviter", async () => {
|
||||
const ip = "127.0.0.1";
|
||||
|
||||
it('should return sent invites', async () => {
|
||||
it("should return sent invites", async () => {
|
||||
const user = await buildUser();
|
||||
const response = await userInviter({
|
||||
invites: [{ email: 'test@example.com', name: 'Test' }],
|
||||
invites: [{ email: "test@example.com", name: "Test" }],
|
||||
user,
|
||||
ip,
|
||||
});
|
||||
expect(response.sent.length).toEqual(1);
|
||||
});
|
||||
|
||||
it('should filter empty invites', async () => {
|
||||
it("should filter empty invites", async () => {
|
||||
const user = await buildUser();
|
||||
const response = await userInviter({
|
||||
invites: [{ email: ' ', name: 'Test' }],
|
||||
invites: [{ email: " ", name: "Test" }],
|
||||
user,
|
||||
ip,
|
||||
});
|
||||
expect(response.sent.length).toEqual(0);
|
||||
});
|
||||
|
||||
it('should filter obviously bunk emails', async () => {
|
||||
it("should filter obviously bunk emails", async () => {
|
||||
const user = await buildUser();
|
||||
const response = await userInviter({
|
||||
invites: [{ email: 'notanemail', name: 'Test' }],
|
||||
invites: [{ email: "notanemail", name: "Test" }],
|
||||
user,
|
||||
ip,
|
||||
});
|
||||
expect(response.sent.length).toEqual(0);
|
||||
});
|
||||
|
||||
it('should not send duplicates', async () => {
|
||||
it("should not send duplicates", async () => {
|
||||
const user = await buildUser();
|
||||
const response = await userInviter({
|
||||
invites: [
|
||||
{ email: 'the@same.com', name: 'Test' },
|
||||
{ email: 'the@SAME.COM', name: 'Test' },
|
||||
{ email: "the@same.com", name: "Test" },
|
||||
{ email: "the@SAME.COM", name: "Test" },
|
||||
],
|
||||
user,
|
||||
ip,
|
||||
@@ -51,7 +51,7 @@ describe('userInviter', async () => {
|
||||
expect(response.sent.length).toEqual(1);
|
||||
});
|
||||
|
||||
it('should not send invites to existing team members', async () => {
|
||||
it("should not send invites to existing team members", async () => {
|
||||
const user = await buildUser();
|
||||
const response = await userInviter({
|
||||
invites: [{ email: user.email, name: user.name }],
|
||||
|
||||
Reference in New Issue
Block a user