Coverage for apps/comments_views/journal/app_settings.py: 93%

27 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-05-19 19:20 +0000

1from comments_views.core.app_settings import AppSettings as BaseAppSettings 

2 

3 

4class AppSettings(BaseAppSettings): 

5 @property 

6 def ARTICLE_COMMENTS(self) -> bool: 

7 """Activates the display of the comments section on the article page.""" 

8 return self._setting("ARTICLE_COMMENTS", False) 

9 

10 @property 

11 def COMMENTS_NESTING(self) -> bool: 

12 """Whether to enable nesting for the display of comments on the article page.""" 

13 return self._setting("COMMENTS_NESTING", False) 

14 

15 @property 

16 def COMMENTS_POLICY_LINK(self) -> str | None: 

17 return self._setting("COMMENTS_POLICY_LINK", None) 

18 

19 ##### BELOW SETTINGS ARE NOT USED YET 

20 @property 

21 def EDIT_BEFORE_MODERATION(self) -> bool: 

22 """ 

23 Whether a comment's author can edit his/her comment while 

24 it has not yet been moderated, even if a moderator is already assigned 

25 to the comment. 

26 """ 

27 return self._setting("EDIT_BEFORE_MODERATION", False) 

28 

29 @property 

30 def DELETE_BEFORE_MODERATION(self) -> bool: 

31 """ 

32 Whether a comment's author can delete his/her comment while 

33 it has not yet been moderated. 

34 """ 

35 return self._setting("DELETE_BEFORE_MODERATION", True) 

36 

37 # DELETE_AFTER_MODERATION UPDATE - Useless right now. 

38 @property 

39 def DELETE_AFTER_MODERATION(self) -> bool: 

40 """ 

41 Whether a comment's author can delete his/her comment after 

42 it has been moderated. 

43 """ 

44 return self._setting("DELETE_AFTER_MODERATION", False) 

45 

46 @property 

47 def POLICY_LINK(self) -> str: 

48 """URL of the comments policy. Only used for display in HTML template.""" 

49 return self._setting("POLICY_LINK", "") 

50 

51 @property 

52 def CONSENT_TEXT(self) -> list[dict]: 

53 """ 

54 Text to display next to the rights consent checkbox whent submitting a comment. 

55 

56 The setting structure must be as the default below. You must provide here the 

57 translation in each available language of the target website. 

58 """ 

59 return self._setting( 

60 "CONSENT_TEXT", 

61 [ 

62 { 

63 "lang": "fr", 

64 "content": [ 

65 "J'accepte que mon commentaire soit publié sous licence <a href='https://creativecommons.org/licenses/by/4.0/deed.fr' target='_blank'>CC BY 4.0.</a>", 

66 "J'accepte que mon nom soit affiché comme auteur du commentaire.", 

67 ], 

68 }, 

69 { 

70 "lang": "en", 

71 "content": [ 

72 "I agree that my comment may be published under a <a href='https://creativecommons.org/licenses/by/4.0/' target='_blank'>CC BY 4.0</a> license.", 

73 "I agree that my name will be displayed as the comment's author.", 

74 ], 

75 }, 

76 ], 

77 ) 

78 

79 

80app_settings = AppSettings()