diff options
| author | Igor Soarez <igor@soarez.org> | 2026-11-16 16:21:44 +0200 |
|---|---|---|
| committer | Igor Soarez <igor@soarez.org> | 2026-11-16 16:21:44 +0200 |
| commit | 75aa62d5920f4adf717ae780d7032c105cceb899 (patch) | |
| tree | c971bd18302388c8d2aee14abc751e1a0c90d3a3 /bin/pi-forum | |
| parent | 6596a67c626e1a36a913f3799b65869b8edaf4ef (diff) | |
The forum tool's mute holds one forum's posts -- mentions, and unread
counts -- or, without a forum, everything, direct messages included.
unmute releases them; without a forum it ends every mute. When and
whether to mute is the agent's call; the description asks it to mute
only when interruptions would hurt the task, and to unmute when done.
Held messages wait in the delivery queue, so nothing is lost and a
muted forum's unread count is reported once it is unmuted. A sender is
told the receiver muted these, and a post's report lists muted members
apart from those woken. A run the agent starts while muted opens with
what is held, and says that direct messages still arrive when only
forums are muted. The status bar, the tool's list, /forums and pi-forum
show who is muted. The mute is kept in the registration, so it survives
/reload and a restart that restores the agent.
Diffstat (limited to 'bin/pi-forum')
| -rwxr-xr-x | bin/pi-forum | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/bin/pi-forum b/bin/pi-forum index 37ea051..d3c567c 100755 --- a/bin/pi-forum +++ b/bin/pi-forum @@ -145,8 +145,9 @@ function format(post, no, forum, opts) { return `${head.join(" ")}\n${post.text.replace(/\s+$/, "")}\n`; } -function memberLine(a) { - if (!a.stopped) return ` ${who(a)}${dim(` ${a.cwd}`)}`; +function memberLine(a, forumId) { + const muted = a.muted && (a.muted.all || (a.muted.forums || []).includes(forumId)) ? yellow(" muted") : ""; + if (!a.stopped) return ` ${who(a)}${muted}${dim(` ${a.cwd}`)}`; return dim(` ${who(a)} stopped${a.stoppedAt ? ` since ${when(a.stoppedAt)}` : ""}`); } @@ -163,7 +164,7 @@ function list() { const last = posts.length ? `, last ${when(posts[posts.length - 1].at)}` : ""; console.log(`${bold(f.name)} ${dim(`[${f.id}] ${posts.length} post(s)${last}`)}`); members.sort((a, b) => a.stopped - b.stopped); - console.log(members.length ? members.map(memberLine).join("\n") : dim(" no members")); + console.log(members.length ? members.map((a) => memberLine(a, f.id)).join("\n") : dim(" no members")); if (f.pin) console.log(` ${yellow("pin")}: ${f.pin.text} ${dim(`(${who(f.pin.by)}, ${when(f.pin.at)})`)}`); console.log(); } |
