Fix albums not being hashed correctly

Also provides more actions for rules, but they don't seem to work...
This commit is contained in:
mitteneer 2025-04-27 15:48:47 -04:00
parent 5e58e81ca7
commit 18d4df0a5c
3 changed files with 43 additions and 38 deletions

View file

@ -22,6 +22,8 @@ pub fn edit(id: []const u8, request: *jetzig.Request) !jetzig.View {
pub fn post(request: *jetzig.Request) !jetzig.View {
const params = try request.params();
std.log.debug("{s}", .{try params.toJson()});
var job = try request.job("process_rule");
_ = try job.params.put("name", params.get("rule-title"));
@ -30,6 +32,7 @@ pub fn post(request: *jetzig.Request) !jetzig.View {
var conditionals = try job.params.put("conditionals", .array);
inline for (0..5) |i| {
if (!std.mem.eql(u8, "", params.getT(.string, comptime std.fmt.comptimePrint("match-txt{}", .{i})).?)) {
//if (params.getT(.string, comptime std.fmt.comptimePrint("match-txt{}", .{i})) != null) {
var cond = try conditionals.append(.object);
try cond.put("match_on", params.get(comptime std.fmt.comptimePrint("match-on{}", .{i})));
try cond.put("match_cond", params.get(comptime std.fmt.comptimePrint("match-cond{}", .{i})));
@ -38,11 +41,15 @@ pub fn post(request: *jetzig.Request) !jetzig.View {
}
var actions = try job.params.put("actions", .array);
var act0 = try actions.append(.object);
try act0.put("action", params.get("action"));
try act0.put("action_on", params.get("action-on"));
try act0.put("action_txt", params.get("action-txt"));
inline for (0..5) |i| {
if (!std.mem.eql(u8, "", params.getT(.string, comptime std.fmt.comptimePrint("action-txt{}", .{i})).?)) {
//if (params.getT(.string, comptime std.fmt.comptimePrint("action-txt{}", .{i})) != null) {
var act = try actions.append(.object);
try act.put("action", params.get(comptime std.fmt.comptimePrint("action{}", .{i})));
try act.put("action_on", params.get(comptime std.fmt.comptimePrint("action-on{}", .{i})));
try act.put("action_txt", params.get(comptime std.fmt.comptimePrint("action-txt{}", .{i})));
}
}
try job.schedule();
return request.render(.created);