╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ admin.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭ find file ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ ╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │ │ │http│ ssh │ │ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
397 try std.testing.expectEqualStrings("add a feature", draft.event.title); 398 try std.testing.expectEqual(null, draft.event.revision); 399 400 try fork.remove(io, allocator, users_dir, &user_id, &fork_id_hex, author); 401 try std.testing.expectError(error.FileNotFound, std.Io.Dir.accessAbsolute(io, draft_path, .{})); 402 _ = arena.reset(.retain_capacity); 403 moment = try evt.currentMoment(evt.user_repo_opts, &user_repo); 404 record = (try evt.Fork.readById(evt.UserDB, evt.user_repo_opts.hash, moment, &arena, &fork_id)) orelse return error.NotFound; 405 try std.testing.expect(record.removed); 406 try std.testing.expectEqual(0, try activeForkCount(moment)); 407 try std.testing.expectEqual(0, try draftForkCount(moment, &repo_id)); 408 409 try fork.remove(io, allocator, users_dir, &user_id, &fork_id_hex, author); 410 } 411 412 fn draftForkCount(moment: evt.UserDB.HashMap(.read_only), repo_id: []const u8) !u64 { 413 const index_cursor = try moment.getCursor(hash.hashInt(evt.user_repo_opts.hash, evt.Fork.repo_to_draft_id_set_key)) orelse return 0; 414 const index = try evt.UserDB.HashMap(.read_only).init(index_cursor); 415 const ids_cursor = try index.getCursor(hash.hashInt(evt.user_repo_opts.hash, repo_id)) orelse return 0; 416 const ids = try evt.UserDB.SortedSet(.read_only).init(ids_cursor); 417 return try ids.count(); 418 } 419 420 fn activeForkCount(moment: evt.UserDB.HashMap(.read_only)) !u64 { 421 const ids_cursor = try moment.getCursor(hash.hashInt(evt.user_repo_opts.hash, evt.Fork.active_id_set_key)) orelse return 0; 422 const ids = try evt.UserDB.SortedSet(.read_only).init(ids_cursor); 423 return try ids.count(); 424 } 425