Skip to content
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

Merged
merged 2 commits into from
Jan 14, 2025
Merged

Conversation

zuuring
Copy link
Member

@zuuring zuuring commented Dec 17, 2024

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.

### 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.
@zuuring zuuring marked this pull request as ready for review December 19, 2024 13:13
@zuuring zuuring requested a review from Shadowfiend December 19, 2024 13:15
@zuuring zuuring changed the title Add support for projects/updates Add Linear embed support for projects/updates Dec 19, 2024
teamName?: string
projectId?: string
projectUpdateId?: string
}
Copy link
Contributor

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
}

Comment on lines +86 to +112
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),
)
}
Copy link
Contributor

@Shadowfiend Shadowfiend Jan 14, 2025

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.

Copy link
Contributor

@Shadowfiend Shadowfiend left a 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 🚢

@Shadowfiend Shadowfiend merged commit 43b08fb into main Jan 14, 2025
7 checks passed
@Shadowfiend Shadowfiend deleted the linear-embed-changes branch January 14, 2025 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants