Merge lp:~widelands-dev/widelands-website/anti_spam into lp:widelands-website
- anti_spam
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 423 |
Proposed branch: | lp:~widelands-dev/widelands-website/anti_spam |
Merge into: | lp:widelands-website |
Diff against target: |
360 lines (+151/-25) 11 files modified
pybb/admin.py (+2/-2) pybb/forms.py (+0/-1) pybb/migrations/0002_auto_20161001_2046.py (+19/-0) pybb/models.py (+24/-0) pybb/urls.py (+2/-1) pybb/views.py (+32/-5) templates/pybb/forum.html (+35/-4) templates/pybb/inlines/display_category.html (+16/-7) templates/pybb/last_posts.html (+7/-5) templates/pybb/pybb_moderate_info.html (+12/-0) templates/pybb/topic.html (+2/-0) |
To merge this branch: | bzr merge lp:~widelands-dev/widelands-website/anti_spam |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
SirVer | Approve | ||
GunChleoc | Approve | ||
Review via email: mp+307869@code.launchpad.net |
Commit message
Hide all posts/topics which are potentially spam using a keyword filter.
Description of the change
Hide all posts/topics which are potentially spam using a keyword filter.
Add a boolean 'hided' field to pybb.Post.
Post filter: Applies if a post contains 'vashikaran' AND 'baba'. This catches each case insentive occurrence of this strings, so 'VaShIkaRan' is caught as well as 'babaco' or 'blabababla'. Because 'Baba' is also known as 'Bye-bye' these keywords must occur both.
Topic name filter: Applies if ' baba ' (as a word) OR 'ji' is used. Also case insensitive. Should catch ' baBaJi' as 'baBa ji' or ' baba '
The filters are set in pybb/views.py
When commiting on the server, ./manage.py migrate must be run before the website is restartet. This adds the 'hided' field to all columns in the database with default value 'False'.
kaputtnik (franku) wrote : | # |
SirVer (sirver) wrote : | # |
That Is Fine. Well review offline then. I hope I get around to it tomorrow. Maybe it will be Saturday.
> Am 06.10.2016 um 20:02 schrieb kaputtnik <email address hidden>:
>
> Hm, the diff is truncated... maybe remove the akismet api?
> --
> https:/
> You are subscribed to branch lp:widelands-website.
kaputtnik (franku) wrote : | # |
Just a thought of last night:
Change the Text of the redirect page saying that EACH Post is hided now and will be moderated.
So if the spammers ever read this, they should assume that spamming has no chance here. If a non spammer read this (i guess this would be very rare, if it ever comes up) we could explain him the text.
And of course, it would be better to have the lists of keywords in local_settings.py.
I am very busy these days with normal work, so on Saturday i am working the whole day and in the evening my son is visiting me.
GunChleoc (gunchleoc) wrote : | # |
Just a quick note: past tense of "hide" is "hid" ;)
GunChleoc (gunchleoc) wrote : | # |
I have decided to rename hided -> hidden right now, because it affects the models.
Not tested but code LGTM as far as I can tell.
I'd say do a final text to make sure that I didn't mess anything up and then go live.
SirVer (sirver) wrote : | # |
1) Is it necessary that we ship the askimet client in our repo, i.e. can it not be installed wia pip_requirement
2) I was also changing hided -> hidden, at the very same time than Gun - but she beat me to submitting :).
3) You should also check in the title of the post, not only the body. We had some spam that only had data in the title. You can do that cheaply by just concatenating: text = title + body and then working over text.
4) It might make sense to add a regular expression checking for international phone numbers - I do not think such a post can ever be legit.
5) You are marking any post of a user with 'ji' in its name as SPAM. Is that not a bit too broad?
6) There is no admin notification right now - so we will not know if posts are in the queue for moderation. I think that is fine for now, but we will need to remember to check daily once this is deployed until we have that. I am all for deploying this soon though, this SPAM is annoying.
kaputtnik (franku) wrote : | # |
Just short answers because i am in hurry:
> 1) Is it necessary that we ship the askimet client in our repo, i.e. can it
> not be installed wia pip_requirement
I don't why i am downloaded the complete zip file, whereas one could also download the py-file (containing all classes and functions) I have removed the complete zip file now in this branch. Regarding to pip_requirements: I actually don't know, sorry. But a single file shouldn't be a problem for our repo.
> 3) You should also check in the title of the post, not only the body. We had
> some spam that only had data in the title. You can do that cheaply by just
> concatenating: text = title + body and then working over text.
This is already in there. See the description of this merge proposal "Topic name filter: "
> 4) It might make sense to add a regular expression checking for international
> phone numbers - I do not think such a post can ever be legit.
Yes, but i am not a regular expression freak :-D Will take some time and tests for me to do something like that.
> 5) You are marking any post of a user with 'ji' in its name as SPAM. Is that
> not a bit too broad?
Yes, maybe change it into ' ji ' or ' ji'
> 6) There is no admin notification right now - so we will not know if posts are
> in the queue for moderation. I think that is fine for now, but we will need to
> remember to check daily once this is deployed until we have that. I am all for
> deploying this soon though, this SPAM is annoying.
Yes, if we add admin notification, we should also prevent notification of normal users (who has 'Inform me on new topics" activated).
Thanks for the changes :-)
kaputtnik (franku) wrote : | # |
There is a akismet Pypi package, so we could easily add this to pip_requirement
> > 5) You are marking any post of a user with 'ji' in its name as SPAM. Is that
> > not a bit too broad?
>
> Yes, maybe change it into ' ji ' or ' ji'
Correcting: 'ji' is only used for topic names (subject). And i think it is better to have a difference between topic name and post text.
Looking at my gathered spam posts, we should also add ' molvi' to the keywords. Both in topic name and post text.
I will make the following changes tomorrow:
- Add ' molvi' to keywords
- Using of keyword lists in local_settings.py (instead of hardcoded in pybb/views.py)
- merge into trunk and deploy
For me this is quite an interesting problem and i would be interested to make an own 'anti_spam' app of it (at least because there is a lot to learn). But since akismet makes his/here job, for widelands it would be better to use this service, because it is maybe more effective in a shorter time. But if we use this we may need additional views and buttons to submit ham or spam to akismet.
kaputtnik (franku) wrote : | # |
Merged and deployed.
Preview Diff
1 | === modified file 'pybb/admin.py' | |||
2 | --- pybb/admin.py 2012-03-18 21:06:49 +0000 | |||
3 | +++ pybb/admin.py 2016-10-09 11:17:41 +0000 | |||
4 | @@ -39,7 +39,7 @@ | |||
5 | 39 | ), | 39 | ), |
6 | 40 | (_('Additional options'), { | 40 | (_('Additional options'), { |
7 | 41 | 'classes': ('collapse',), | 41 | 'classes': ('collapse',), |
9 | 42 | 'fields': (('views',), ('sticky', 'closed'), 'subscribers') | 42 | 'fields': (('views',), ('sticky', 'closed', 'hidden'), 'subscribers') |
10 | 43 | } | 43 | } |
11 | 44 | ), | 44 | ), |
12 | 45 | ) | 45 | ) |
13 | @@ -57,7 +57,7 @@ | |||
14 | 57 | ), | 57 | ), |
15 | 58 | (_('Additional options'), { | 58 | (_('Additional options'), { |
16 | 59 | 'classes': ('collapse',), | 59 | 'classes': ('collapse',), |
18 | 60 | 'fields' : (('created', 'updated'), 'user_ip') | 60 | 'fields' : (('created', 'updated'), 'user_ip', 'hidden') |
19 | 61 | } | 61 | } |
20 | 62 | ), | 62 | ), |
21 | 63 | (_('Message'), { | 63 | (_('Message'), { |
22 | 64 | 64 | ||
23 | === modified file 'pybb/forms.py' | |||
24 | --- pybb/forms.py 2016-06-22 21:02:53 +0000 | |||
25 | +++ pybb/forms.py 2016-10-09 11:17:41 +0000 | |||
26 | @@ -66,7 +66,6 @@ | |||
27 | 66 | post = Post(topic=topic, user=self.user, user_ip=self.ip, | 66 | post = Post(topic=topic, user=self.user, user_ip=self.ip, |
28 | 67 | markup=self.cleaned_data['markup'], | 67 | markup=self.cleaned_data['markup'], |
29 | 68 | body=self.cleaned_data['body']) | 68 | body=self.cleaned_data['body']) |
30 | 69 | |||
31 | 70 | post.save(*args, **kwargs) | 69 | post.save(*args, **kwargs) |
32 | 71 | 70 | ||
33 | 72 | if pybb_settings.ATTACHMENT_ENABLE: | 71 | if pybb_settings.ATTACHMENT_ENABLE: |
34 | 73 | 72 | ||
35 | === added file 'pybb/migrations/0002_auto_20161001_2046.py' | |||
36 | --- pybb/migrations/0002_auto_20161001_2046.py 1970-01-01 00:00:00 +0000 | |||
37 | +++ pybb/migrations/0002_auto_20161001_2046.py 2016-10-09 11:17:41 +0000 | |||
38 | @@ -0,0 +1,19 @@ | |||
39 | 1 | # -*- coding: utf-8 -*- | ||
40 | 2 | from __future__ import unicode_literals | ||
41 | 3 | |||
42 | 4 | from django.db import models, migrations | ||
43 | 5 | |||
44 | 6 | |||
45 | 7 | class Migration(migrations.Migration): | ||
46 | 8 | |||
47 | 9 | dependencies = [ | ||
48 | 10 | ('pybb', '0001_initial'), | ||
49 | 11 | ] | ||
50 | 12 | |||
51 | 13 | operations = [ | ||
52 | 14 | migrations.AddField( | ||
53 | 15 | model_name='post', | ||
54 | 16 | name='hidden', | ||
55 | 17 | field=models.BooleanField(default=False, verbose_name='Hidden'), | ||
56 | 18 | ), | ||
57 | 19 | ] | ||
58 | 0 | 20 | ||
59 | === modified file 'pybb/models.py' | |||
60 | --- pybb/models.py 2016-06-22 21:02:53 +0000 | |||
61 | +++ pybb/models.py 2016-10-09 11:17:41 +0000 | |||
62 | @@ -95,6 +95,13 @@ | |||
63 | 95 | except IndexError: | 95 | except IndexError: |
64 | 96 | return None | 96 | return None |
65 | 97 | 97 | ||
66 | 98 | @property | ||
67 | 99 | def last_nonhidden_post(self): | ||
68 | 100 | posts = self.posts.order_by('-created').filter(hidden=False).select_related() | ||
69 | 101 | try: | ||
70 | 102 | return posts[0] | ||
71 | 103 | except IndexError: | ||
72 | 104 | return None | ||
73 | 98 | 105 | ||
74 | 99 | class Topic(models.Model): | 106 | class Topic(models.Model): |
75 | 100 | forum = models.ForeignKey(Forum, related_name='topics', verbose_name=_('Forum')) | 107 | forum = models.ForeignKey(Forum, related_name='topics', verbose_name=_('Forum')) |
76 | @@ -132,6 +139,22 @@ | |||
77 | 132 | return self.posts.all().order_by('-created').select_related()[0] | 139 | return self.posts.all().order_by('-created').select_related()[0] |
78 | 133 | 140 | ||
79 | 134 | @property | 141 | @property |
80 | 142 | def last_nonhidden_post(self): | ||
81 | 143 | try: | ||
82 | 144 | return self.posts.all().order_by('-created').filter(hidden=False).select_related()[0] | ||
83 | 145 | except IndexError: | ||
84 | 146 | return self.posts.all().order_by('-created').select_related()[0] | ||
85 | 147 | |||
86 | 148 | # If the first post of this topic is hidden, the topic is hidden | ||
87 | 149 | @property | ||
88 | 150 | def is_hidden(self): | ||
89 | 151 | try: | ||
90 | 152 | p = self.posts.all().order_by('created').filter(hidden=False).select_related()[0] | ||
91 | 153 | except IndexError: | ||
92 | 154 | return True | ||
93 | 155 | return False | ||
94 | 156 | |||
95 | 157 | @property | ||
96 | 135 | def post_count(self): | 158 | def post_count(self): |
97 | 136 | return Post.objects.filter(topic=self).count() | 159 | return Post.objects.filter(topic=self).count() |
98 | 137 | 160 | ||
99 | @@ -193,6 +216,7 @@ | |||
100 | 193 | body_html = models.TextField(_('HTML version')) | 216 | body_html = models.TextField(_('HTML version')) |
101 | 194 | body_text = models.TextField(_('Text version')) | 217 | body_text = models.TextField(_('Text version')) |
102 | 195 | user_ip = models.GenericIPAddressField(_('User IP'), default='') | 218 | user_ip = models.GenericIPAddressField(_('User IP'), default='') |
103 | 219 | hidden = models.BooleanField(_('Hidden'), blank=True, default=False) | ||
104 | 196 | 220 | ||
105 | 197 | # Django sphinx | 221 | # Django sphinx |
106 | 198 | if settings.USE_SPHINX: | 222 | if settings.USE_SPHINX: |
107 | 199 | 223 | ||
108 | === modified file 'pybb/urls.py' | |||
109 | --- pybb/urls.py 2016-06-04 14:17:40 +0000 | |||
110 | +++ pybb/urls.py 2016-10-09 11:17:41 +0000 | |||
111 | @@ -30,7 +30,8 @@ | |||
112 | 30 | url('^post/(?P<post_id>\d+)/$', views.show_post, name='pybb_post'), | 30 | url('^post/(?P<post_id>\d+)/$', views.show_post, name='pybb_post'), |
113 | 31 | url('^post/(?P<post_id>\d+)/edit/$', views.edit_post, name='pybb_edit_post'), | 31 | url('^post/(?P<post_id>\d+)/edit/$', views.edit_post, name='pybb_edit_post'), |
114 | 32 | url('^post/(?P<post_id>\d+)/delete/$', views.delete_post, name='pybb_delete_post'), | 32 | url('^post/(?P<post_id>\d+)/delete/$', views.delete_post, name='pybb_delete_post'), |
116 | 33 | 33 | url('pybb_moderate_info/$', views.pybb_moderate_info), | |
117 | 34 | |||
118 | 34 | # Attachment | 35 | # Attachment |
119 | 35 | url('^attachment/(?P<hash>\w+)/$', views.show_attachment, name='pybb_attachment'), | 36 | url('^attachment/(?P<hash>\w+)/$', views.show_attachment, name='pybb_attachment'), |
120 | 36 | 37 | ||
121 | 37 | 38 | ||
122 | === modified file 'pybb/views.py' | |||
123 | --- pybb/views.py 2016-06-15 19:20:24 +0000 | |||
124 | +++ pybb/views.py 2016-10-09 11:17:41 +0000 | |||
125 | @@ -1,6 +1,6 @@ | |||
126 | 1 | import math | 1 | import math |
127 | 2 | from mainpage.templatetags.wl_markdown import do_wl_markdown | 2 | from mainpage.templatetags.wl_markdown import do_wl_markdown |
129 | 3 | from pybb.markups import mypostmarkup | 3 | from pybb.markups import mypostmarkup |
130 | 4 | 4 | ||
131 | 5 | from django.shortcuts import get_object_or_404 | 5 | from django.shortcuts import get_object_or_404 |
132 | 6 | from django.http import HttpResponseRedirect, HttpResponse, HttpResponseNotFound, Http404 | 6 | from django.http import HttpResponseRedirect, HttpResponse, HttpResponseNotFound, Http404 |
133 | @@ -10,13 +10,15 @@ | |||
134 | 10 | from django.core.urlresolvers import reverse | 10 | from django.core.urlresolvers import reverse |
135 | 11 | from django.db import connection | 11 | from django.db import connection |
136 | 12 | from django.utils import translation | 12 | from django.utils import translation |
137 | 13 | from django.shortcuts import render | ||
138 | 13 | 14 | ||
139 | 14 | from pybb.util import render_to, paged, build_form, quote_text, paginate, set_language, ajax, urlize | 15 | from pybb.util import render_to, paged, build_form, quote_text, paginate, set_language, ajax, urlize |
140 | 15 | from pybb.models import Category, Forum, Topic, Post, PrivateMessage, Attachment,\ | 16 | from pybb.models import Category, Forum, Topic, Post, PrivateMessage, Attachment,\ |
141 | 16 | MARKUP_CHOICES | 17 | MARKUP_CHOICES |
143 | 17 | from pybb.forms import AddPostForm, EditPostForm, UserSearchForm | 18 | from pybb.forms import AddPostForm, EditPostForm, UserSearchForm |
144 | 18 | from pybb import settings as pybb_settings | 19 | from pybb import settings as pybb_settings |
145 | 19 | from pybb.orm import load_related | 20 | from pybb.orm import load_related |
146 | 21 | from django.conf import settings | ||
147 | 20 | 22 | ||
148 | 21 | try: | 23 | try: |
149 | 22 | from notification import models as notification | 24 | from notification import models as notification |
150 | @@ -74,7 +76,7 @@ | |||
151 | 74 | } | 76 | } |
152 | 75 | show_forum = render_to('pybb/forum.html')(show_forum_ctx) | 77 | show_forum = render_to('pybb/forum.html')(show_forum_ctx) |
153 | 76 | 78 | ||
155 | 77 | 79 | ||
156 | 78 | def show_topic_ctx(request, topic_id): | 80 | def show_topic_ctx(request, topic_id): |
157 | 79 | 81 | ||
158 | 80 | try: | 82 | try: |
159 | @@ -112,7 +114,7 @@ | |||
160 | 112 | # profiles = Profile.objects.filter(user__pk__in= | 114 | # profiles = Profile.objects.filter(user__pk__in= |
161 | 113 | # set(x.user.id for x in page.object_list)) | 115 | # set(x.user.id for x in page.object_list)) |
162 | 114 | # profiles = dict((x.user_id, x) for x in profiles) | 116 | # profiles = dict((x.user_id, x) for x in profiles) |
164 | 115 | 117 | ||
165 | 116 | # for post in page.object_list: | 118 | # for post in page.object_list: |
166 | 117 | # post.user.pybb_profile = profiles[post.user.id] | 119 | # post.user.pybb_profile = profiles[post.user.id] |
167 | 118 | 120 | ||
168 | @@ -159,7 +161,29 @@ | |||
169 | 159 | initial={'markup': "markdown", 'body': quote}) | 161 | initial={'markup': "markdown", 'body': quote}) |
170 | 160 | 162 | ||
171 | 161 | if form.is_valid(): | 163 | if form.is_valid(): |
173 | 162 | post = form.save(); | 164 | # TODO: Add akismet check here |
174 | 165 | spam = False | ||
175 | 166 | |||
176 | 167 | # Check in post text. | ||
177 | 168 | text = form.cleaned_data['body'] | ||
178 | 169 | if any(x in text.lower() for x in settings.ANTI_SPAM_BODY): | ||
179 | 170 | spam = True | ||
180 | 171 | |||
181 | 172 | # Check in topic subject ('name' is empty if this a post to an existing topic) | ||
182 | 173 | text = form.cleaned_data['name'] | ||
183 | 174 | if text != '': | ||
184 | 175 | # This is a new topic | ||
185 | 176 | if any(x in text.lower() for x in settings.ANTI_SPAM_TOPIC): | ||
186 | 177 | spam = True | ||
187 | 178 | |||
188 | 179 | post = form.save() | ||
189 | 180 | if spam: | ||
190 | 181 | # Hide the post against normal users | ||
191 | 182 | post.hidden = True | ||
192 | 183 | post.save() | ||
193 | 184 | # Redirect to an info page to inform the user | ||
194 | 185 | return HttpResponseRedirect('pybb_moderate_info') | ||
195 | 186 | |||
196 | 163 | if not topic: | 187 | if not topic: |
197 | 164 | post.topic.subscribers.add(request.user) | 188 | post.topic.subscribers.add(request.user) |
198 | 165 | return HttpResponseRedirect(post.get_absolute_url()) | 189 | return HttpResponseRedirect(post.get_absolute_url()) |
199 | @@ -353,3 +377,6 @@ | |||
200 | 353 | 377 | ||
201 | 354 | html = urlize(html) | 378 | html = urlize(html) |
202 | 355 | return {'content': html} | 379 | return {'content': html} |
203 | 380 | |||
204 | 381 | def pybb_moderate_info(request): | ||
205 | 382 | return render(request, 'pybb/pybb_moderate_info.html') | ||
206 | 356 | 383 | ||
207 | === modified file 'templates/pybb/forum.html' | |||
208 | --- templates/pybb/forum.html 2016-04-29 07:28:16 +0000 | |||
209 | +++ templates/pybb/forum.html 2016-10-09 11:17:41 +0000 | |||
210 | @@ -40,7 +40,8 @@ | |||
211 | 40 | </tr> | 40 | </tr> |
212 | 41 | </thead> | 41 | </thead> |
213 | 42 | <tbody> | 42 | <tbody> |
215 | 43 | {% for topic in topics %} | 43 | {% for topic in topics %} |
216 | 44 | {% if not topic.is_hidden %} | ||
217 | 44 | <tr class="{% cycle 'odd' 'even' %}"> | 45 | <tr class="{% cycle 'odd' 'even' %}"> |
218 | 45 | <td class="forumIcon center"> | 46 | <td class="forumIcon center"> |
219 | 46 | {% if topic|pybb_has_unreads:user %} | 47 | {% if topic|pybb_has_unreads:user %} |
220 | @@ -60,13 +61,43 @@ | |||
221 | 60 | Views: {{ topic.views }} | 61 | Views: {{ topic.views }} |
222 | 61 | </td> | 62 | </td> |
223 | 62 | <td class="lastPost"> | 63 | <td class="lastPost"> |
225 | 63 | {%if topic.last_post %} | 64 | {% if user.is_superuser %} |
226 | 65 | {% if topic.last_post %} | ||
227 | 66 | {{ topic.last_post.user|user_link }} <a href="{{ topic.last_post.get_absolute_url }}">»</a><br /> | ||
228 | 67 | <span class="small">on {{ topic.last_post.created|custom_date:user }}</span> | ||
229 | 68 | {% endif %} | ||
230 | 69 | {% else %} | ||
231 | 70 | {{ topic.last_nonhidden_post.user|user_link }} <a href="{{ topic.last_nonhidden_post.get_absolute_url }}">»</a><br /> | ||
232 | 71 | <span class="small">on {{ topic.last_nonhidden_post.created|custom_date:user }}</span> | ||
233 | 72 | {% endif %} | ||
234 | 73 | </td> | ||
235 | 74 | </tr> | ||
236 | 75 | {% elif user.is_superuser %} | ||
237 | 76 | <tr class="{% cycle 'odd' 'even' %}"> | ||
238 | 77 | <td class="forumIcon center"> | ||
239 | 78 | {% if topic|pybb_has_unreads:user %} | ||
240 | 79 | <img src="{{ MEDIA_URL }}forum/img/doc_big_work_star.png" style="margin: 0px;" alt="" class="middle" /> | ||
241 | 80 | {% else %} | ||
242 | 81 | <img src="{{ MEDIA_URL }}forum/img/doc_big_work.png" style="margin: 0px;" alt="" class="middle" /> | ||
243 | 82 | {% endif %} | ||
244 | 83 | </td> | ||
245 | 84 | <td class="forumTitle"> | ||
246 | 85 | {% if topic.sticky %}<img src="{{ MEDIA_URL }}forum/img/sticky.png" alt="Sticky" title="Sticky" />{% endif %} | ||
247 | 86 | {% if topic.closed %}<img src="{{ MEDIA_URL }}forum/img/closed.png" alt="Closed" title="Closed" />{% endif %} | ||
248 | 87 | <a href="{{ topic.get_absolute_url }}">{{ topic.name }}</a><br /> | ||
249 | 88 | <span class="small">Created by {{ topic.user|user_link }} on {{ topic.created|custom_date:user }}</span> | ||
250 | 89 | </td> | ||
251 | 90 | <td class="forumCount center small" style="width: 120px;"> | ||
252 | 91 | Posts: {{ topic.post_count }}<br/> | ||
253 | 92 | Views: {{ topic.views }} | ||
254 | 93 | </td> | ||
255 | 94 | <td class="lastPost"> | ||
256 | 64 | {{ topic.last_post.user|user_link }} <a href="{{ topic.last_post.get_absolute_url }}">»</a><br /> | 95 | {{ topic.last_post.user|user_link }} <a href="{{ topic.last_post.get_absolute_url }}">»</a><br /> |
257 | 65 | <span class="small">on {{ topic.last_post.created|custom_date:user }}</span> | 96 | <span class="small">on {{ topic.last_post.created|custom_date:user }}</span> |
258 | 66 | {% endif %} | ||
259 | 67 | </td> | 97 | </td> |
260 | 68 | </tr> | 98 | </tr> |
262 | 69 | {% endfor %} | 99 | {% endif %} {# topic.is_hidden #} |
263 | 100 | {% endfor %} {# topic #} | ||
264 | 70 | </tbody> | 101 | </tbody> |
265 | 71 | </table> | 102 | </table> |
266 | 72 | 103 | ||
267 | 73 | 104 | ||
268 | === modified file 'templates/pybb/inlines/display_category.html' | |||
269 | --- templates/pybb/inlines/display_category.html 2016-03-02 21:02:38 +0000 | |||
270 | +++ templates/pybb/inlines/display_category.html 2016-10-09 11:17:41 +0000 | |||
271 | @@ -29,13 +29,22 @@ | |||
272 | 29 | Topics: {{ forum.topics.count }}<br/> | 29 | Topics: {{ forum.topics.count }}<br/> |
273 | 30 | Posts: {{ forum.posts.count }} | 30 | Posts: {{ forum.posts.count }} |
274 | 31 | </td> | 31 | </td> |
282 | 32 | <td class="lastPost"> | 32 | {% if user.is_superuser %} {# Show all to superuser #} |
283 | 33 | {%if forum.last_post %} | 33 | {% if forum.last_post %} |
284 | 34 | <a href="{{forum.last_post.get_absolute_url}}">{{ forum.last_post.topic.name }}</a><br /> | 34 | <td class="lastPost"> |
285 | 35 | <span class="small">by {{ forum.last_post.user|user_link }}<br /> | 35 | <a href="{{forum.last_post.get_absolute_url}}">{{ forum.last_post.topic.name }}</a><br /> |
286 | 36 | on {{ forum.last_post.created|custom_date:user}}</span> | 36 | <span class="small">by {{ forum.last_post.user|user_link }}<br /> |
287 | 37 | {% else %} | 37 | on {{ forum.last_post.created|custom_date:user}}</span> |
288 | 38 | | 38 | </td> |
289 | 39 | {% endif %} | ||
290 | 40 | {% else %} {# no super_user: Show only nonhidden posts#} | ||
291 | 41 | {% if forum.last_nonhidden_post %} | ||
292 | 42 | <td class="lastPost"> | ||
293 | 43 | <a href="{{forum.last_nonhidden_post.get_absolute_url}}">{{ forum.last_nonhidden_post.topic.name }}</a><br /> | ||
294 | 44 | <span class="small">by {{ forum.last_nonhidden_post.user|user_link }}<br /> | ||
295 | 45 | on {{ forum.last_nonhidden_post.created|custom_date:user}}</span> | ||
296 | 46 | </td> | ||
297 | 47 | {% endif %} | ||
298 | 39 | {% endif %} | 48 | {% endif %} |
299 | 40 | </td> | 49 | </td> |
300 | 41 | </tr> | 50 | </tr> |
301 | 42 | 51 | ||
302 | === modified file 'templates/pybb/last_posts.html' | |||
303 | --- templates/pybb/last_posts.html 2016-03-02 21:02:38 +0000 | |||
304 | +++ templates/pybb/last_posts.html 2016-10-09 11:17:41 +0000 | |||
305 | @@ -9,11 +9,13 @@ | |||
306 | 9 | <div class="columnModuleBox"> | 9 | <div class="columnModuleBox"> |
307 | 10 | <ul> | 10 | <ul> |
308 | 11 | {% for post in posts %} | 11 | {% for post in posts %} |
314 | 12 | <li> | 12 | {% if not post.hidden %} |
315 | 13 | {{ post.topic.forum.name }}<br /> | 13 | <li> |
316 | 14 | <a href="{{ post.get_absolute_url }}" title="{{ post.topic.name }}">{{ post.topic.name|pybb_cut_string:30 }}</a><br /> | 14 | {{ post.topic.forum.name }}<br /> |
317 | 15 | by <a href="{% url 'profile_view' post.user %}">{{post.user.username}}</a> {{ post.created|minutes }} ago | 15 | <a href="{{ post.get_absolute_url }}" title="{{ post.topic.name }}">{{ post.topic.name|pybb_cut_string:30 }}</a><br /> |
318 | 16 | </li> | 16 | by <a href="{% url 'profile_view' post.user %}">{{post.user.username}}</a> {{ post.created|minutes }} ago |
319 | 17 | </li> | ||
320 | 18 | {% endif %} | ||
321 | 17 | {% endfor %} | 19 | {% endfor %} |
322 | 18 | </ul> | 20 | </ul> |
323 | 19 | </div> | 21 | </div> |
324 | 20 | 22 | ||
325 | === added file 'templates/pybb/pybb_moderate_info.html' | |||
326 | --- templates/pybb/pybb_moderate_info.html 1970-01-01 00:00:00 +0000 | |||
327 | +++ templates/pybb/pybb_moderate_info.html 2016-10-09 11:17:41 +0000 | |||
328 | @@ -0,0 +1,12 @@ | |||
329 | 1 | {% extends 'pybb/base.html' %} | ||
330 | 2 | |||
331 | 3 | {% block content %} | ||
332 | 4 | |||
333 | 5 | <h1>All comments have to be moderated</h1> | ||
334 | 6 | |||
335 | 7 | <div class="blogEntry"> | ||
336 | 8 | <p>Your comment has been saved but hidden to normal users. A moderator | ||
337 | 9 | will take a look at it and review it as soon as possible.</p> | ||
338 | 10 | </div> | ||
339 | 11 | |||
340 | 12 | {% endblock %} | ||
341 | 0 | 13 | ||
342 | === modified file 'templates/pybb/topic.html' | |||
343 | --- templates/pybb/topic.html 2016-07-31 08:44:48 +0000 | |||
344 | +++ templates/pybb/topic.html 2016-10-09 11:17:41 +0000 | |||
345 | @@ -157,6 +157,7 @@ | |||
346 | 157 | <table class="forum"> | 157 | <table class="forum"> |
347 | 158 | <tbody> | 158 | <tbody> |
348 | 159 | {% for post in posts %} | 159 | {% for post in posts %} |
349 | 160 | {% if not post.hidden or user.is_superuser %} | ||
350 | 160 | <tr class="{% cycle 'odd' 'even' %}"> | 161 | <tr class="{% cycle 'odd' 'even' %}"> |
351 | 161 | <td class="author"> | 162 | <td class="author"> |
352 | 162 | {{ post.user|user_link }}<br /> | 163 | {{ post.user|user_link }}<br /> |
353 | @@ -228,6 +229,7 @@ | |||
354 | 228 | {% endif %} | 229 | {% endif %} |
355 | 229 | </td> | 230 | </td> |
356 | 230 | </tr> | 231 | </tr> |
357 | 232 | {% endif %} | ||
358 | 231 | <tr class="spacer"> | 233 | <tr class="spacer"> |
359 | 232 | <td></td> | 234 | <td></td> |
360 | 233 | <td></td> | 235 | <td></td> |
Hm, the diff is truncated... maybe remove the akismet api?