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

[GH-593] Add feature flag for new pull requests #612

Closed
wants to merge 7 commits into from

Conversation

C-Deck
Copy link

@C-Deck C-Deck commented Nov 20, 2022

Summary

This pull request adds a new_pulls feature flag to the subscriptions command to only create notifications for new pull requests. This feature cannot be added if pulls is included. There is also some minor refactoring of the checks for conflicting features.

Ticket Link

Fixes #593

Clint Decker added 2 commits November 20, 2022 13:05
- Add new_pulls feature flag
- Add check for the flag in postPullRequestEvent
- Add check for conflicting flags and refactor the conflicting checks
to a helper function
@C-Deck C-Deck requested a review from hanzei as a code owner November 20, 2022 21:15
@mattermod
Copy link
Contributor

Hello @C-Deck,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

@codecov-commenter
Copy link

codecov-commenter commented Nov 20, 2022

Codecov Report

Base: 15.63% // Head: 15.91% // Increases project coverage by +0.27% 🎉

Coverage data is based on head (3721df9) compared to base (9f37670).
Patch coverage: 45.83% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #612      +/-   ##
==========================================
+ Coverage   15.63%   15.91%   +0.27%     
==========================================
  Files          15       15              
  Lines        5243     5259      +16     
==========================================
+ Hits          820      837      +17     
+ Misses       4380     4379       -1     
  Partials       43       43              
Impacted Files Coverage Δ
server/plugin/subscriptions.go 8.93% <0.00%> (-0.08%) ⬇️
server/plugin/webhook.go 0.86% <0.00%> (-0.01%) ⬇️
server/plugin/command.go 10.57% <61.11%> (+2.42%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

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.

Nice one 👍

One request on the naming

@@ -17,6 +17,7 @@ const (
featureIssues = "issues"
featurePulls = "pulls"
featurePullsMerged = "pulls_merged"
featurePullsCreated = "new_pulls"
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's follow the existing pattern and use pulls_new

Comment on lines +321 to 327
ok, conflictingFs := checkFeatureConflict(fs)
if !ok {
if len(conflictingFs) == 2 {
return fmt.Sprintf("Feature list cannot contain both %s and %s", conflictingFs[0], conflictingFs[1])
}
return fmt.Sprintf("Conflicting feature(s) provided: %s", strings.Join(conflictingFs, ","))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@hanzei hanzei added 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester labels Nov 22, 2022
Copy link
Member

@mickmister mickmister left a comment

Choose a reason for hiding this comment

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

Thanks for this great feature @C-Deck! LGTM, just one comment for discussion

server/plugin/command.go Outdated Show resolved Hide resolved
@hanzei hanzei removed the 2: Dev Review Requires review by a core committer label Dec 13, 2022
@mattermod
Copy link
Contributor

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

@hanzei
Copy link
Contributor

hanzei commented Feb 20, 2023

/update-branch

@hanzei hanzei added this to the v2.2.0 milestone Feb 20, 2023
@hanzei
Copy link
Contributor

hanzei commented Feb 20, 2023

@DHaussermann Gentle reminder to review the PR

@hanzei
Copy link
Contributor

hanzei commented Feb 21, 2023

/update-branch

@DHaussermann
Copy link

Hi @C-Deck,
Sorry for the delay in testing this. We're now looking to get another GitHub release out and we'd love to include your feture enhancement.

Functionally, this is working a I would expect 👍

  • The new feature only delivers the event for a new PR
  • Merged and Closed PRs deliver no event
  • No change to exiting pulls
  • Conflict checking is functional

I see that you did update the read-me. But Can you please also update the 2 in-product areas as well for the /help and the auto-complete suggestion help?
image
image

@mattermost-build
Copy link
Contributor

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

Copy link

@DHaussermann DHaussermann left a comment

Choose a reason for hiding this comment

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

This is blocked based on comment above.

@avas27JTG avas27JTG modified the milestones: v2.2.0, v2.3.0 Nov 9, 2023
@hanzei
Copy link
Contributor

hanzei commented Nov 9, 2023

Closing due to inactivity

@hanzei hanzei added Lifecycle/3:orphaned and removed Awaiting Submitter Action Blocked on the author 3: QA Review Requires review by a QA tester Lifecycle/2:inactive labels Nov 9, 2023
@hanzei hanzei removed this from the v2.3.0 milestone Nov 9, 2023
@hanzei hanzei closed this Nov 9, 2023
hanzei pushed a commit that referenced this pull request Dec 4, 2023
* [GH-593] Add feature flag for new pull requests
- Add new_pulls feature flag
- Add check for the flag in postPullRequestEvent
- Add check for conflicting flags and refactor the conflicting checks
to a helper function

* Add feature to README

* new_pulls -> pulls_new

* pulls_new -> pulls_merged

* Additional changes after code review in #612

* errMsg -> testFailureMessage

* Revert unnecessary changes

---------

Co-authored-by: Clint Decker <clint@tendosystems.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Just posting new pull requests
8 participants