Pollux I suggest including more calculations, such as differences, ratios, and even mathematical functions. This could be very helpful in putting things in perspective.
Hmm, I wonder if this could be implemented as a requirement? All that would be needed is for the metric values to be provided to requirements. Then, a requirement could take such a string like you provided ($warnings > 2 * lg($posts)
) as a setting, parse it out (inventing mini programming languages is fun!), and validate against the provided metric values.
Right now I need to focus on Flarum CLI, so this feature is going in the "eventual todo" list alongside content moderation.
For content moderation, the most trivial solution would be to allow "listeners". So if the user satisfies criterion X, a function would run on some events. This would handle stuff like FoF filter, but the listeners would have to be quite bulky.
What if metrics and requirements could be conceptually applied to various models? Then, we could create "rules" for members of criteria.
For example, take creation of posts.
If a user satisfies metrics M1 and requirements R1, and the post satisfies metrics M2 and requirements R2, do something to the post.
The part I'm struggling to reconcile is actions vs that "something". Anyone who has done hardware development can recognize that actions happen "on the edge" of group membership qualification:
(let one of those waveforms be qualification. When qualification state changes, on gain / on loss actions are executed)
On the other hand, this "something" for content moderation happens while qualification is active (users currently qualifying for a criteria would be affected).
Another way to consider this is that content created by users could be "mutated" on creation. This could be a generalization of the above "listener" idea that decouples the "when" (by having metrics and requirements for models beyond User) from the "what" (mutations applied to posts, discussions, messages, etc before they are created/edited).
Then, there's the question of whether "mutations" and "actions" are isomorphic: does it matter that "actions" are triggered on state change, and "mutations" modify models as they are created / edited? I feel like yet again, the "what" should be decoupled from the "when", and these should be treated as isomorphic. But more thinking is needed here.