Fossil

Timeline
Login

Timeline

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

About branch forumpost-locking

The ability to "lock" forum posts, such that subsequent responses and edits are disallowed, has being a recurring feature request since the Fossil forum capabilities were introduced. The distributed data model is in inherent conflict with that feature, so "real" locking isn't feasible, but we can implement "advisory" locking which functions similarly to how leaf closure works.

The forum-locking branch provides one implementation of doing so. We use the term "lock" and "close" interchangeably here. "Locked" is the more conventional term in this context but "closed" is the name of the underlying artifact tag for historical reasons.

Summary: by applying a "closed" tag to a forum post, we can keep the UI from permitting edits of, and responses to, that post, recursively in the case of responses. That is, once a post is closed, all responses to it are also implicitly closed (without explicit application of tags to them).

The core requirements of forum post closure are that a closed post cannot be edited, may not be responded to, and any responses which exist before closure may not be edited after the post is closed. There are exceptions to these restrictions:

  • Admin users may continue to edit and respond.

  • No attempt is made to impose restrictions on posts which arrive via the Fossil sync mechanism. Only posts manipulated via the UI are handled. (This is, not coincidentally, similar to how leaf closure works: a subsequent check-in to a closed leaf which arrives via the sync protocol silently trumps the closure.)

Though fundamentally simple to implement, the interactions between versions of posts and linking of responses introduces new complexity on how the effect of a "closed" tag cascades through a post's responses, and closure of forum posts requires handling of a couple of oddities which do not apply to the simpler case of leaf/branch closure:

  • Any given forum post may have any number of edits. Each edited version has its own identity (hash), linked to its previous version via a P-card (same as a wiki page or check-in).

  • Any given response to a post may be in response to any given version of the post it's responding to. That is, the I-cards may differ for each response to a given edited post.

The forum UI hides that complexity by rendering forum posts in a conventional tree-style view, showing (by default) the latest version of any given post, noting that a post and a response are the same thing, differing only in whether or not they have an "in-reply-to" parent (an "I-card", in Fossil artifact terms).

Unlike leaf closure, which uses a non-propagating "closed" tag, forum posts require that a propagating "closed" tag be applied to (only) the first version of a given post. If the tag is instead applied to a subsequent version, it becomes possible to reply to prior versions because they lack the lock. In order to keep complexity to a minimum, and avoid tagging every version of a given post, closing and re-opening a post, via addition resp. cancellation of a "closed" tag, always applies to the (only) the first version. This approach makes it relatively simple to detect closure of a post and cascade that through all responses (recursively). It also means that the tag does not have to be updated when an admin creates a new version of a given post by editing it.

The caveat with the approach of tagging only the first version is that Fossil's data model permits tags to be applied to arbitrary artifacts, e.g. to arbitrary versions of a given post. Closing a non-initial version will, however, confuse the forum view and can either cause posts to appear locked though they are not intended to be, or to be effectively unlocked despite a parent post being locked. This caveat is considered a minimal risk: a user would have to tag the second (or subsequent) version of a given post via the CLI "tag" command (or similar) to introduce these side effects. The UI for closing and re-opening takes care to always deal with the initial version of posts.

20 check-ins related to "forumpost-locking"
2023-06-10
09:16
Add ability to "close" forum posts. ... (check-in: 673dc38f user: stephan tags: trunk)
2023-06-07
12:07
Initial version of the /setup_forum page. ... (Closed-Leaf check-in: b370c189 user: stephan tags: forumpost-locking)
2023-06-06
19:38
Add the forum-close-policy boolean config setting. If true, forum moderators may close/re-open forum posts, as well as reply to closed posts. ... (check-in: 162fc1e6 user: stephan tags: forumpost-locking)
2023-06-03
08:49
Merge trunk into forumpost-locking branch. ... (check-in: 8e7de26a user: stephan tags: forumpost-locking)
2023-06-01
18:02
Admin users have a link in /forumthread to show the hash of all artifacts associated with that thread. ... (check-in: 83928d8a user: drh tags: trunk)
2023-04-16
13:13
Merge trunk into forumpost-locking branch. ... (check-in: 0af37104 user: stephan tags: forumpost-locking)
2023-04-14
15:31
Squelch an unitialized var warning from gcc 12.2.1 on Alpine Linux. ... (check-in: 3783a24e user: stephan tags: trunk)
2023-03-02
17:13
Merge trunk into forumpost-locking branch. ... (check-in: 27c3423e user: stephan tags: forumpost-locking)
2023-02-28
05:41
The /zip and /tarball built-in help now makes clear that the VERSION/ part of the URL is optional to help avoid confusions like we're seeing in the forum post that sparked this sequence of improvements. ... (check-in: 4717db33 user: wyoung tags: trunk)
2023-02-24
23:39
Move forumpost close/re-open controls around. Add, if appropriate, a Close/Re-open button to the thread view, but only for the currently-selected post. ... (check-in: ecc324b6 user: stephan tags: forumpost-locking)
23:38
In /admin_log, add rowid DESC to the ORDER BY so that entries with the same timestamp predictably sort newest-first. ... (check-in: 914c6b5a user: stephan tags: forumpost-locking)
2023-02-22
06:09
Minor CSS tweaks to closed forum posts. ... (check-in: 3078ff46 user: stephan tags: forumpost-locking)
04:46
Rework forumpost closure to always apply to the first artifact in an edit chain to enable consistent behavior across the whole chain and responses to arbitrary versions within that chain. Add rudimentary UI elements for closing/re-opening posts, but their layout needs to be revisited (noting that they need to be in a separate form from the main editor so that closing/re-opening introduces only a smalll control artifact instead of a whole forumpost artifact). ... (check-in: cc6ca4e1 user: stephan tags: forumpost-locking)
2023-02-21
10:30
Initial (untested) code for creating the control artifact for closing and re-opening forum threads. Extend test-forumthread's tree view to show thread closure. ... (check-in: 32fc62e6 user: stephan tags: forumpost-locking)
09:52
Add db_add_unsent() and replace numerous "INSERT OR IGNORE INTO unset" statements with that. ... (check-in: 98d4ee73 user: stephan tags: forumpost-locking)
08:47
Coding style tweaks. ... (check-in: 9fc70f6f user: stephan tags: forumpost-locking)
03:49
Closed forum threads can no longer be edited by non-admins. Fix broken ability of non-builtin users to delete their own pending-moderation post. UI controls for closing/reing-open threads are still TODO. ... (check-in: 8f02c1d4 user: stephan tags: forumpost-locking)
01:58
Add capability to determine whether a given sub-thread inherits a lock from a parent. Re-label "locked" to "closed" per /chat feedback. ... (check-in: 464f4d17 user: stephan tags: forumpost-locking)
00:52
Initial bits for "locking" forum (sub)threads using a "closed" tag. This currently affects the display but does not hinder edits made via malicious misuse because the pieces needed for such validation do not yet have access to the relevant ForumPost objects. ... (check-in: 4d664bfe user: stephan tags: forumpost-locking)
2023-02-20
14:58
Change the typedef of u32 in search.c so that it works in older PPC macs. ... (check-in: f82caec5 user: drh tags: trunk)