mirror of
				https://github.com/Jermolene/TiddlyWiki5
				synced 2025-10-31 15:42:59 +00:00 
			
		
		
		
	get bag tiddler and put recipe tiddler should return the bag name
This commit is contained in:
		| @@ -40,7 +40,7 @@ exports.handler = function(request,response,state) { | |||||||
| 				} | 				} | ||||||
| 			}); | 			}); | ||||||
| 			tiddlerFields.revision = "0"; | 			tiddlerFields.revision = "0"; | ||||||
| 			tiddlerFields.bag = "bag-gamma"; | 			tiddlerFields.bag = bag_name; | ||||||
| 			tiddlerFields.type = tiddlerFields.type || "text/vnd.tiddlywiki"; | 			tiddlerFields.type = tiddlerFields.type || "text/vnd.tiddlywiki"; | ||||||
| 			state.sendResponse(200,{"Content-Type": "application/json"},JSON.stringify(tiddlerFields),"utf8"); | 			state.sendResponse(200,{"Content-Type": "application/json"},JSON.stringify(tiddlerFields),"utf8"); | ||||||
| 		} else { | 		} else { | ||||||
|   | |||||||
| @@ -39,11 +39,9 @@ exports.handler = function(request,response,state) { | |||||||
| 	}); | 	}); | ||||||
| 	// Require the recipe names to match | 	// Require the recipe names to match | ||||||
| 	if(recipe_name === recipe_name_2) { | 	if(recipe_name === recipe_name_2) { | ||||||
| 		$tw.sqlTiddlerStore.saveRecipeTiddler(fields,recipe_name); | 		var bag_name = $tw.sqlTiddlerStore.saveRecipeTiddler(fields,recipe_name); | ||||||
| 		var recipe_bags = $tw.sqlTiddlerStore.getRecipeBags(recipe_name), |  | ||||||
| 			top_bag = recipe_bags[recipe_bags.length - 1]; |  | ||||||
| 		response.writeHead(204, "OK",{ | 		response.writeHead(204, "OK",{ | ||||||
| 			Etag: "\"" + top_bag + "/" + encodeURIComponent(title) + "/" + 2222 + ":\"", | 			Etag: "\"" + bag_name + "/" + encodeURIComponent(title) + "/" + 2222 + ":\"", | ||||||
| 			"Content-Type": "text/plain" | 			"Content-Type": "text/plain" | ||||||
| 		}); | 		}); | ||||||
| 		response.end(); | 		response.end(); | ||||||
|   | |||||||
| @@ -270,6 +270,7 @@ SqlTiddlerStore.prototype.saveRecipeTiddler = function(tiddlerFields,recipename) | |||||||
| 	}); | 	}); | ||||||
| 	// Save the tiddler to the topmost bag | 	// Save the tiddler to the topmost bag | ||||||
| 	this.saveBagTiddler(tiddlerFields,row.bag_name); | 	this.saveBagTiddler(tiddlerFields,row.bag_name); | ||||||
|  | 	return row.bag_name; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| SqlTiddlerStore.prototype.deleteTiddler = function(title,bagname) { | SqlTiddlerStore.prototype.deleteTiddler = function(title,bagname) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jeremy Ruston
					Jeremy Ruston