-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add DELETE functionality to bags and recipe cards #8822
base: multi-wiki-support
Are you sure you want to change the base?
Add DELETE functionality to bags and recipe cards #8822
Conversation
@well-noted It appears that this is your first contribution to the project, welcome. With apologies for the bureaucracy, please could you prepare a separate PR to the 'tiddlywiki-com' branch with your signature for the Contributor License Agreement (see contributing.md). |
✅ Deploy Preview for tiddlywiki-previews ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
}); | ||
/*jslint node: true, browser: true */ | ||
/*global $tw: false */ | ||
"use strict"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with TW do not indent the code inside the outer (function() {
wrapper. -- It is intended to remove those wrapper functions in a future PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the extra indentation is removed, IMO your PR should only contain 2 files. The rest should stay as it was.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @pmario points out, it is important to match the formatting conventions used elsewhere in the code. I appreciate that that often means fighting tooling that wants to do things differently, and we do have an interest in improving the situation.
well-noted has signed the Contributor License Agreement (see contributing.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @well-noted, much appreciated.
sqlTiddlerDatabase = server.sqlTiddlerDatabase; | ||
|
||
// Handle DELETE request | ||
if(state.data._method === "DELETE") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not keen on the way that the DELETE /bags/:bag-name method is piggybacked into the same handler as the POST /bags method.
I'd prefer to implement DELETE /bags/:bag-name as a separate handler, and to move the logic that allows POST as a synonym for DELETE into mws-server.js (similarly to the PUT/POST mapping it already does). This would allow REST purists to do things properly if they want to.
}); | ||
/*jslint node: true, browser: true */ | ||
/*global $tw: false */ | ||
"use strict"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @pmario points out, it is important to match the formatting conventions used elsewhere in the code. I appreciate that that often means fighting tooling that wants to do things differently, and we do have an interest in improving the situation.
@@ -4,57 +4,83 @@ type: application/javascript | |||
module-type: mws-route | |||
POST /recipes | |||
DELETE /recipes (via _method=DELETE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, this should be its own separate handler
recipe: { | ||
table: "recipes", | ||
column: "recipe_name" | ||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diffs here are messed up by the formatting changes which makes it hard to review them, so I'll come back to this once the formatting is fixed.
Adds delete handlers to post-recipe and post-bag, adds delete functions to sql-tiddler-store and sql-tiddler-database, and adds buttons to get-index.tid