#4164 Update the PR updated_on field when acting on it
Merged 5 years ago by pingou. Opened 5 years ago by pingou.

file modified
+6 -4
@@ -672,7 +672,7 @@ 

  

      if assignee is None and request.assignee is not None:

          request.assignee_id = None

-         request.last_updated = datetime.datetime.utcnow()

+         request.updated_on = datetime.datetime.utcnow()

          session.add(request)

          session.commit()

          pagure.lib.git.update_git(request, repo=request.project)
@@ -698,7 +698,7 @@ 

  

      if request.assignee_id != assignee_obj.id:

          request.assignee_id = assignee_obj.id

-         request.last_updated = datetime.datetime.utcnow()

+         request.updated_on = datetime.datetime.utcnow()

          session.add(request)

          session.flush()

          pagure.lib.git.update_git(request, repo=request.project)
@@ -1336,7 +1336,7 @@ 

      # Make sure we won't have SQLAlchemy error before we continue

      session.flush()

  

-     request.last_updated = datetime.datetime.utcnow()

+     request.updated_on = datetime.datetime.utcnow()

  

      pagure.lib.git.update_git(request, repo=request.project)

  
@@ -1916,6 +1916,7 @@ 

          commit_stop=commit_stop,

      )

      request.last_updated = datetime.datetime.utcnow()

+     request.updated_on = datetime.datetime.utcnow()

  

      session.add(request)

      # Make sure we won't have SQLAlchemy error before we create the request
@@ -5085,6 +5086,7 @@ 

              user_id=user_id,

              notification=True,

          )

+         obj.last_updated = datetime.datetime.utcnow()

      elif obj.isa == "pull-request":

          obj_comment = model.PullRequestComment(

              pull_request_uid=obj.uid,
@@ -5093,7 +5095,7 @@ 

              user_id=user_id,

              notification=True,

          )

-     obj.last_updated = datetime.datetime.utcnow()

+         obj.updated_on = datetime.datetime.utcnow()

      session.add(obj)

      session.add(obj_comment)

      # Make sure we won't have SQLAlchemy error before we continue

Basically this field needs to be manually adjusted when we update a PR,
we do not want to do it automatically using onupdate so let's do it
manually.

Fixes https://pagure.io/pagure/issue/4159

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

Needs rebase, but looks good otherwise.

rebased onto c293020

5 years ago

Thanks for the review :)

Pull-Request has been merged by pingou

5 years ago