#4013 Send dedicated notifications when a PR is updated or rebased
Merged 5 years ago by pingou. Opened 5 years ago by pingou.

file modified
+12
@@ -1935,6 +1935,7 @@ 

          ):

              request.merge_status = None

              if request.commit_start:

+                 pr_action = "updated"

                  new_commits_count = 0

                  commenttext = ""

                  for i in diff_commits:
@@ -1959,6 +1960,7 @@ 

                  request.commit_start

                  and request.commit_start != first_commit.oid.hex

              ):

+                 pr_action = "rebased"

                  commenttext = "rebased onto %s" % first_commit.oid.hex

          request.commit_start = first_commit.oid.hex

          request.commit_stop = diff_commits[0].oid.hex
@@ -1975,6 +1977,16 @@ 

          if commenttext:

              tasks.link_pr_to_ticket.delay(request.uid)

              if notify:

+                 if pr_action:

+                     pagure.lib.notify.log(

+                         request.project,

+                         topic="pull-request.%s" % pr_action,

+                         msg=dict(

+                             pullrequest=request.to_json(

+                                 with_comments=False, public=True),

+                             agent='pagure',

+                         ),

+                     )

                  pagure.lib.query.add_pull_request_comment(

                      session,

                      request,

file modified
+3
@@ -1360,6 +1360,9 @@ 

  

      # Send notification to the CI server, if the comment added was a

      # notification and the PR is still open and project is not private

+     ci_hook = pagure.lib.plugins.get_plugin("Pagure CI")

+     ci_hook.db_object()

+ 

      ci_triggered = False

      if (

          notification

Signed-off-by: Pierre-Yves Chibon pingou@pingoured.fr

Should it be a pr_action = "created" state too ?

not in this context I think, but I'll check (I believe this would be the pull-request.new that already exists)

From my tests, I confirm that only pull-request.new is sent when opening a new PR

rebased onto daeff6bc41f71c52a7f8a2a257c98559f0277584

5 years ago

rebased onto d9749b1

5 years ago

rebased onto 13d00bc6dbb8061ad3dacffa044375065846abd5

5 years ago

rebased onto f39c35d

5 years ago

Thanks for your review! :)

Pull-Request has been merged by pingou

5 years ago