chore: Move to prettier standard double quotes (#1309)
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
// @flow
|
||||
import type { DocumentEvent, IntegrationEvent, Event } from '../events';
|
||||
import { Document, Integration, Collection, Team } from '../models';
|
||||
import { presentSlackAttachment } from '../presenters';
|
||||
import type { DocumentEvent, IntegrationEvent, Event } from "../events";
|
||||
import { Document, Integration, Collection, Team } from "../models";
|
||||
import { presentSlackAttachment } from "../presenters";
|
||||
|
||||
export default class Slack {
|
||||
async on(event: Event) {
|
||||
switch (event.name) {
|
||||
case 'documents.publish':
|
||||
case 'documents.update':
|
||||
case "documents.publish":
|
||||
case "documents.update":
|
||||
return this.documentUpdated(event);
|
||||
case 'integrations.create':
|
||||
case "integrations.create":
|
||||
return this.integrationCreated(event);
|
||||
default:
|
||||
}
|
||||
@@ -19,14 +19,14 @@ export default class Slack {
|
||||
const integration = await Integration.findOne({
|
||||
where: {
|
||||
id: event.modelId,
|
||||
service: 'slack',
|
||||
type: 'post',
|
||||
service: "slack",
|
||||
type: "post",
|
||||
},
|
||||
include: [
|
||||
{
|
||||
model: Collection,
|
||||
required: true,
|
||||
as: 'collection',
|
||||
as: "collection",
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -36,9 +36,9 @@ export default class Slack {
|
||||
if (!collection) return;
|
||||
|
||||
await fetch(integration.settings.url, {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
text: `👋 Hey there! When documents are published or updated in the *${
|
||||
@@ -59,7 +59,7 @@ export default class Slack {
|
||||
async documentUpdated(event: DocumentEvent) {
|
||||
// lets not send a notification on every autosave update
|
||||
if (
|
||||
event.name === 'documents.update' &&
|
||||
event.name === "documents.update" &&
|
||||
event.data &&
|
||||
event.data.autosave
|
||||
) {
|
||||
@@ -67,7 +67,7 @@ export default class Slack {
|
||||
}
|
||||
|
||||
// lets not send a notification on every CMD+S update
|
||||
if (event.name === 'documents.update' && event.data && !event.data.done) {
|
||||
if (event.name === "documents.update" && event.data && !event.data.done) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -81,8 +81,8 @@ export default class Slack {
|
||||
where: {
|
||||
teamId: document.teamId,
|
||||
collectionId: document.collectionId,
|
||||
service: 'slack',
|
||||
type: 'post',
|
||||
service: "slack",
|
||||
type: "post",
|
||||
},
|
||||
});
|
||||
if (!integration) return;
|
||||
@@ -91,14 +91,14 @@ export default class Slack {
|
||||
|
||||
let text = `${document.createdBy.name} published a new document`;
|
||||
|
||||
if (event.name === 'documents.update') {
|
||||
if (event.name === "documents.update") {
|
||||
text = `${document.updatedBy.name} updated a document`;
|
||||
}
|
||||
|
||||
await fetch(integration.settings.url, {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
text,
|
||||
|
||||
Reference in New Issue
Block a user