Revert "REFACTOR: `ajax` defaults to json data type for GET requests."
This reverts commit af0b6ce53d
.
This commit is contained in:
parent
af0b6ce53d
commit
0b28075c00
|
@ -50,7 +50,7 @@ const Group = Discourse.Model.extend({
|
|||
|
||||
removeOwner(member) {
|
||||
var self = this;
|
||||
return ajax(`/admin/groups/${this.get('id')}/owners`, {
|
||||
return ajax('/admin/groups/' + this.get('id') + '/owners.json', {
|
||||
type: "DELETE",
|
||||
data: { user_id: member.get("id") }
|
||||
}).then(function() {
|
||||
|
@ -61,7 +61,7 @@ const Group = Discourse.Model.extend({
|
|||
|
||||
removeMember(member) {
|
||||
var self = this;
|
||||
return ajax(`/groups/${this.get('id')}/members`, {
|
||||
return ajax('/groups/' + this.get('id') + '/members.json', {
|
||||
type: "DELETE",
|
||||
data: { user_id: member.get("id") }
|
||||
}).then(function() {
|
||||
|
@ -72,7 +72,7 @@ const Group = Discourse.Model.extend({
|
|||
|
||||
addMembers(usernames) {
|
||||
var self = this;
|
||||
return ajax(`/groups/${this.get('id')}/members`, {
|
||||
return ajax('/groups/' + this.get('id') + '/members.json', {
|
||||
type: "PUT",
|
||||
data: { usernames: usernames }
|
||||
}).then(function() {
|
||||
|
@ -82,7 +82,7 @@ const Group = Discourse.Model.extend({
|
|||
|
||||
addOwners(usernames) {
|
||||
var self = this;
|
||||
return ajax(`/admin/groups/${this.get('id')}/owners`, {
|
||||
return ajax('/admin/groups/' + this.get('id') + '/owners.json', {
|
||||
type: "PUT",
|
||||
data: { usernames: usernames }
|
||||
}).then(function() {
|
||||
|
@ -141,7 +141,7 @@ const Group = Discourse.Model.extend({
|
|||
var data = {};
|
||||
if (opts.beforePostId) { data.before_post_id = opts.beforePostId; }
|
||||
|
||||
return ajax(`/groups/${this.get('name')}/${type}`, { data: data }).then(posts => {
|
||||
return ajax(`/groups/${this.get('name')}/${type}.json`, { data: data }).then(posts => {
|
||||
return posts.map(p => {
|
||||
p.user = Discourse.User.create(p.user);
|
||||
p.topic = Discourse.Topic.create(p.topic);
|
||||
|
@ -161,21 +161,21 @@ const Group = Discourse.Model.extend({
|
|||
|
||||
Group.reopenClass({
|
||||
findAll(opts) {
|
||||
return ajax("/admin/groups", { data: opts }).then(function (groups){
|
||||
return ajax("/admin/groups.json", { data: opts }).then(function (groups){
|
||||
return groups.map(g => Group.create(g));
|
||||
});
|
||||
},
|
||||
|
||||
findGroupCounts(name) {
|
||||
return ajax(`/groups/${name}/counts`).then(result => Em.Object.create(result.counts));
|
||||
return ajax("/groups/" + name + "/counts.json").then(result => Em.Object.create(result.counts));
|
||||
},
|
||||
|
||||
find(name) {
|
||||
return ajax(`/groups/${name}`).then(result => Group.create(result.basic_group));
|
||||
return ajax("/groups/" + name + ".json").then(result => Group.create(result.basic_group));
|
||||
},
|
||||
|
||||
loadMembers(name, offset, limit) {
|
||||
return ajax(`/groups/${name}/members`, {
|
||||
return ajax('/groups/' + name + '/members.json', {
|
||||
data: {
|
||||
limit: limit || 50,
|
||||
offset: offset || 0
|
||||
|
|
|
@ -397,6 +397,8 @@ Discourse::Application.routes.draw do
|
|||
get "posts/:username/deleted" => "posts#deleted_posts", constraints: {username: USERNAME_ROUTE_FORMAT}
|
||||
get "posts/:username/flagged" => "posts#flagged_posts", constraints: {username: USERNAME_ROUTE_FORMAT}
|
||||
|
||||
get "groups/:id.json" => 'groups#show', constraints: {id: USERNAME_ROUTE_FORMAT}, defaults: {format: 'json'}
|
||||
|
||||
resources :groups, id: USERNAME_ROUTE_FORMAT do
|
||||
get "posts.rss" => "groups#posts_feed", format: :rss
|
||||
get "mentions.rss" => "groups#mentions_feed", format: :rss
|
||||
|
|
Loading…
Reference in New Issue