Skip to content

Update subscription messages with respect to webhook - #770

Merged
raghavaggarwal2308 merged 4 commits into
masterfrom
update_subscription_message
Jul 2, 2024
Merged

raghavaggarwal2308 merged 4 commits into
masterfrom
update_subscription_message

Conversation

@ayusht2810

Copy link
Copy Markdown
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 thread server/plugin/command.go
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
Copy Markdown
Contributor

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
Copy Markdown
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.

@hanzei hanzei left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread server/plugin/command.go
@ayusht2810

Copy link
Copy Markdown
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
Copy Markdown
Contributor

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

image

@ayusht2810

Copy link
Copy Markdown
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
Copy Markdown
Contributor

@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
Copy Markdown
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

@AayushChaudhary0001 AayushChaudhary0001 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This PR has been tested for the following scenarios:

  • Checked the updated subscription message when user is not authorized to access webhooks
  • Checked the updated subscription message when there is no webhook present

The PR was working fine for both the conditions. LGTM. Approved

@raghavaggarwal2308
raghavaggarwal2308 merged commit 2d1479b into master Jul 2, 2024
@raghavaggarwal2308
raghavaggarwal2308 deleted the update_subscription_message branch July 2, 2024 07:20
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

Development

Successfully merging this pull request may close these issues.

Ephemeral message "Not able to get list of webhooks" after creating a subscription Clarify subscribe message when there is no webhook found

5 participants