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; |