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 %}
Blocks

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 + +
+
+ {% if blocked_users %} + + + + + + {% for user in blocked_users %} + + + + + {% endfor %} +
{{ _('Name') }}{{ _('Unblock') }}
{{ user.display_name() }} {{ _('Unblock') }}
+ {% else %} +

{{ _('No blocked people') }}

+ {% endif %} +
+
+ {% if blocked_communities %} + + + + + + {% for community in blocked_communities %} + + + + + {% endfor %} +
{{ _('Name') }}{{ _('Unblock') }}
{{ community.title }} {{ _('Unblock') }}
+ {% else %} +

{{ _('No blocked communities') }}

+ {% endif %} +
+
+ {% if blocked_domains %} + + + + + + {% for domain in blocked_domains %} + + + + + {% endfor %} +
{{ _('Name') }}{{ _('Unblock') }}
{{ domain.name }} {{ _('Unblock') }}
+ {% else %} +

{{ _('No blocked domains') }}

+ {% endif %} +
+
+ {% if blocked_instances %} + + + + + + {% for instance in blocked_instances %} + + + + + {% endfor %} +
{{ _('Name') }}{{ _('Unblock') }}
{{ instance.domain }} {{ _('Unblock') }}
+ {% else %} +

{{ _('No blocked instances') }}

+ {% endif %} +
+
{% endblock %} \ No newline at end of file diff --git a/app/templates/user/show_profile.html b/app/templates/user/show_profile.html index b39c2642..fc880048 100644 --- a/app/templates/user/show_profile.html +++ b/app/templates/user/show_profile.html @@ -49,11 +49,11 @@ {{ _('Send message using Matrix') }} {% endif %} {% if current_user.has_blocked_user(user.id) %} - {{ _('Unblock user') }} + {{ _('Unblock') }} {% else %} - {{ _('Block user') }} + {{ _('Block') }} {% endif %} - {{ _('Report user') }} + {{ _('Report') }} {% 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()) )