╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ notify.zig ───────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭ find file ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ ╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │ │ │http│ ssh │ │ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
145 for (0..notify.max_subscribed) |_| { 146 const user_id = evt.EventWithId.randomId(prng.random()); 147 try initUserRepo(io, allocator, users_dir, &user_id); 148 try notify.subscribe(io, allocator, users_dir, &user_id, location, &thread_a, author); 149 } 150 try notify.subscribe(io, allocator, users_dir, &recipient_id, location, &thread_a, author); 151 try std.testing.expectEqual(null, try readMode(io, allocator, &arena, users_dir, &recipient_id, &location.repo_id, &thread_a)); 152 153 // past the cap, the oldest go. times tie within a second, so which one goes isn't checked. 154 { 155 const many = try allocator.alloc(notify.Notif, notify.max_notifs + 1); 156 defer allocator.free(many); 157 for (many, 0..) |*notif, i| { 158 notif.* = notif_a; 159 notif.thread_id = @splat(0); 160 std.mem.writeInt(u64, notif.thread_id[0..@sizeOf(u64)], i, .big); 161 } 162 try notify.deliver(io, allocator, users_dir, &recipient_id, many); 163 } 164 try std.testing.expectEqual(notify.max_notifs, (try readRecent(io, allocator, &arena, users_dir, &recipient_id)).len); 165 } 166