Skip to content

[Feature] Create GitHub Issues from Rocket.Chat channels#11

Merged
RonLek merged 8 commits intoRocketChat:mainfrom
samad-yar-khan:githubIssues
Aug 11, 2022
Merged

[Feature] Create GitHub Issues from Rocket.Chat channels#11
RonLek merged 8 commits intoRocketChat:mainfrom
samad-yar-khan:githubIssues

Conversation

@samad-yar-khan
Copy link
Copy Markdown
Contributor

@samad-yar-khan samad-yar-khan commented Jul 18, 2022

Issue(s)

closes #10

Acceptance Criteria fulfillment

  • Add slash command to open a new issues modal with input fields required to create an issue
  • Send Authenticated request to GitHub API to create a new issue
  • Handle edge cases with non authenticated developers
  • Repository owners can Add Assignees and Labels to the issue.

Proposed changes (including videos or screenshots)

  • Users can type /github new-issue to display a modal which takes input needed to create a new issue.
  • Notify users about created issue.
  • Repository owners can add assignees and labels to the issue.
  • Assignees and labels drop for users who dont have edit access to the repository.
2022-07-18.05-34-49.mp4

@samad-yar-khan
Copy link
Copy Markdown
Contributor Author

@RonLek @Sing-Li I have added the feature to fetch issue templates . I have also updated the slash command /github new-issue to github issue as it seemed it more intuitive, let me know if we should change back to the original slash command.

  • I have added two new methods to the GitHubSDK :
    • getIssueTemplates() : This method uses the GitHub Content API to fetch the files from .github/ISSUE_TEMPLATES directory location. If the location does not exits, we set template_not_found property of the response to true ,indicating that no issue templates exist.
    • getIssueTemplateCode() : This methods takes download_url of a fille on GitHub and returns the code on that file.
  • Whenever the user enters /github issue command, newIssueStarterModal will be triggered, and user will be prompted to enter repository name.
  • When user clicks on Next, we call getIssueTemplates() method. If templates exist, we trigger issueTemplateSelectionModal to display all the issue templates available.
  • When the user clicks on Select we use the getIssueTemplateCode() fetches the code for the selected template and triggers newIssueModal with the template code.
  • if issue templates do not exist on a repository, newIssueModal will be triggered with a blank template.

I have tested this with repositories which have issue templates and those without issue templates and have tried to handle all the edge cases. This was the only work-around I could think of, since there are no Template API as of now.

2022-07-23.00-04-18.mp4

Copy link
Copy Markdown
Contributor

@RonLek RonLek left a comment

Choose a reason for hiding this comment

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

Awesome work @samad-yar-khan . LGTM.

@RonLek RonLek added the enhancement New feature or request label Jul 25, 2022
Copy link
Copy Markdown
Member

@Sing-Li Sing-Li left a comment

Choose a reason for hiding this comment

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

Great that you've found the APIs for templates.

That was one major blocker for its use by members of our own Rocket.Chat team :)

8) View/Add/Delete/Update Repository Subscriptions -> /github subscribe
9) Subscribe to all repository events -> /github Username/RepositoryName subscribe
10) Unsubscribe to all repository events -> /github Username/RepositoryName unsubscribe
8) Logout from GitHub -> /github logout
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of having 7 and 8. Is it possible to have a better user experience of ....

a) logging in within the app settings session
b) from time to time, the app will ask the user to re-enter credential for security

The will gave a better "set and forget" experience to most users. Casual users will never be bothered with logging in and logging out.

Copy link
Copy Markdown
Contributor Author

@samad-yar-khan samad-yar-khan Jul 31, 2022

Choose a reason for hiding this comment

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

@Sing-Li We cannot have the login phase in the apps settings session because the app settings are only visible to the users which have Application Access given by the Server Admin so I don't think it will be convenient.

The logout feature will not be used by most users, its just there for convenience incase anyone wants to remove credentials from the server. The Login will be done by the user through the slash command, but they will only be prompted to login while using some feature which requires auth. Apart from that, using RC Scheduler we will automatically logout the user periodically and they will be sent a direct message by GitHub App bot to login again. It follows the similar workflow as you have mentioned in b), the user does not even have to enter credentials, they will be logged in directly once the click on the login button as the token is regenerated by GitHub. This was suggested by @RonLek to keep the system scalable and not store tokens forever in App Memory. I have added the reasoning behind it in Wiki/Auth.
Let me know if I am missing something, maybe we can improve the login user experience in some way, we can discuss this in the upcoming the weekly meeting 😅

@RonLek
Copy link
Copy Markdown
Contributor

RonLek commented Aug 11, 2022

Changes LGTM. Merging this in.

@RonLek RonLek merged commit 50e618d into RocketChat:main Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Create New GitHub Issues from Rocket.Chat

3 participants