-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add Linear embed support for projects/updates #334
Conversation
### Notes This does some refactoring and adds support for project URLs to extract embeds. Still to add projectUpdates into the mix.
This adds a parser so that we can process project updates with a url suffixed by `#projectUpdates-id` in the regex rules.
teamName?: string | ||
projectId?: string | ||
projectUpdateId?: string | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this object ever have all of these fields? If not, are we looking more for a type like:
{
issueId: string
teamName?: string
commentId?: string
} |
{
projectId: string
projectUpdateId?: string
}
embed | ||
.setTitle(`Project: ${project.name}`) | ||
.setURL( | ||
`https://linear.app/${teamName}/project/${projectId}/overview`, | ||
) | ||
.setDescription( | ||
truncateToWords( | ||
project.description, | ||
"No description available.", | ||
50, | ||
), | ||
) | ||
.setTimestamp(new Date(project.updatedAt)) | ||
if (update) { | ||
embed | ||
.setTitle( | ||
`Project Update: ${project.name} - ${new Date( | ||
project.updatedAt, | ||
).toLocaleString()}`, | ||
) | ||
.setURL( | ||
`https://linear.app/${teamName}/project/${projectId}#projectUpdate-${projectUpdateId}`, | ||
) | ||
.setDescription( | ||
truncateToWords(update?.body, "No description available.", 50), | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like an if/else would be less brittle than setting than overwriting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a note around the right typing and flow control here, but none of it is blocking. Let's 🚢
Notes
This does some refactoring and adds support for project URLs as well as project updates. We parse URLs with
/project/
and then if suffixed by#projectUpdates-id
, we embed the proper information from the project update.