diff --git a/brutaldon/forms.py b/brutaldon/forms.py index e02f7bb..873c9f2 100644 --- a/brutaldon/forms.py +++ b/brutaldon/forms.py @@ -25,6 +25,16 @@ class SettingsForm(forms.Form): help_text= """FULLBRUTALISM mode strips away most of the niceties of modern web design when brutaldon is viewed in a graphical browser. It has no effect in text-only browsers.""") + filter_replies = forms.BooleanField(label="Filter replies from home timeline?", + required=False, + help_text= + """Should replies be filtered out of your home timeline, giving you only pure, + top-level posts?""") + filter_boosts = forms.BooleanField(label="Filter boosts from home timeline?", + required=False, + help_text= + """Should replies be filtered out of your home timeline, giving you only pure, + Original Content?""") class PostForm(forms.Form): diff --git a/brutaldon/templates/setup/settings.html b/brutaldon/templates/setup/settings.html index 7f182f7..336caf5 100644 --- a/brutaldon/templates/setup/settings.html +++ b/brutaldon/templates/setup/settings.html @@ -11,6 +11,18 @@ {{ form.fullbrutalism.label }} +
+ +
+
+ +
diff --git a/brutaldon/views.py b/brutaldon/views.py index 552f28c..4c4930c 100644 --- a/brutaldon/views.py +++ b/brutaldon/views.py @@ -87,6 +87,12 @@ def timeline(request, timeline='home', timeline_name='Home', max_id=None, since_ next = data[-1]._pagination_next except (IndexError, AttributeError): next = None + + # This filtering has to be done *after* getting next/prev links + if request.session.get('filter_replies', False): + data = [x for x in data if not x.in_reply_to_id] + if request.session.get('filter_boosts', False): + data = [x for x in data if not x.reblog] return render(request, 'main/%s_timeline.html' % timeline, {'toots': data, 'form': form, 'timeline': timeline, 'timeline_name': timeline_name, @@ -313,6 +319,8 @@ def settings(request): form = SettingsForm(request.POST) if form.is_valid(): request.session['fullbrutalism'] = form.cleaned_data['fullbrutalism'] + request.session['filter_replies'] = form.cleaned_data['filter_replies'] + request.session['filter_boosts'] = form.cleaned_data['filter_boosts'] return redirect(home) else: return render(request, 'setup/settings.html',