.. doctest docs/specs/noi/comments.rst .. _noi.specs.comments: ============================== ``comments`` (comments in Noi) ============================== .. currentmodule:: lino.modlib.comments The :mod:`lino.modlib.comments` plugin in :ref:`noi` is configured and used to satisfy the application requirements. .. contents:: :local: .. include:: /../docs/shared/include/tested.rst >>> from lino import startup >>> startup('lino_book.projects.noi1e.settings.demo') >>> from lino.api.doctest import * Overview ======== Public comments in :ref:`noi` are visible even to anonymous users. There are two :class:`Commentable` things in :ref:`noi` tickets and teams. >>> list(rt.models_by_base(comments.Commentable)) [, ] Whether a comment is private or not depends on its :term:`discussion topic`: Comments on a ticket are public when neither the ticket nor its site are marked private. Comments are private by default: >>> dd.plugins.comments.private_default True Comments on a team are public when the team is not private. Tests ===== >>> rt.models.comments.Comment.objects.all().count() 168 >>> rt.models.comments.Comment.objects.filter(private=True).count() 133 >>> rt.login("robin").show(comments.Comments, ... column_names="id ticket__site user owner", ... offset=82, limit=6) ... #doctest: +ELLIPSIS +NORMALIZE_WHITESPACE +REPORT_UDIFF ==== ======== ============= =============================================== ID Site Author Topic ---- -------- ------------- ----------------------------------------------- 83 Rolf Rompen `Front-end team `__ 84 Robin Rood `Front-end team `__ 85 welket Jean `#1 (⚹ Föö fails to bar when baz) `__ 86 welket Luc `#1 (⚹ Föö fails to bar when baz) `__ 87 welket Marc `#1 (⚹ Föö fails to bar when baz) `__ 88 welket Mathieu `#1 (⚹ Föö fails to bar when baz) `__ ==== ======== ============= =============================================== The demo database contains 168 comments, 84 about a team and 84 about a ticket. 34 comments are public. >>> comments.Comment.objects.all().count() 168 >>> comments.Comment.objects.filter(ticket__isnull=False).count() 84 >>> comments.Comment.objects.filter(ticket=None).count() 84 >>> comments.Comment.objects.filter(group=None).count() 84 >>> comments.Comment.objects.filter(private=False).count() 35 >>> rt.login("marc").show(comments.RecentComments) ... #doctest: +ELLIPSIS +NORMALIZE_WHITESPACE +REPORT_UDIFF `... `__ by **marc** in reply to **jean** about `#12 `__@welket : Lorem ipsum ... (...) ... `... `__ by **luc** in reply to **jean** about `#11 `__@aab : Lorem ipsum dolor ... (...) ... >>> rt.show(comments.RecentComments) ... #doctest: +ELLIPSIS +NORMALIZE_WHITESPACE +REPORT_UDIFF `... `__ by **robin** in reply to **rolf** about `#11 `__@aab : Styled comment pasted from word! `... `__ by **rolf** about `#11 `__@aab (1 reply) : Two paragraphs of plain text. (...) ...