From 3fbfe5dee2aa838faa4024882d2c06e10694b7fa Mon Sep 17 00:00:00 2001 From: Mistium <92952823+Mistium@users.noreply.github.com> Date: Sat, 21 Nov 2026 06:24:10 +0000 Subject: [PATCH 1/3] Let project comments become issues that can be marked done --- opal.json | 2 +- src/community/comment-issues.osl | 123 ++++++++++++++++++++ src/community/comment-issues.test.osl | 59 ++++++++++ src/community/comments.osl | 94 ++++++++++++++- src/community/routes.osl | 1 + src/projects/project-response.osl | 2 + src/projects/project-update-policy.osl | 3 + src/projects/project-update-policy.test.osl | 4 + 8 files changed, 285 insertions(+), 3 deletions(-) create mode 100644 src/community/comment-issues.osl create mode 100644 src/community/comment-issues.test.osl diff --git a/opal.json b/opal.json index a504779..ed54a8c 100644 --- a/opal.json +++ b/opal.json @@ -1,6 +1,6 @@ { "name": "mistwarp-api", - "version": "1.4.1", + "version": "1.5.0", "main": "main.osl", "scripts": { "dev": ["osl", "run", "main.osl"], diff --git a/src/community/comment-issues.osl b/src/community/comment-issues.osl new file mode 100644 index 0000000..e78ea14 --- /dev/null +++ b/src/community/comment-issues.osl @@ -0,0 +1,123 @@ +export { + applyCommentIssue, + commentIssueCounts, + commentIssueState, + commentMatchesIssueFilter, + validIssueFilter, + validIssueState +} + +def commentIssueState(object comment) string ( + if !comment.contains("issue") or comment.issue == null ( + return "" + ) + object issue = comment.issue.assert(object) + if issue.contains("state") and issue.state != null ( + string state = issue.state.toStr() + if state == "open" or state == "done" ( + return state + ) + ) + return "" +) + +def commentIssueNumber(object comment) number ( + if commentIssueState(comment) == "" ( + return 0 + ) + object issue = comment.issue.assert(object) + if issue.contains("number") and issue.number != null ( + return issue.number.toNum() + ) + return 0 +) + +def validIssueState(string state) boolean ( + return state == "open" or state == "done" or state == "none" +) + +def validIssueFilter(string filter) boolean ( + return filter == "open" or filter == "done" or filter == "any" +) + +def nextCommentIssueNumber(array comments) number ( + number highest = 0 + for i comments.len ( + object existing = comments[i].assert(object) + if existing.contains("issue") and existing.issue != null ( + object issue = existing.issue.assert(object) + if issue.contains("number") and issue.number != null and issue.number.toNum() > highest ( + highest = issue.number.toNum() + ) + ) + ) + return highest + 1 +) + +def applyCommentIssue(object comment, array comments, string state, string requester, boolean canTriage, number now) object ( + if !validIssueState(state) ( + return {ok: false, error: "unknown issue state", status: 400} + ) + if comment.contains("parent") and comment.parent != null and comment.parent.toStr() != "" ( + return {ok: false, error: "only top-level comments can be issues", status: 400} + ) + boolean isAuthor = normalizeUsername(comment.author.toStr()) == normalizeUsername(requester) + if !isAuthor and !canTriage ( + return {ok: false, error: "not allowed", status: 403} + ) + string current = commentIssueState(comment) + if state == "none" ( + if comment.contains("issue") ( + comment.delete("issue") + ) + return {ok: true, comment: comment, changed: current != ""} + ) + if current == state ( + return {ok: true, comment: comment, changed: false} + ) + object issue = {} + if current != "" ( + issue = comment.issue.assert(object) + ) else ( + issue = {number: nextCommentIssueNumber(comments), openedBy: requester, openedAt: now} + ) + issue.state = state + if state == "done" ( + issue.closedBy = requester + issue.closedAt = now + ) else ( + if issue.contains("closedBy") ( + issue.delete("closedBy") + ) + if issue.contains("closedAt") ( + issue.delete("closedAt") + ) + ) + comment.issue = issue + return {ok: true, comment: comment, changed: true} +) + +def commentMatchesIssueFilter(object comment, string filter, number wantedNumber) boolean ( + string state = commentIssueState(comment) + if state == "" ( + return false + ) + if wantedNumber > 0 and commentIssueNumber(comment) != wantedNumber ( + return false + ) + return filter == "any" or filter == state +) + +def commentIssueCounts(array roots) object ( + number open = 0 + number done = 0 + for i roots.len ( + string state = commentIssueState(roots[i].assert(object)) + if state == "open" ( + open = open + 1 + ) else if state == "done" ( + done = done + 1 + ) + ) + return {open: open, done: done} +) diff --git a/src/community/comment-issues.test.osl b/src/community/comment-issues.test.osl new file mode 100644 index 0000000..cbe669d --- /dev/null +++ b/src/community/comment-issues.test.osl @@ -0,0 +1,59 @@ +import "std:testing" +import "std:crypto" +import "std:regex" +import "std:fs" +import "std:json" +import "go:mistwarp.local/storagefs" +import "../core/utils.osl" +import "./comment-issues.osl" + +array comments = [ + {id: "c1", author: "Sam", content: "The jump is too high", parent: ""}, + {id: "c2", author: "mist", content: "Fixed in the next save", parent: "c1"}, + {id: "c3", author: "Ana", content: "Love it", parent: ""} +] + +object denied = applyCommentIssue(comments[3].assert(object), comments, "open", "Sam", false, 10) +testing.assert(denied.ok == false and denied.status == 403, "people cannot turn someone else's comment into an issue") + +object reply = applyCommentIssue(comments[2].assert(object), comments, "open", "mist", true, 10) +testing.assert(reply.ok == false and reply.status == 400, "replies cannot become issues") + +object badState = applyCommentIssue(comments[1].assert(object), comments, "closed", "Sam", false, 10) +testing.assert(badState.ok == false and badState.status == 400, "unknown states are refused") + +object opened = applyCommentIssue(comments[1].assert(object), comments, "open", "sam", false, 10) +testing.assert(opened.ok == true and opened.changed == true, "authors can turn their own comment into an issue, ignoring case") +object first = opened.comment.assert(object) +testing.assert(first.issue.number == 1 and first.issue.state == "open" and first.issue.openedBy == "sam" and first.issue.openedAt == 10, "the first issue is number 1") +comments[1] = first + +object again = applyCommentIssue(first, comments, "open", "Sam", false, 11) +testing.assert(again.ok == true and again.changed == false, "opening an open issue changes nothing") + +object triaged = applyCommentIssue(comments[3].assert(object), comments, "done", "mist", true, 12) +testing.assert(triaged.ok == true and triaged.comment.issue.number == 2 and triaged.comment.issue.state == "done", "people with write access can mark any comment as done") +testing.assert(triaged.comment.issue.closedBy == "mist" and triaged.comment.issue.closedAt == 12, "closing records who closed it and when") +comments[3] = triaged.comment + +object closed = applyCommentIssue(first, comments, "done", "Sam", false, 13) +testing.assert(closed.ok == true and closed.comment.issue.number == 1 and closed.comment.issue.state == "done", "authors can close their own issue and it keeps its number") +object reopened = applyCommentIssue(closed.comment.assert(object), comments, "open", "Sam", false, 14) +object reopenedIssue = reopened.comment.assert(object).issue.assert(object) +testing.assert(reopened.ok == true and reopenedIssue.state == "open" and !reopenedIssue.contains("closedBy") and !reopenedIssue.contains("closedAt"), "reopening clears the closing details") +comments[1] = reopened.comment + +testing.assert(commentIssueState(comments[1].assert(object)) == "open", "the state reads back as open") +testing.assert(commentIssueState({id: "x", issue: {state: "weird"}}) == "", "unknown stored states are not issues") +testing.assert(commentMatchesIssueFilter(comments[1].assert(object), "open", 0), "an open issue matches the open filter") +testing.assert(!commentMatchesIssueFilter(comments[1].assert(object), "done", 0), "an open issue does not match the done filter") +testing.assert(commentMatchesIssueFilter(comments[3].assert(object), "any", 2), "the number filter finds issue 2") +testing.assert(!commentMatchesIssueFilter(comments[3].assert(object), "any", 1), "the number filter skips other issues") +testing.assert(!commentMatchesIssueFilter(comments[2].assert(object), "any", 0), "plain comments are not issues") + +object counts = commentIssueCounts([comments[1], comments[3], {id: "c4", author: "Lee", parent: ""}]) +testing.assert(counts.open == 1 and counts.done == 1, "counts split open and done issues") + +object removed = applyCommentIssue(comments[3].assert(object), comments, "none", "mist", true, 15) +testing.assert(removed.ok == true and removed.changed == true and !removed.comment.assert(object).contains("issue"), "an issue can go back to a plain comment") +testing.assert(validIssueFilter("any") and !validIssueFilter("none"), "none is a state, not a filter") diff --git a/src/community/comments.osl b/src/community/comments.osl index b2f71c2..9f6fbda 100644 --- a/src/community/comments.osl +++ b/src/community/comments.osl @@ -179,6 +179,28 @@ def setCommentPin(string key, string cid, string requester, string moderator, bo return {ok: true, comment: target} ) +def setCommentIssue(string key, string cid, string state, string requester, boolean canTriage) object ( + string lockName = "comments:" ++ key + sync.lock(lockName) + defer sync.unlock(lockName) + array comments = loadComments(key) + for i comments.len ( + object existing = comments[i].assert(object) + if existing.id.toStr() == cid ( + object applied = applyCommentIssue(existing, comments, state, requester, canTriage, timestamp) + if applied.ok != true or applied.changed != true ( + return applied + ) + comments[i] = applied.comment + if !saveComments(key, comments) ( + return {ok: false, error: "could not save comment", status: 500} + ) + return applied + ) + ) + return {ok: false, error: "comment not found", status: 404} +) + def deleteComment(string key, string cid, string requester, string moderator, boolean isAdmin) object ( string lockName = "comments:" ++ key sync.lock(lockName) @@ -290,6 +312,30 @@ def commentResponse(object comment, string username) object ( return comment ) +def issueThreads(array comments, array roots, string filter, number wantedNumber) object ( + array issueRoots = [] + object issueIds = {} + for i roots.len ( + object root = roots[i].assert(object) + if commentMatchesIssueFilter(root, filter, wantedNumber) ( + issueRoots.append(root) + issueIds[root.id.toStr()] = true + ) + ) + array threadComments = [] + for i comments.len ( + object comment = comments[i].assert(object) + string rootId = comment.id.toStr() + if commentParentId(comment) != "" ( + rootId = commentParentId(comment) + ) + if issueIds.contains(rootId) ( + threadComments.append(comment) + ) + ) + return {comments: threadComments, roots: issueRoots} +) + def commentPage(array allComments,*serve.Context c) object ( array comments = commentsVisibleTo(allComments, c) for i comments.len ( @@ -302,6 +348,13 @@ def commentPage(array allComments,*serve.Context c) object ( roots.append(comment) ) ) + object issueCounts = commentIssueCounts(roots) + string issueFilter = (c.query("issue") ?? "") + if validIssueFilter(issueFilter) ( + object threads = issueThreads(comments, roots, issueFilter, c.queryInt("number", 0)) + comments = threads.comments.assert(array) + roots = threads.roots.assert(array) + ) if (c.query("sort") ?? "") == "donations" ( for i roots.len ( object root = roots[i].assert(object) @@ -338,7 +391,7 @@ def commentPage(array allComments,*serve.Context c) object ( number totalRoots = roots.len number requestedLimit = c.queryInt("limit", 0) if requestedLimit <= 0 or c.queryBool("all", false) ( - return {comments: comments, totalRoots: totalRoots, nextOffset: totalRoots} + return {comments: comments, totalRoots: totalRoots, nextOffset: totalRoots, issueCounts: issueCounts} ) number offset = clampNumber(c.queryInt("offset", 0), 0, totalRoots) number limit = clampNumber(requestedLimit, 1, 100) @@ -377,7 +430,8 @@ def commentPage(array allComments,*serve.Context c) object ( return { comments: page, totalRoots: totalRoots, - nextOffset: clampNumber(offset + limit, 0, totalRoots) + nextOffset: clampNumber(offset + limit, 0, totalRoots), + issueCounts: issueCounts } ) @@ -658,6 +712,42 @@ def handlePinProjectComment(*serve.Context c) ( c.json(200, updated) ) +def handleSetProjectCommentIssue(*serve.Context c) ( + auto res = loadProject(c.param("id")) + if !res.ok or !canViewProject(res.project.assert(object), c) ( + c.notFound("project not found") + return + ) + object project = res.project.assert(object) + object body = requestJSON(c) + string state = (body.state ?? "").toStr() + if !validIssueState(state) ( + c.badRequest("state must be open, done or none") + return + ) + if state != "none" and project.contains("issuesOff") and project.issuesOff == true ( + c.json(403, {ok: false, error: "issues are turned off for this project"}) + return + ) + string actor = contextString(c, "username") + object updated = setCommentIssue("project-" ++ project.id.toStr(), c.param("cid"), state, actor, canEditProject(project, c)) + if !updated.ok ( + c.json(updated.status.toInt(), {ok: false, error: updated.error}) + return + ) + object comment = commentResponse(updated.comment.assert(object), actor) + comment.playtimeMs = authorPublicPlaytime(project.id.toStr(), comment.author.toStr()) + if updated.changed == true ( + siteBroadcastProject(project.id.toStr(), { + type: "comment_edited", + projectId: project.id, + comment: comment, + actor: actor + }) + ) + c.json(200, {ok: true, comment: comment}) +) + def profileCommentKey(string name) string ( return "profile-" ++ normalizeUsername(name) ) diff --git a/src/community/routes.osl b/src/community/routes.osl index d475a20..f9e5b33 100644 --- a/src/community/routes.osl +++ b/src/community/routes.osl @@ -92,6 +92,7 @@ def registerCommunityRoutes(*serve.Router api) ( api.PUT("/projects/:id/comments/:cid", requireAuth, handleEditProjectComment) api.POST("/projects/:id/comments/:cid/react", requireAuth, handleReactProjectComment) api.POST("/projects/:id/comments/:cid/pin", requireAuth, handlePinProjectComment) + api.PUT("/projects/:id/comments/:cid/issue", requireAuth, handleSetProjectCommentIssue) api.GET("/bounties/:id/activity", handleGetBountyActivity) api.POST("/bounties/:id/comments", requireAuth, requireGoodStanding, serve.rateLimit({requests: 30, window: date.minute}), handleCreateBountyComment) diff --git a/src/projects/project-response.osl b/src/projects/project-response.osl index d66d9cb..e2ca8af 100644 --- a/src/projects/project-response.osl +++ b/src/projects/project-response.osl @@ -123,6 +123,7 @@ def projectResponse(object project,*serve.Context c) object ( if project.contains("commentsOff") and project.commentsOff == true ( commentsOff = true ) + boolean issuesOff = project.contains("issuesOff") and project.issuesOff == true array tags = [] if project.contains("tags") and project.tags != null ( tags = project.tags.assert(array) @@ -194,6 +195,7 @@ def projectResponse(object project,*serve.Context c) object ( brokenHeartCount: broken.len, myReaction: myReaction, commentsOff: commentsOff, + issuesOff: issuesOff, sizeBytes: projectSizeBytes(project), isOwner: isOwner } diff --git a/src/projects/project-update-policy.osl b/src/projects/project-update-policy.osl index 41449b8..546eceb 100644 --- a/src/projects/project-update-policy.osl +++ b/src/projects/project-update-policy.osl @@ -117,6 +117,9 @@ def applyProjectFlags(object project, object body) ( if body.contains("commentsOff") ( project.commentsOff = body.commentsOff == true ) + if body.contains("issuesOff") ( + project.issuesOff = body.issuesOff == true + ) if body.contains("remixable") ( project.remixable = body.remixable != false ) diff --git a/src/projects/project-update-policy.test.osl b/src/projects/project-update-policy.test.osl index 7dc07da..c14f159 100644 --- a/src/projects/project-update-policy.test.osl +++ b/src/projects/project-update-policy.test.osl @@ -53,6 +53,10 @@ testing.assert(!isRefused(applyCredits(credited, {credits: [{who: "Ada"}, {who: object flagged = {id: "p1"} applyProjectFlags(flagged, {commentsOff: "yes", remixable: 0, seeInside: false}) testing.assert(flagged.commentsOff == false and flagged.remixable == true and flagged.seeInside == false, "flags only switch on an exact boolean") +applyProjectFlags(flagged, {issuesOff: true}) +testing.assert(flagged.issuesOff == true, "owners can turn issues off") +applyProjectFlags(flagged, {issuesOff: "yes"}) +testing.assert(flagged.issuesOff == false, "issues only switch off on an exact boolean") testing.assert(projectSaleRefusal({price: 5}).body.code == "project_sales_ended" and !isRefused(projectSaleRefusal({price: 0})) and !isRefused(projectSaleRefusal({})), "only a non-zero price is refused") testing.assert(applyRemixShare(flagged, 51).status == 400 and isRefused(applyRemixShare(flagged, -1)), "remix shares are 0 to 50") testing.assert(!isRefused(applyRemixShare(flagged, 50)) and flagged.remixShare == 50, "remix shares are saved") From 894b5255b5dfd239511a94bdd258fa7f53b2b14e Mon Sep 17 00:00:00 2001 From: Mistium <92952823+Mistium@users.noreply.github.com> Date: Sat, 21 Nov 2026 07:32:45 +0000 Subject: [PATCH 2/3] Keep issue numbers reserved, hide comment existence from non-authors, and stop broadcasting shadow-banned comments --- src/community/comment-issues.osl | 28 ++++++++++++---- src/community/comment-issues.test.osl | 13 ++++++-- src/community/comments.osl | 48 ++++++++++++++++----------- 3 files changed, 62 insertions(+), 27 deletions(-) diff --git a/src/community/comment-issues.osl b/src/community/comment-issues.osl index e78ea14..8a45070 100644 --- a/src/community/comment-issues.osl +++ b/src/community/comment-issues.osl @@ -3,6 +3,7 @@ export { commentIssueCounts, commentIssueState, commentMatchesIssueFilter, + nextCommentIssueNumber, validIssueFilter, validIssueState } @@ -63,21 +64,27 @@ def applyCommentIssue(object comment, array comments, string state, string reque ) boolean isAuthor = normalizeUsername(comment.author.toStr()) == normalizeUsername(requester) if !isAuthor and !canTriage ( - return {ok: false, error: "not allowed", status: 403} + return {ok: false, error: "comment not found", status: 404} ) string current = commentIssueState(comment) - if state == "none" ( - if comment.contains("issue") ( - comment.delete("issue") - ) - return {ok: true, comment: comment, changed: current != ""} + if current == "" and state == "none" ( + return {ok: true, comment: comment, changed: false} ) if current == state ( return {ok: true, comment: comment, changed: false} ) + number reserved = 0 + if comment.contains("issue") and comment.issue != null ( + object stored = comment.issue.assert(object) + if stored.contains("number") and stored.number != null ( + reserved = stored.number.toNum() + ) + ) object issue = {} if current != "" ( issue = comment.issue.assert(object) + ) else if reserved > 0 ( + issue = {number: reserved, openedBy: requester, openedAt: now} ) else ( issue = {number: nextCommentIssueNumber(comments), openedBy: requester, openedAt: now} ) @@ -85,6 +92,15 @@ def applyCommentIssue(object comment, array comments, string state, string reque if state == "done" ( issue.closedBy = requester issue.closedAt = now + ) else if state == "none" ( + issue.removedBy = requester + issue.removedAt = now + if issue.contains("closedBy") ( + issue.delete("closedBy") + ) + if issue.contains("closedAt") ( + issue.delete("closedAt") + ) ) else ( if issue.contains("closedBy") ( issue.delete("closedBy") diff --git a/src/community/comment-issues.test.osl b/src/community/comment-issues.test.osl index cbe669d..c920c6e 100644 --- a/src/community/comment-issues.test.osl +++ b/src/community/comment-issues.test.osl @@ -14,7 +14,7 @@ array comments = [ ] object denied = applyCommentIssue(comments[3].assert(object), comments, "open", "Sam", false, 10) -testing.assert(denied.ok == false and denied.status == 403, "people cannot turn someone else's comment into an issue") +testing.assert(denied.ok == false and denied.status == 404, "people cannot turn someone else's comment into an issue, and cannot tell it exists") object reply = applyCommentIssue(comments[2].assert(object), comments, "open", "mist", true, 10) testing.assert(reply.ok == false and reply.status == 400, "replies cannot become issues") @@ -55,5 +55,14 @@ object counts = commentIssueCounts([comments[1], comments[3], {id: "c4", author: testing.assert(counts.open == 1 and counts.done == 1, "counts split open and done issues") object removed = applyCommentIssue(comments[3].assert(object), comments, "none", "mist", true, 15) -testing.assert(removed.ok == true and removed.changed == true and !removed.comment.assert(object).contains("issue"), "an issue can go back to a plain comment") +testing.assert(removed.ok == true and removed.changed == true and commentIssueState(removed.comment.assert(object)) == "", "an issue can go back to a plain comment") +comments[3] = removed.comment +testing.assert(nextCommentIssueNumber(comments) == 3, "a removed issue keeps its number reserved") +testing.assert(!commentMatchesIssueFilter(comments[3].assert(object), "any", 0), "removed issues are not listed") +object counted = commentIssueCounts([comments[1], comments[3]]) +testing.assert(counted.open == 1 and counted.done == 0, "removed issues are not counted") +object retracked = applyCommentIssue(comments[3].assert(object), comments, "open", "Ana", false, 16) +testing.assert(retracked.ok == true and retracked.comment.issue.number == 2 and retracked.comment.issue.state == "open", "tracking a removed issue again brings back its number") +object plainNone = applyCommentIssue({id: "c9", author: "Lee", content: "hi", parent: ""}, comments, "none", "Lee", false, 17) +testing.assert(plainNone.ok == true and plainNone.changed == false and !plainNone.comment.assert(object).contains("issue"), "removing an issue from a plain comment changes nothing") testing.assert(validIssueFilter("any") and !validIssueFilter("none"), "none is a state, not a filter") diff --git a/src/community/comments.osl b/src/community/comments.osl index 9f6fbda..5f93a92 100644 --- a/src/community/comments.osl +++ b/src/community/comments.osl @@ -295,6 +295,10 @@ def editCommentLocked(string key, string cid, string requester, string trimmed) return {ok: true, comment: target} ) +def commentAuthorShadowed(object comment) boolean ( + return ownerInBannedSet(shadowBannedSet(), (comment.author ?? "").toStr(), (comment.authorId ?? "").toStr()) +) + def commentResponse(object comment, string username) object ( object reactions = {} if comment.contains("reactions") and comment.reactions != null ( @@ -625,12 +629,14 @@ def handleCreateProjectComment(*serve.Context c) ( notifyMentions(created.comment.content.toStr(), commenter, [project.owner.toStr(), parentAuthor], {projectId: project.id, projectTitle: project.title, commentId: newCommentId, preview: preview}) created.comment = commentResponse(created.comment.assert(object), commenter) created.comment.playtimeMs = authorPublicPlaytime(project.id.toStr(), commenter) - siteBroadcastProject(project.id.toStr(), { - type: "comment_created", - projectId: project.id, - comment: created.comment, - actor: commenter - }) + if !commentAuthorShadowed(created.comment.assert(object)) ( + siteBroadcastProject(project.id.toStr(), { + type: "comment_created", + projectId: project.id, + comment: created.comment, + actor: commenter + }) + ) c.json(201, created) ) @@ -675,12 +681,14 @@ def handleEditProjectComment(*serve.Context c) ( ) edited.comment = commentResponse(edited.comment.assert(object), contextString(c, "username")) edited.comment.playtimeMs = authorPublicPlaytime(c.param("id"), edited.comment.author.toStr()) - siteBroadcastProject(c.param("id"), { - type: "comment_edited", - projectId: c.param("id"), - comment: edited.comment, - actor: contextString(c, "username") - }) + if !commentAuthorShadowed(edited.comment.assert(object)) ( + siteBroadcastProject(c.param("id"), { + type: "comment_edited", + projectId: c.param("id"), + comment: edited.comment, + actor: contextString(c, "username") + }) + ) c.json(200, edited) ) @@ -703,12 +711,14 @@ def handlePinProjectComment(*serve.Context c) ( ) updated.comment = commentResponse(updated.comment.assert(object), contextString(c, "username")) updated.comment.playtimeMs = authorPublicPlaytime(project.id.toStr(), updated.comment.author.toStr()) - siteBroadcastProject(project.id.toStr(), { - type: "comment_edited", - projectId: project.id, - comment: updated.comment, - actor: contextString(c, "username") - }) + if !commentAuthorShadowed(updated.comment.assert(object)) ( + siteBroadcastProject(project.id.toStr(), { + type: "comment_edited", + projectId: project.id, + comment: updated.comment, + actor: contextString(c, "username") + }) + ) c.json(200, updated) ) @@ -737,7 +747,7 @@ def handleSetProjectCommentIssue(*serve.Context c) ( ) object comment = commentResponse(updated.comment.assert(object), actor) comment.playtimeMs = authorPublicPlaytime(project.id.toStr(), comment.author.toStr()) - if updated.changed == true ( + if updated.changed == true and !commentAuthorShadowed(comment) ( siteBroadcastProject(project.id.toStr(), { type: "comment_edited", projectId: project.id, From 6a4765e12d54e86f6ca2bf910d8c592972dd6494 Mon Sep 17 00:00:00 2001 From: Mistium <92952823+Mistium@users.noreply.github.com> Date: Sat, 21 Nov 2026 07:35:53 +0000 Subject: [PATCH 3/3] Use the exported shadow-ban check for comment broadcasts --- src/community/comments.osl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/community/comments.osl b/src/community/comments.osl index 5f93a92..1a18f25 100644 --- a/src/community/comments.osl +++ b/src/community/comments.osl @@ -296,7 +296,7 @@ def editCommentLocked(string key, string cid, string requester, string trimmed) ) def commentAuthorShadowed(object comment) boolean ( - return ownerInBannedSet(shadowBannedSet(), (comment.author ?? "").toStr(), (comment.authorId ?? "").toStr()) + return userShadowBanned((comment.author ?? "").toStr()) ) def commentResponse(object comment, string username) object (