mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-02-02 16:21:32 -08:00
Merge pull request 'show roles, admins, reputation in user profiles (fixes #364)' (#369) from h3ndrik/pyfedi:userprofile into main
Reviewed-on: https://codeberg.org/rimu/pyfedi/pulls/369
This commit is contained in:
commit
20698179dd
2 changed files with 17 additions and 1 deletions
|
@ -104,13 +104,16 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<p class="small">{{ _('Instance') }}: <a href="{{ url_for('instance.instance_overview', instance_domain=user.instance_domain()) }}">{{ user.instance_domain() }}</a><br />
|
||||
<p class="small">{{ _('Instance') }}: <a href="{{ url_for('instance.instance_overview', instance_domain=user.instance_domain()) }}">{{ user.instance_domain() }}</a>
|
||||
{% if user.is_instance_admin() or (user.is_local() and user.is_admin()) %}<span class="red">({{ _('Admin') }})</span>{% endif %}<br />
|
||||
{% if user.is_admin() or user.is_staff() %}{{ _('Role permissions') }}: {% if user.is_admin() %}{{ _('Admin') }}{% endif %} {% if user.is_staff() %}{{ _('Staff') }}{% endif %}<br />{% endif %}
|
||||
{{ _('Joined') }}: {{ arrow.get(user.created).humanize(locale=locale) }}<br />
|
||||
{% if current_user.is_authenticated and current_user.is_admin() and user.last_seen %}{{ _('Active') }}: {{ arrow.get(user.last_seen).humanize(locale=locale) }}<br />{% endif %}
|
||||
{% if user.bot %}
|
||||
{{ _('Bot Account') }}<br />
|
||||
{% endif %}
|
||||
{{ _('Attitude') }}: <span title="{{ _('Ratio of upvotes cast to downvotes cast. Higher is more positive.') }}">{{ (user.attitude * 100) | round | int }}%</span><br />
|
||||
{% if current_user.is_authenticated and current_user.is_admin() and user.reputation %}{{ _('Reputation') }}: <span title="{{ _('Reputation: The Karma of the account. Total up votes minus down votes they got.') }}">{{ user.reputation | round | int }}</span><br />{% endif %}
|
||||
{{ _('Posts') }}: {{ user.post_count }}<br />
|
||||
{{ _('Comments') }}: {{ user.post_reply_count }}<br />
|
||||
</p>
|
||||
|
|
|
@ -509,6 +509,10 @@ def ban_profile(actor):
|
|||
|
||||
add_to_modlog('ban_user', link_text=user.display_name(), link=user.link())
|
||||
|
||||
if user.is_instance_admin():
|
||||
flash('Banned user was a remote instance admin.', 'warning')
|
||||
if user.is_admin() or user.is_staff():
|
||||
flash('Banned user with role permissions.', 'warning')
|
||||
flash(f'{actor} has been banned.')
|
||||
else:
|
||||
abort(401)
|
||||
|
@ -700,6 +704,10 @@ def delete_profile(actor):
|
|||
|
||||
add_to_modlog('delete_user', link_text=user.display_name(), link=user.link())
|
||||
|
||||
if user.is_instance_admin():
|
||||
flash('Deleted user was a remote instance admin.', 'warning')
|
||||
if user.is_admin() or user.is_staff():
|
||||
flash('Deleted user with role permissions.', 'warning')
|
||||
flash(f'{actor} has been deleted.')
|
||||
else:
|
||||
abort(401)
|
||||
|
@ -816,6 +824,11 @@ def ban_purge_profile(actor):
|
|||
|
||||
# todo: empty relevant caches
|
||||
|
||||
if user.is_instance_admin():
|
||||
flash('Purged user was a remote instance admin.', 'warning')
|
||||
if user.is_admin() or user.is_staff():
|
||||
flash('Purged user with role permissions.', 'warning')
|
||||
|
||||
# federate deletion
|
||||
if user.is_local():
|
||||
user.deleted_by = current_user.id
|
||||
|
|
Loading…
Add table
Reference in a new issue