-
Notifications
You must be signed in to change notification settings - Fork 59
[#400] Add issue reminder cron and Blade issue page #424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
azizu06
wants to merge
29
commits into
main
Choose a base branch
from
sprint-01/cron-issue-reminders
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
1b25baa
Add issue reminders cron job with channel mapping and due in x days g…
azizu06 9be1ed1
create helper for formatting channel reminder messages
azizu06 e4587ec
add webhook envs for new issue reminder channels
azizu06 43a2116
add new webhook url channels
azizu06 cf30b4a
add blade to cron env
azizu06 35d3b1f
run the issue reminder schedule
azizu06 98c8730
include dry runs for channel msgs
azizu06 1851491
extend getIssue api to inlcude related team and assignees
azizu06 9c82f41
add the owning team of each issue
azizu06 b6e7a0d
make minimal page for issue reminder hyperlink
azizu06 16d03a6
remove debugs
azizu06 68afef8
remove test logs
azizu06 50b6b2a
Merge branch 'main' into sprint-01/cron-issue-reminders
azizu06 bd34e54
add notfound redirect if issue url param doesnt exist
azizu06 66f6a72
update env configuration to make issue webhooks optional and add remi…
azizu06 e5e34ab
Merge branch 'sprint-01/cron-issue-reminders' of https://github.com/K…
azizu06 d8ea5a5
add Discord webhook integration for issue reminders and improve loggi…
azizu06 0f310ca
fix formatting
azizu06 12fd904
add logging message for cron when the reminder channels are disabled.
azizu06 8a2af3b
add page level perm check for reading issues
azizu06 14bf6c2
split long messages into chunks so it doesn't exceed Discord's web ho…
azizu06 01da610
add additional message truncation for discord webhook
azizu06 654b355
fix format
azizu06 afc409d
Remove webhook retry and change issue day grouping to EST time.
azizu06 d594678
add overdue day prefix to discord msg
azizu06 772ebbc
change overdue format
azizu06 539cd3e
again format
azizu06 641ad9f
fix spacing
azizu06 ad710c2
make a list non bulleted
azizu06 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| import { notFound, redirect } from "next/navigation"; | ||
| import { z } from "zod"; | ||
|
|
||
| import { auth } from "@forge/auth"; | ||
|
|
||
| import { SIGN_IN_PATH } from "~/consts"; | ||
| import { api } from "~/trpc/server"; | ||
|
|
||
| interface IssuePageProps { | ||
| params: Promise<{ | ||
| id: string; | ||
| }>; | ||
| } | ||
|
|
||
| export default async function IssuePage({ params }: IssuePageProps) { | ||
| const session = await auth(); | ||
| if (!session) redirect(SIGN_IN_PATH); | ||
|
|
||
| const hasAccess = await api.roles.hasPermission({ or: ["READ_ISSUES"] }); | ||
| if (!hasAccess) notFound(); | ||
|
|
||
| const { id } = await params; | ||
| if (!z.string().uuid().safeParse(id).success) notFound(); | ||
| let issue; | ||
| try { | ||
| issue = await api.issues.getIssue({ id }); | ||
| } catch { | ||
| notFound(); | ||
| } | ||
|
|
||
| return ( | ||
azizu06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <div className="container mx-auto max-w-4xl space-y-6 p-6 pb-16 lg:pt-40"> | ||
azizu06 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <div className="space-y-2"> | ||
| <p className="text-sm text-muted-foreground">Issue</p> | ||
| <h1 className="text-3xl font-bold tracking-tight">{issue.name}</h1> | ||
| </div> | ||
|
|
||
| <div className="grid gap-4 md:grid-cols-2"> | ||
| <div className="rounded-lg border p-4"> | ||
| <h2 className="font-semibold">Status</h2> | ||
| <p className="mt-2 text-muted-foreground">{issue.status}</p> | ||
| </div> | ||
|
|
||
| <div className="rounded-lg border p-4"> | ||
| <h2 className="font-semibold">Due Date</h2> | ||
| <p className="mt-2 text-muted-foreground"> | ||
| {issue.date | ||
| ? new Date(issue.date).toLocaleDateString() | ||
| : "No due date"} | ||
| </p> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className="rounded-lg border p-4"> | ||
| <h2 className="font-semibold">Team</h2> | ||
| <p className="mt-2 text-muted-foreground">{issue.team.name}</p> | ||
| </div> | ||
|
|
||
| <div className="rounded-lg border p-4"> | ||
| <h2 className="font-semibold">Description</h2> | ||
| <p className="mt-2 whitespace-pre-wrap text-muted-foreground"> | ||
| {issue.description} | ||
| </p> | ||
| </div> | ||
|
|
||
| <div className="grid gap-4 md:grid-cols-2"> | ||
| <div className="rounded-lg border p-4"> | ||
| <h2 className="font-semibold">Assignees</h2> | ||
| <div className="mt-2 text-muted-foreground"> | ||
| {issue.userAssignments.length > 0 ? ( | ||
| <ul className="space-y-1"> | ||
| {issue.userAssignments.map((assignment) => ( | ||
| <li key={assignment.userId}> | ||
| {assignment.user.name ?? assignment.user.discordUserId} | ||
| </li> | ||
| ))} | ||
| </ul> | ||
| ) : ( | ||
| <p>Unassigned</p> | ||
| )} | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className="rounded-lg border p-4"> | ||
| <h2 className="font-semibold">Visible Teams</h2> | ||
| <div className="mt-2 text-muted-foreground"> | ||
| {issue.teamVisibility.length > 0 ? ( | ||
| <ul className="space-y-1"> | ||
| {issue.teamVisibility.map((visibility) => ( | ||
| <li key={visibility.teamId}>{visibility.team.name}</li> | ||
| ))} | ||
| </ul> | ||
| ) : ( | ||
| <p>No team visibility rules</p> | ||
| )} | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className="rounded-lg border p-4"> | ||
| <h2 className="font-semibold">Links</h2> | ||
| <div className="mt-2 text-muted-foreground"> | ||
| {issue.links && issue.links.length > 0 ? ( | ||
| <ul className="space-y-1"> | ||
| {issue.links.map((link) => ( | ||
| <li key={link}> | ||
| <a | ||
| href={link} | ||
| target="_blank" | ||
| rel="noreferrer" | ||
| className="text-primary underline underline-offset-4" | ||
| > | ||
| {link} | ||
| </a> | ||
| </li> | ||
| ))} | ||
| </ul> | ||
| ) : ( | ||
| <p>No links</p> | ||
| )} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.