diff --git a/app/templates/user/filters.html b/app/templates/user/filters.html index b7e34f85..18a9a589 100644 --- a/app/templates/user/filters.html +++ b/app/templates/user/filters.html @@ -50,10 +50,92 @@ {% endif %}
Manage what users, communities, domains or instances you want to block. Blocking them means you will no longer see any posts associated with them.
- Manage User Blocks - Manage Communities Blocks - Manage Domain Blocks - Manage Instance Blocks + +{{ _('Name') }} | +{{ _('Unblock') }} | +
---|---|
{{ user.display_name() }} | +{{ _('Unblock') }} | +
{{ _('No blocked people') }}
+ {% endif %} +{{ _('Name') }} | +{{ _('Unblock') }} | +
---|---|
{{ community.title }} | +{{ _('Unblock') }} | +
{{ _('No blocked communities') }}
+ {% endif %} +{{ _('Name') }} | +{{ _('Unblock') }} | +
---|---|
{{ domain.name }} | +{{ _('Unblock') }} | +
{{ _('No blocked domains') }}
+ {% endif %} +{{ _('Name') }} | +{{ _('Unblock') }} | +
---|---|
{{ instance.domain }} | +{{ _('Unblock') }} | +
{{ _('No blocked instances') }}
+ {% endif %} +{{ _('Joined') }}: {{ moment(user.created).fromNow(refresh=True) }}
diff --git a/app/user/routes.py b/app/user/routes.py
index 04c9af0b..78d0e774 100644
--- a/app/user/routes.py
+++ b/app/user/routes.py
@@ -11,7 +11,8 @@ from app.activitypub.util import default_context, find_actor_or_create
from app.community.util import save_icon_file, save_banner_file, retrieve_mods_and_backfill
from app.constants import SUBSCRIPTION_MEMBER, SUBSCRIPTION_PENDING
from app.models import Post, Community, CommunityMember, User, PostReply, PostVote, Notification, utcnow, File, Site, \
- Instance, Report, UserBlock, CommunityBan, CommunityJoinRequest, CommunityBlock, Filter
+ Instance, Report, UserBlock, CommunityBan, CommunityJoinRequest, CommunityBlock, Filter, Domain, DomainBlock, \
+ InstanceBlock
from app.user import bp
from app.user.forms import ProfileForm, SettingsForm, DeleteAccountForm, ReportUserForm, FilterEditForm
from app.user.utils import purge_user_then_delete
@@ -614,7 +615,17 @@ def import_settings_task(user_id, filename):
@login_required
def user_settings_filters():
filters = Filter.query.filter_by(user_id=current_user.id).order_by(Filter.title).all()
+ blocked_users = User.query.join(UserBlock, UserBlock.blocked_id == User.id).\
+ filter(UserBlock.blocker_id == current_user.id).order_by(User.user_name).all()
+ blocked_communities = Community.query.join(CommunityBlock, CommunityBlock.community_id == Community.id).\
+ filter(CommunityBlock.user_id == current_user.id).order_by(Community.title).all()
+ blocked_domains = Domain.query.join(DomainBlock, DomainBlock.domain_id == Domain.id).\
+ filter(DomainBlock.user_id == current_user.id).order_by(Domain.name).all()
+ blocked_instances = Instance.query.join(InstanceBlock, InstanceBlock.instance_id == Instance.id).\
+ filter(InstanceBlock.user_id == current_user.id).order_by(Instance.domain).all()
return render_template('user/filters.html', filters=filters, user=current_user,
+ blocked_users=blocked_users, blocked_communities=blocked_communities,
+ blocked_domains=blocked_domains, blocked_instances=blocked_instances,
moderating_communities=moderating_communities(current_user.get_id()),
joined_communities=joined_communities(current_user.get_id())
)