╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ──────────────╮ │src/ui/Repo/Patches.zig│ ╰───────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │723 const comment_page = if (empty.comment_id.len == 0) │ │724 null │ │725 else │ │723 - try Comment.init(repo_opts.hash, arena, admin_moment, haxy_moment, empty.selected_id, empty.comment_id, comments_start); │ │726 + try Comment.init(repo_opts.hash, arena, admin_moment, haxy_moment, empty.selected_id, empty.comment_id, comments_start, viewer);│ │727 │ │728 const labels = try thread.loadLabels(Self, repo_opts.hash, arena, haxy_moment); │ │729 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────╮ │736 .comment_id = empty.comment_id, │ │737 .comments_start = comments_start,│ │738 .comment_page = comment_page, │ │739 + .can_reply = viewer != null, │ │740 .open = open_window, │ │741 .closed = closed_window, │ │742 .merged = merged_window, │ ╰──────────────────────────────────────────────╯ ╭ changed ───────────────╮ │src/ui/widget/thread.zig│ ╰────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │236 comments_start: usize, │ │237 // the search the set is narrowed to, or null to list it whole │ │238 query: ?[]const u8, │ │239 + viewer: ?Comment.Viewer, │ │240 ) !Data.Window { │ │240 - if (query) |text| return loadSearchWindow(Data, kind, hash_kind, arena, admin_moment, haxy_moment, records, set_maybe, root_key, conflict_set, selected_id, comments_start, text); │ │241 + if (query) |text| return loadSearchWindow(Data, kind, hash_kind, arena, admin_moment, haxy_moment, records, set_maybe, root_key, conflict_set, selected_id, comments_start, text, viewer);│ │242 const set = set_maybe orelse return .empty; │ │243 const aa = arena.allocator(); │ │244 │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │267 next_id = try aa.dupe(u8, &keyIdHex(&order_key)); │ │268 break; │ │269 } │ │269 - const entry = (try loadEntry(Data, hash_kind, arena, admin_moment, haxy_moment, records, &order_key, conflict_set, selected_id, comments_start)) orelse continue; │ │270 + const entry = (try loadEntry(Data, hash_kind, arena, admin_moment, haxy_moment, records, &order_key, conflict_set, selected_id, comments_start, viewer)) orelse continue;│ │271 try items.append(aa, entry); │ │272 } │ │273 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────╮ │299 selected_id: []const u8, │ │300 comments_start: usize, │ │301 query_text: []const u8, │ │302 + viewer: ?Comment.Viewer, │ │303 ) !Data.Window { │ │304 const set = set_maybe orelse return .empty;│ │305 const DB = evt.EventDB(hash_kind); │ ╰────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │344 var items: std.ArrayList(Data.Entry) = .empty; │ │345 const last = @min(first + Data.page_size, keys.items.len); │ │346 for (keys.items[first..last]) |*order_key| { │ │345 - const entry = (try loadEntry(Data, hash_kind, arena, admin_moment, haxy_moment, records, order_key, conflict_set, selected_id, comments_start)) orelse continue; │ │347 + const entry = (try loadEntry(Data, hash_kind, arena, admin_moment, haxy_moment, records, order_key, conflict_set, selected_id, comments_start, viewer)) orelse continue;│ │348 try items.append(aa, entry); │ │349 } │ │350 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────╮ │378 conflict_set: ?evt.EventDB(hash_kind).SortedSet(.read_only),│ │379 selected_id: []const u8, │ │380 comments_start: usize, │ │381 + viewer: ?Comment.Viewer, │ │382 ) !?Data.Entry { │ │383 const DB = evt.EventDB(hash_kind); │ │384 const aa = arena.allocator(); │ ╰─────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────╮ │397 evt.Comment.thread_id_to_comment_id_set_key, │ │398 &id_hex, │ │399 if (std.mem.eql(u8, &id_hex, selected_id)) comments_start else 0, │ │400 + viewer, │ │401 ), │ │402 .attachments = try Attachment.load(hash_kind, arena, haxy_moment, &id_hex),│ │403 }; │ ╰────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │806 errdefer back.deinit(allocator); │ │807 try inner_box.children.put(allocator, back.getFocus().id, .{ .widget = .{ .text_box = back }, .rect = null, .min_size = null }); │ │808 │ │805 - try Comment.appendComment(allocator, inner_box, self.session, self.data.identity, kind, comment_view.selected); │ │809 + try Comment.appendComment(allocator, inner_box, self.session, self.data.identity, kind, self.data.can_reply, comment_view.selected); │ │810 try Comment.appendCount(allocator, inner_box, comment_view.replies.count, "reply", "replies"); │ │807 - for (comment_view.replies.comments) |comment| try Comment.appendComment(allocator, inner_box, self.session, self.data.identity, kind, comment); │ │811 + for (comment_view.replies.comments) |comment| try Comment.appendComment(allocator, inner_box, self.session, self.data.identity, kind, self.data.can_reply, comment); │ │812 try Comment.appendWindowNav(allocator, inner_box, self.session, self.data.identity, kind, &comment_view.selected.comment.event.thread_id, &comment_view.selected.id, comment_view.replies);│ │813 │ │814 var spacer = try Spacer.init(allocator); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │885 try Attachment.appendRows(allocator, inner_box, self.session, self.data.identity, try parent_route.toUrl(self.session.page_arena), entry.attachments); │ │886 │ │887 if (!description_page) { │ │884 - var reply = try Comment.linkBox(allocator, self.session, "new comment", ui.RoutablePage.repoThreadCommentNewRoute(kind, self.data.identity, entry.id, "") orelse return error.RouteTooLong); │ │885 - errdefer reply.deinit(allocator); │ │886 - try inner_box.children.put(allocator, reply.getFocus().id, .{ .widget = .{ .text_box = reply }, .rect = null, .min_size = null }); │ │888 + if (self.data.can_reply) { │ │889 + var reply = try Comment.linkBox(allocator, self.session, "new comment", ui.RoutablePage.repoThreadCommentNewRoute(kind, self.data.identity, entry.id, "") orelse return error.RouteTooLong);│ │890 + errdefer reply.deinit(allocator); │ │891 + try inner_box.children.put(allocator, reply.getFocus().id, .{ .widget = .{ .text_box = reply }, .rect = null, .min_size = null }); │ │892 + } │ │893 │ │894 try Comment.appendCount(allocator, inner_box, entry.comments.count, "comment", "comments"); │ │889 - for (entry.comments.comments) |comment| try Comment.appendComment(allocator, inner_box, self.session, self.data.identity, kind, comment); │ │895 + for (entry.comments.comments) |comment| try Comment.appendComment(allocator, inner_box, self.session, self.data.identity, kind, self.data.can_reply, comment); │ │896 try Comment.appendWindowNav(allocator, inner_box, self.session, self.data.identity, kind, entry.id, null, entry.comments); │ │897 } │ │898 } │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯