Skip to content

Commit

Permalink
Renamed the API for removing tasks to avoid reduce confusion on a num…
Browse files Browse the repository at this point in the history
…ber or levels.

Also fixed a relared bug in removal server api.
  • Loading branch information
jimfulton committed Jul 2, 2017
1 parent 328f215 commit 67c11d7
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion client/demo/boardapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ module.exports = class extends BaseAPI {
}
}

delete(id, cb) {
remove(id, cb) {
this.transaction('tasks', 'readwrite', (trans) => {
const tasks = trans.objectStore('tasks');
const removals = [id];
Expand Down
2 changes: 1 addition & 1 deletion client/model/apibase.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ module.exports = class {
}

delete(url) {
return axios.put(url[0] == '/' ? url : this.base + url, this.config)
return axios.delete(url[0] == '/' ? url : this.base + url, this.config)
.catch((e) => this.handle_error(e));
}

Expand Down
2 changes: 1 addition & 1 deletion client/model/boardapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = class extends APIBase {
});
}

delete_task(id) {
remove(id) {
this.delete('tasks/' + id);
}

Expand Down
8 changes: 4 additions & 4 deletions client/tests/testdemoboardapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -1058,12 +1058,12 @@ describe("demo board api", () => {
});
});

it("should delete tasks", (done) => {
it("should remove tasks", (done) => {
const view = {setState: expect.createSpy()};
new BoardAPI(view, 'test2', (api) => {
const model = api.model;
const task_id = model.subtasks('Backlog')[0].subtasks('ready')[0].id;
api.delete(task_id, (api, data) => {
api.remove(task_id, (api, data) => {
expect(data.tasks.removals).toEqual([task_id]);
expect(model.subtasks('Backlog')[0].subtasks('ready')).toEqual([]);
expect(model.all_tasks.length).toBe(1);
Expand All @@ -1072,13 +1072,13 @@ describe("demo board api", () => {
});
});

it("should delete features", (done) => {
it("should remove features", (done) => {
const view = {setState: expect.createSpy()};
new BoardAPI(view, 'test2', (api) => {
const model = api.model;
const feature_id = model.subtasks('Backlog')[0].id;
const task_id = model.subtasks('Backlog')[0].subtasks('ready')[0].id;
api.delete(feature_id, (api, data) => {
api.remove(feature_id, (api, data) => {
expect(data.tasks.removals).toEqual([feature_id, task_id]);
expect(model.all_tasks.length).toBe(0);
done();
Expand Down
2 changes: 1 addition & 1 deletion client/ui/project.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class Project extends Revealable {
feature in The Bag instead.
</p>
</div>)}
finish={() => api.delete(project.id)}
finish={() => api.remove(project.id)}
/>
<TooltipIconButton
icon="add"
Expand Down
2 changes: 1 addition & 1 deletion client/ui/tasks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ class Task extends Revealable {
<p>Are you sure you want to delete {task.title}?</p>
<p className="kb-warning">This cannot be undone.</p>
</div>)}
finish={() => api.delete(task.id)}
finish={() => api.remove(task.id)}
/>
</Reveal>
</Card>
Expand Down

0 comments on commit 67c11d7

Please sign in to comment.