Browse Source

Avoid double-pinging Zulip when opening a MCP

Mark Rousskov 4 years ago
parent
commit
08e76186a8
1 changed files with 11 additions and 1 deletions
  1. 11 1
      src/handlers/major_change.rs

+ 11 - 1
src/handlers/major_change.rs

@@ -52,7 +52,17 @@ impl Handler for MajorChangeHandler {
                     {
                         return Ok(Some(Invocation::AcceptedProposal));
                     } else {
-                        return Ok(Some(Invocation::NewProposal));
+                        // Opening an issue with a label assigned triggers both
+                        // "Opened" and "labeled" events.
+                        if e.action == github::IssuesAction::Opened
+                            || e.action == github::IssuesAction::Reopened
+                        {
+                            return Ok(Some(Invocation::NewProposal));
+                        } else {
+                            // Nothing to do, issue was labeled, but not marked
+                            // as accepted
+                            return Ok(None);
+                        }
                     }
                 }
             }