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

Update subscription messages with respect to webhook #770

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ayusht2810
Copy link
Contributor

Summary

  • Update subscription message when user is not authorized to access webhooks
  • Update subscription message when there is no webhook present

Screenshots

  • When user is not authorized to access webhooks
Before

image

After

image

  • When there is no webhook present
Before

image

After

image

Ticket Link

Fixes #715
Fixes #732

What to test?

  • Create a subscription with the user who doesn't have access to create webhooks and verify the post
  • Similarly, create a subscription with no prior webhook present and verify the post

@ayusht2810 ayusht2810 self-assigned this Apr 26, 2024
@ayusht2810 ayusht2810 added the 2: Dev Review Requires review by a core committer label Apr 26, 2024
Comment on lines 458 to 464
found, foundErr := p.checkIfConfiguredWebhookExists(ctx, githubClient, repo, owner)
if foundErr != nil {
if strings.Contains(foundErr.Error(), "404 Not Found") {
return errorWebhookToUser
return subOrgMsg
}
return errors.Wrap(foundErr, "failed to get the list of webhooks").Error()
}
Copy link
Member

Choose a reason for hiding this comment

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

In the case where the user has access to check webhooks but there isn't one, do we get an error and 404 here? I wonder if there's a way to know if the user has permissions or not

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mickmister In the above case, we get no error and the value of found as false.

Copy link
Contributor

@hanzei hanzei left a comment

Choose a reason for hiding this comment

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

The changes LGTM, but let's document why the code works this way

server/plugin/command.go Outdated Show resolved Hide resolved
@ayusht2810
Copy link
Contributor Author

@hanzei added the comment for the above changes in the code. Please re-review

@hanzei hanzei requested a review from mickmister April 30, 2024 11:05
@hanzei hanzei removed the request for review from mickmister May 6, 2024 08:16
@hanzei hanzei added 4: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core committer labels May 6, 2024
@mickmister
Copy link
Member

It looks like the screenshots changed the behavior of public vs ephemeral messages. Is this the case?

image

@ayusht2810
Copy link
Contributor Author

@mickmister Are you talking about the first case where the user doesn't have access to webhooks? If yes, the screenshot was missing the part for the public message. I have added a screenshot for both the cases again:
Case 1:
image
Case 2:
image

@mickmister
Copy link
Member

@ayusht2810 The duplicated text between the public and ephemeral messages is a bit confusing. If there is an ephemeral message involved with the response, I think we should remove any duplicated text that also exists in the public post. If the entire message is duplicated, then we can just omit the ephemeral message in that case. What do you think?

@ayusht2810
Copy link
Contributor Author

@mickmister Updated the messages:
image
Let me know if anything else needs to be changed here.

@mickmister mickmister added 3: QA Review Requires review by a QA tester and removed 4: Reviews Complete All reviewers have approved the pull request labels May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3: QA Review Requires review by a QA tester
Projects
None yet
4 participants