Don't base copy/rename API URLs on the "from" multi path.

Since "copy" and "rename" are operations rather than resources
underneath the multi, let's put them in the root of the API namespace.
This commit is contained in:
Max Goodman
2013-07-09 01:46:50 -07:00
parent e816a28493
commit df03e621c0
3 changed files with 6 additions and 5 deletions

View File

@@ -321,8 +321,8 @@ def make_map():
mc('/api/:action', controller='api')
mc("/api/multi/mine", controller="multiapi", action="my_multis")
mc("/api/multi/*multipath/copy", controller="multiapi", action="multi_copy")
mc("/api/multi/*multipath/rename", controller="multiapi", action="multi_rename")
mc("/api/multi/copy", controller="multiapi", action="multi_copy")
mc("/api/multi/rename", controller="multiapi", action="multi_rename")
mc("/api/multi/*multipath/r/:srname", controller="multiapi", action="multi_subreddit")
mc("/api/multi/*multipath/description", controller="multiapi", action="multi_description")
mc("/api/multi/*multipath", controller="multiapi", action="multi")

View File

@@ -222,7 +222,7 @@ class MultiApiController(RedditController, OAuth2ResourceController):
@validate(
VUser(),
VModhash(),
from_multi=VMultiByPath("multipath", require_view=True),
from_multi=VMultiByPath("from", require_view=True),
to_path_info=VMultiPath("to",
docs={"to": "destination multireddit url path"},
),
@@ -256,7 +256,7 @@ class MultiApiController(RedditController, OAuth2ResourceController):
@validate(
VUser(),
VModhash(),
from_multi=VMultiByPath("multipath", require_edit=True),
from_multi=VMultiByPath("from", require_edit=True),
to_path_info=VMultiPath("to",
docs={"to": "destination multireddit url path"},
),

View File

@@ -147,8 +147,9 @@ r.multi.MultiReddit = Backbone.Model.extend({
var deferred = new $.Deferred
Backbone.ajax({
type: 'POST',
url: this.url() + '/' + op,
url: '/api/multi/' + op,
data: {
from: this.get('path'),
to: newCollection.pathByName(newName)
},
success: _.bind(function(resp) {