File tree Expand file tree Collapse file tree 5 files changed +42
-0
lines changed Expand file tree Collapse file tree 5 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 5252 git fetch commitfest cf/{{patch.id}}
5353 git checkout commitfest/cf/{{patch.id}} " onclick ="addGitCheckoutToClipboard({{patch.id}}) "> Copy git checkout commands</ button >
5454 {%endif%}
55+ {%if user.is_authenticated%}
56+ < form method ="post " action ="/patch/{{patch.id}}/cfbot_requeue/ " style ="display: inline; ">
57+ {%csrf_token%}
58+ < button type ="submit " class ="btn btn-secondary " title ="Requeue this patch for CFBot processing "> Requeue CFBot</ button >
59+ </ form >
60+ {%endif%}
5561 </ a >
5662 </ td >
5763 </ tr >
Original file line number Diff line number Diff line change @@ -1700,3 +1700,35 @@ def thread_notify(request):
17001700 refresh_single_thread (t )
17011701
17021702 return HttpResponse (status = 200 )
1703+
1704+
1705+ @login_required
1706+ def cfbot_requeue (request , patchid ):
1707+ """Trigger a requeue of a patch in the cfbot."""
1708+ if request .method != "POST" :
1709+ return HttpResponseForbidden (b"Invalid method" )
1710+
1711+ patch = get_object_or_404 (Patch , pk = patchid )
1712+ cf = patch .current_commitfest ()
1713+
1714+ # Make API call to cfbot
1715+ import requests
1716+
1717+ payload = {
1718+ "commitfest_id" : cf .id ,
1719+ "submission_id" : patchid ,
1720+ "shared_secret" : settings .CFBOT_SECRET ,
1721+ }
1722+
1723+ try :
1724+ response = requests .post (
1725+ f"{ settings .CFBOT_API_URL } /requeue-patch" , json = payload , timeout = 10
1726+ )
1727+ if response .status_code == 200 :
1728+ messages .success (request , "Patch requeued successfully" )
1729+ else :
1730+ messages .error (request , f"Failed to requeue patch: { response .status_code } " )
1731+ except requests .exceptions .RequestException as e :
1732+ messages .error (request , f"Failed to requeue patch: { e } " )
1733+
1734+ return HttpResponseRedirect (f"/patch/{ patchid } /" )
Original file line number Diff line number Diff line change 3232)
3333
3434CFBOT_SECRET = "INSECURE"
35+ CFBOT_API_URL = "http://localhost:5000/api"
3536
3637# There are already commitfests in the default dummy database data.
3738# Automatically creating new ones would cause the ones that are visible on the
Original file line number Diff line number Diff line change 166166
167167AUTO_CREATE_COMMITFESTS = True
168168
169+ CFBOT_API_URL = "https://cfbot.cputube.org/api"
170+
169171# Load local settings overrides
170172try :
171173 from .local_settings import * # noqa: F403
Original file line number Diff line number Diff line change 3636 re_path (r"^patch/(\d+)/committer/(become|remove)/$" , views .committer ),
3737 re_path (r"^patch/(\d+)/(un)?subscribe/$" , views .subscribe ),
3838 re_path (r"^patch/(\d+)/(comment|review)/" , views .comment ),
39+ re_path (r"^patch/(\d+)/cfbot_requeue/$" , views .cfbot_requeue ),
3940 re_path (r"^(\d+)/send_email/$" , views .send_email ),
4041 re_path (r"^patch/(\d+)/send_email/$" , views .send_patch_email ),
4142 re_path (r"^(\d+)/reports/authorstats/$" , reports .authorstats ),
You can’t perform that action at this time.
0 commit comments