DEV: Use type instead of method in ajax calls (#8974)

Even though `type` is an alias for `method`, we have custom logic in `/discourse/lib/ajax` that checks only `type`, and ~200 other ajax calls in the codebase already use `type` param.
This commit is contained in:
Jarek Radosz
2020-03-26 21:00:10 +01:00
committed by GitHub
parent 17211b940f
commit 67b34600d5
27 changed files with 42 additions and 42 deletions

View File

@@ -100,13 +100,11 @@ QUnit.test("creating simultaneously", assert => {
});
});
QUnit.test("destroyRecord", assert => {
QUnit.test("destroyRecord", async assert => {
const store = createStore();
return store.find("widget", 123).then(function(widget) {
widget.destroyRecord().then(function(result) {
assert.ok(result);
});
});
const widget = await store.find("widget", 123);
assert.ok(await widget.destroyRecord());
});
QUnit.test("custom api name", async assert => {

View File

@@ -114,21 +114,18 @@ QUnit.test("findAll", async assert => {
assert.equal(widget.get("name"), "Evil Repellant");
});
QUnit.test("destroyRecord", function(assert) {
QUnit.test("destroyRecord", async assert => {
const store = createStore();
return store.find("widget", 123).then(function(w) {
store.destroyRecord("widget", w).then(function(result) {
assert.ok(result);
});
});
const widget = await store.find("widget", 123);
assert.ok(await store.destroyRecord("widget", widget));
});
QUnit.test("destroyRecord when new", function(assert) {
QUnit.test("destroyRecord when new", async assert => {
const store = createStore();
const w = store.createRecord("widget", { name: "hello" });
store.destroyRecord("widget", w).then(function(result) {
assert.ok(result);
});
const widget = store.createRecord("widget", { name: "hello" });
assert.ok(await store.destroyRecord("widget", widget));
});
QUnit.test("find embedded", async assert => {