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

Implement embeds by issueId #329

Merged
merged 6 commits into from
Dec 4, 2024
Merged

Implement embeds by issueId #329

merged 6 commits into from
Dec 4, 2024

Conversation

zuuring
Copy link
Member

@zuuring zuuring commented Nov 26, 2024

Notes

This implements a new feature to embed linear links based off of the issueId if it's placed in a message, such as THESIS-123.

Additionally this adds a function to delete the embed if the original message link is deleted / changed.

Still need to implement editing the original embed if it changes.

### Notes
This implements a new feature to embed linear links based off of the `issueId` if it's placed in a message, such as `THESIS-123`.

Additionally this adds a function to delete the embed if the original message link is deleted / changed.

Still need to implement editing the original embed if it changes.
This will now pull in the issue tags dynamically from the Linear API rather than having to define it in `ISSUE_PREFIXES`
Let's switch the `robot.logger.info` into `robot.logger.debug`
This adds support for editing the embeds if the original message is updated with changed issues. Ready to roll out for testing.

Adds support to `issueTagRegex` for different cased issues like `iSsUe-111` or `ISSUE-111`
@zuuring zuuring requested a review from Shadowfiend November 29, 2024 12:14
@zuuring zuuring marked this pull request as ready for review November 29, 2024 12:14
@zuuring
Copy link
Member Author

zuuring commented Nov 29, 2024

Calling this one ready for review/merge. There is likely some edge cases to resolve but I suppose we can iterate further! I've implemented editing embeds and also grabbing issue ISSUE-111 prefixes automatically from the LinearSDK. So you can load an issue by simply typing in your message iSsUe-111 ISSUE-111 issue-111

const embedPromises = matches.map(async (match) => {
const uniqueMatches = new Set<string>()

urlMatches.forEach((match) => {
const teamName = match[1]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for all of these you can use named capturing groups.

This resolves the issues with excessive json calls and fixing up the regex patterns as per review!

function initializeIssueTagRegex() {
issueTagRegex =
/(?<!https:\/\/linear\.app\/[a-zA-Z0-9-]+\/issue\/)[A-Z]{3,}-\d+\b/gi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point we can just put this in a const rather than initializing, right?

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.

Left one more note but I think it's minor, let's :shipit:

@Shadowfiend Shadowfiend merged commit 1734d11 into main Dec 4, 2024
7 checks passed
@Shadowfiend Shadowfiend deleted the linear-embed-issues branch December 4, 2024 21:05
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