Refactor: is this Node visible

Russell 1y, 125d ago

The logic to determine whether a Node is displayed or visible is scattered in both the model and the template.

We should refactor this logic into a function or a method (maybe on the Namespace class). This change should make it easier to reason if or how to present a Node given the current User while supporting Namespace options to control behavior.

List of things that can effect how a Node is presented:

  • is the node disabled? (a disabled node should be set as a placeholder)
  • is the node verified? (by default a Namespace will display unverified Nodes)
  • is the node approved? (this matters if the Namespace owner wants to approve all comments)
  • is the user a moderator / owner of the Namespace?
  • was the node flagged as spam by a moderator / owner of the Namespace?
  • was the node flagged as spam by an end user?

By default a Namespace will display a Node regardless of the state of its verified or approved attributes: A Namespace owner may set any of the following to True:

  • hide_until_approved
  • hide_unverified

This changes the behavior to hide nodes by default.

What's next? check your email to log in!



Leave the first remark and get the conversation going!