From d0cf1cc18576191b41adef645f9ebfc22955acc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Wed, 1 Apr 2020 15:52:24 +0200 Subject: [PATCH] Fix lint --- .../notifications/notificationsMiddleware.js | 14 +++++++------- .../notifications/notificationsMiddleware.spec.js | 2 +- backend/src/schema/resolvers/notifications.js | 4 ++-- webapp/components/Notification/Notification.vue | 2 +- .../NotificationsTable/NotificationsTable.spec.js | 2 +- .../NotificationsTable/NotificationsTable.vue | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/backend/src/middleware/notifications/notificationsMiddleware.js b/backend/src/middleware/notifications/notificationsMiddleware.js index 9b8494145..61db59e01 100644 --- a/backend/src/middleware/notifications/notificationsMiddleware.js +++ b/backend/src/middleware/notifications/notificationsMiddleware.js @@ -49,7 +49,7 @@ const postAuthorOfComment = async (commentId, { context }) => { { commentId }, ) }) - return postAuthorId.records.map(record => record.get('authorId')) + return postAuthorId.records.map((record) => record.get('authorId')) } catch (error) { debug(error) } finally { @@ -98,14 +98,14 @@ const notifyUsersOfMention = async (label, id, idsOfUsers, reason, context) => { RETURN notification {.*, from: finalResource, to: properties(user)} ` const session = context.driver.session() - const writeTxResultPromise = session.writeTransaction(async transaction => { + const writeTxResultPromise = session.writeTransaction(async (transaction) => { const notificationsTransactionResponse = await transaction.run(mentionedCypher, { id, idsOfUsers, reason, }) log(notificationsTransactionResponse) - return notificationsTransactionResponse.records.map(record => record.get('notification')) + return notificationsTransactionResponse.records.map((record) => record.get('notification')) }) try { const notifications = await writeTxResultPromise @@ -121,7 +121,7 @@ const notifyUsersOfComment = async (label, commentId, postAuthorId, reason, cont if (context.user.id === postAuthorId) return [] await validateNotifyUsers(label, reason) const session = context.driver.session() - const writeTxResultPromise = await session.writeTransaction(async transaction => { + const writeTxResultPromise = await session.writeTransaction(async (transaction) => { const notificationsTransactionResponse = await transaction.run( ` MATCH (postAuthor:User {id: $postAuthorId})-[:WROTE]->(post:Post)<-[:COMMENTS]-(comment:Comment { id: $commentId })<-[:WROTE]-(commenter:User) @@ -137,7 +137,7 @@ const notifyUsersOfComment = async (label, commentId, postAuthorId, reason, cont { commentId, postAuthorId, reason }, ) log(notificationsTransactionResponse) - return notificationsTransactionResponse.records.map(record => record.get('notification')) + return notificationsTransactionResponse.records.map((record) => record.get('notification')) }) try { const notifications = await writeTxResultPromise @@ -164,7 +164,7 @@ const handleFileReport = async (resolve, root, args, context, resolveInfo) => { const notifyReportFiler = async (reportId, resourceId, context) => { const { driver, user } = context const session = driver.session() - const writeTxResultPromise = await session.writeTransaction(async transaction => { + const writeTxResultPromise = await session.writeTransaction(async (transaction) => { const notificationsTransactionResponse = await transaction.run( ` MATCH (resource {id: $resourceId})<-[:BELONGS_TO]-(report:Report {id: $reportId})<-[filed:FILED]-(submitter:User {id: $submitterId}) @@ -185,7 +185,7 @@ const notifyReportFiler = async (reportId, resourceId, context) => { }, ) log(notificationsTransactionResponse) - return notificationsTransactionResponse.records.map(record => record.get('notification')) + return notificationsTransactionResponse.records.map((record) => record.get('notification')) }) try { const [notification] = await writeTxResultPromise diff --git a/backend/src/middleware/notifications/notificationsMiddleware.spec.js b/backend/src/middleware/notifications/notificationsMiddleware.spec.js index 87d24249c..884848c1b 100644 --- a/backend/src/middleware/notifications/notificationsMiddleware.spec.js +++ b/backend/src/middleware/notifications/notificationsMiddleware.spec.js @@ -656,7 +656,7 @@ describe('notifications', () => { }) authenticatedUser = await notifiedUser.toJson() } - const setExpectedNotificationOfReportedResource = resource => { + const setExpectedNotificationOfReportedResource = (resource) => { return expect.objectContaining({ data: { notifications: [ diff --git a/backend/src/schema/resolvers/notifications.js b/backend/src/schema/resolvers/notifications.js index ee08f0e4f..424bbe8af 100644 --- a/backend/src/schema/resolvers/notifications.js +++ b/backend/src/schema/resolvers/notifications.js @@ -135,12 +135,12 @@ export default { // $ {offset} $ {limit} ` - const readTxResultPromise = session.readTransaction(async transaction => { + const readTxResultPromise = session.readTransaction(async (transaction) => { const notificationsTransactionResponse = await transaction.run(cypher, { id: currentUser.id, }) log(notificationsTransactionResponse) - const notifications = notificationsTransactionResponse.records.map(record => + const notifications = notificationsTransactionResponse.records.map((record) => record.get('notification'), ) return notifications diff --git a/webapp/components/Notification/Notification.vue b/webapp/components/Notification/Notification.vue index 4fb6564e2..0917cb72b 100644 --- a/webapp/components/Notification/Notification.vue +++ b/webapp/components/Notification/Notification.vue @@ -117,7 +117,7 @@ {{ notificationData.report.reasonDescription }} diff --git a/webapp/components/NotificationsTable/NotificationsTable.spec.js b/webapp/components/NotificationsTable/NotificationsTable.spec.js index 69c2d3799..279943d89 100644 --- a/webapp/components/NotificationsTable/NotificationsTable.spec.js +++ b/webapp/components/NotificationsTable/NotificationsTable.spec.js @@ -160,7 +160,7 @@ describe('NotificationsTable.vue', () => { it('renders the reason for the notification', () => { const dsTexts = thirdRowNotification.findAll('.ds-text') const reason = dsTexts.filter( - element => element.text() === 'notifications.reason.filed_report_on_resource.user', + (element) => element.text() === 'notifications.reason.filed_report_on_resource.user', ) expect(reason.exists()).toBe(true) }) diff --git a/webapp/components/NotificationsTable/NotificationsTable.vue b/webapp/components/NotificationsTable/NotificationsTable.vue index 56cc3451a..aec2223a8 100644 --- a/webapp/components/NotificationsTable/NotificationsTable.vue +++ b/webapp/components/NotificationsTable/NotificationsTable.vue @@ -107,7 +107,7 @@ export default { } }, notificationsData() { - return this.notifications.map(notification => + return this.notifications.map((notification) => extractNotificationDataOfCurrentUser(notification, this.currentUser), ) },