-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: show managers in purple on grid
- Loading branch information
Showing
9 changed files
with
43 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,44 @@ | ||
import config from "~lib/config" | ||
import logger from "~lib/logger" | ||
import prisma from "~lib/prisma" | ||
import { EventMiddleware } from "~slack/lib/types" | ||
import config from '~lib/config' | ||
import logger from '~lib/logger' | ||
import prisma from '~lib/prisma' | ||
import { EventMiddleware } from '~slack/lib/types' | ||
|
||
export const handleAppMentioned: EventMiddleware<'app_mention'> = async ({ event, client }) => { | ||
if (event.channel == config.slack.channels.checkin) { | ||
await client.reactions.add({ | ||
channel: event.channel, | ||
timestamp: event.ts, | ||
name: "stopwatch" | ||
name: 'stopwatch' | ||
}) | ||
const user = await client.auth.test() | ||
const managers = await prisma.member.findMany({where: {MemberCerts: {some: {Cert: {isManager: true}}}}}) | ||
const copres_string = config.slack.users.copres.join(",") | ||
const managers = await prisma.member.findMany({ where: { MemberCerts: { some: { Cert: { isManager: true } } } } }) | ||
const copres_string = config.slack.users.copres.join(',') | ||
for (const manager of managers) { | ||
if (!manager.slack_id) { | ||
logger.warn("No slack id for manager "+manager.email) | ||
logger.warn('No slack id for manager ' + manager.email) | ||
continue | ||
} | ||
const dm = await client.conversations.open({ | ||
users: copres_string+","+manager.slack_id, | ||
users: copres_string + ',' + manager.slack_id | ||
}) | ||
if (dm.channel?.id == null) { | ||
logger.warn("No group dm for manager "+manager.email) | ||
logger.warn('No group dm for manager ' + manager.email) | ||
continue | ||
} | ||
await client.chat.postMessage({ | ||
channel:dm.channel!.id!, | ||
channel: dm.channel!.id!, | ||
text: event.text.replace(user.user_id!, manager.slack_id) | ||
}) | ||
} | ||
await client.reactions.remove({ | ||
channel: event.channel, | ||
timestamp: event.ts, | ||
name: "stopwatch" | ||
name: 'stopwatch' | ||
}) | ||
await client.reactions.add({ | ||
channel: event.channel, | ||
timestamp: event.ts, | ||
name: "white_check_mark" | ||
name: 'white_check_mark' | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters