Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2111)

Unified Diff: appengine/chromium_rietveld/new_static/model/patch_set.js

Issue 873593007: Add the ability to delete patchsets. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Fix |sending| Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/chromium_rietveld/new_static/images/delete_icon_36.png ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/chromium_rietveld/new_static/model/patch_set.js
diff --git a/appengine/chromium_rietveld/new_static/model/patch_set.js b/appengine/chromium_rietveld/new_static/model/patch_set.js
index 1333d27267cfeb648bbbd29591b0d6f08cb7e6b6..2d66e63394aa26abd2eac7885b18caf7f7c475fa 100644
--- a/appengine/chromium_rietveld/new_static/model/patch_set.js
+++ b/appengine/chromium_rietveld/new_static/model/patch_set.js
@@ -25,8 +25,9 @@ function PatchSet(issue, id, sequence)
this.active = false;
}
-PatchSet.DETAIL_URL = "/api/{1}/{2}/?comments=true"
+PatchSet.DETAIL_URL = "/api/{1}/{2}/?comments=true";
PatchSet.REVERT_URL = "/api/{1}/{2}/revert";
+PatchSet.DELETE_URL = "/{1}/patchset/{2}/delete";
PatchSet.TITLE_URL = "/{1}/patchset/{2}/edit_patchset_title";
PatchSet.prototype.getDetailUrl = function()
@@ -50,6 +51,13 @@ PatchSet.prototype.getEditTitleUrl = function()
encodeURIComponent(this.id));
};
+PatchSet.prototype.getDeleteUrl = function()
+{
+ return PatchSet.DELETE_URL.assign(
+ encodeURIComponent(this.issue.id),
+ encodeURIComponent(this.id));
+};
+
PatchSet.prototype.loadDetails = function()
{
var patchset = this;
@@ -94,6 +102,16 @@ PatchSet.prototype.setTitle = function(value)
});
};
+PatchSet.prototype.delete = function()
+{
+ var patchset = this;
+ return User.loadCurrentUser().then(function(user) {
+ return sendFormData(patchset.getDeleteUrl(), {
+ xsrf_token: user.xsrfToken,
+ });
+ });
+};
+
PatchSet.prototype.parseData = function(data)
{
var patchset = this;
« no previous file with comments | « appengine/chromium_rietveld/new_static/images/delete_icon_36.png ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698