Skip to content

Commit

Permalink
fix: Merger PR cancels gamification for user - MEED-2441 - Meeds-io/M…
Browse files Browse the repository at this point in the history
…IPs#64 (#99)

Prior to this change, the PR merger was considered as closing a PR event and canceling a gamification
  • Loading branch information
AzmiTouil committed Sep 20, 2023
1 parent fa89192 commit abbbc7a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public List<Event> getEvents(Map<String, Object> payload) {
String objectId = extractSubItem(payload, PULL_REQUEST, HTML_URL);
if (Objects.equals(extractSubItem(payload, ACTION), OPENED)) {
return Collections.singletonList(new Event(CREATE_PULL_REQUEST_EVENT_NAME, null, userId, objectId, PR_TYPE));
} else if (Objects.equals(extractSubItem(payload, ACTION), CLOSED)) {
} else if (Objects.equals(extractSubItem(payload, ACTION), CLOSED)
&& !Boolean.parseBoolean(extractSubItem(payload, PULL_REQUEST, MERGED))) {
return Collections.singletonList(new Event(CLOSE_PULL_REQUEST_EVENT_NAME, null, userId, objectId, PR_TYPE));
} else if (Objects.equals(extractSubItem(payload, ACTION), REVIEW_REQUESTED)) {
String requestedReviewer = extractSubItem(payload, REQUESTED_REVIEWER, LOGIN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ public class Utils {

public static final String UNLABELED = "unlabeled";

public static final String MERGED = "merged";

public static final String REVIEW_REQUESTED = "review_requested";

public static final String REVIEW_REQUEST_REMOVED = "review_request_removed";
Expand Down

0 comments on commit abbbc7a

Please sign in to comment.