handle user names with mixed upper and lower case letters. fixes #272

This commit is contained in:
rimu 2024-08-03 21:31:10 +12:00
parent 462a80967c
commit 6a820442f5
7 changed files with 16 additions and 16 deletions

View file

@ -136,7 +136,7 @@ def register():
application = UserRegistration(user_id=user.id, answer=form.question.data) application = UserRegistration(user_id=user.id, answer=form.question.data)
db.session.add(application) db.session.add(application)
for admin in Site.admins(): for admin in Site.admins():
notify = Notification(title='New registration', url='/admin/approve_registrations', user_id=admin.id, notify = Notification(title='New registration', url=f'/admin/approve_registrations?account={user.id}', user_id=admin.id,
author_id=user.id) author_id=user.id)
admin.unread_notifications += 1 admin.unread_notifications += 1
db.session.add(notify) db.session.add(notify)

View file

@ -19,16 +19,16 @@
</form> </form>
<table class="table table-striped mt-1"> <table class="table table-striped mt-1">
<tr> <tr>
<th title="{{ _('Display name.') }}">Name</th> <th title="{{ _('Display name.') }}">{{ _('Name') }}</th>
<th>Local/Remote</th> <th>{{ _('Local/Remote') }}</th>
<th title="{{ _('Last seen.') }}">Seen</th> <th title="{{ _('Last seen.') }}">{{ _('Seen') }}</th>
<th title="{{ _('Attitude: Percentage of up votes vs. down votes the account made.') }}">Attitude</th> <th title="{{ _('Attitude: Percentage of up votes vs. down votes the account made.') }}">{{ _('Attitude') }}</th>
<th title="{{ _('Reputation: The Karma of the account. Total up votes minus down votes they got.') }}">Rep</th> <th title="{{ _('Reputation: The Karma of the account. Total up votes minus down votes they got.') }}">{{ _('Reputation') }}</th>
<th>Banned</th> <th>{{ _('Banned') }}</th>
<th title="{{ _('How often a user has been reported.') }}">Reports</th> <th title="{{ _('How often a user has been reported.') }}">{{ _('Reports') }}</th>
<th title="{{ _('IP address of last interaction.') }}">IP</th> <th title="{{ _('IP address of last interaction.') }}">{{ _('IP and country code') }}</th>
<th title="{{ _('Which website linked to PieFed when the user initially registered.') }}">Source</th> <th title="{{ _('Which website linked to PieFed when the user initially registered.') }}">{{ _('Source') }}</th>
<th>Actions</th> <th>{{ _('Actions') }}</th>
</tr> </tr>
{% for user in users.items %} {% for user in users.items %}
<tr> <tr>

View file

@ -204,7 +204,7 @@
</ul> </ul>
</li> </li>
<li class="nav-item dropdown{% if active_parent == 'account' %} active{% endif %}"> <li class="nav-item dropdown{% if active_parent == 'account' %} active{% endif %}">
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="/u/{{ current_user.user_name.lower() }}" aria-haspopup="true" aria-expanded="false">{{ _('Account') }}</a> <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="/u/{{ current_user.link() }}" aria-haspopup="true" aria-expanded="false">{{ _('Account') }}</a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a class="dropdown-item{% if active_child == 'view_profile' %} active{% endif %}" href="/u/{{ current_user.link() }}">{{ _('View profile') }}</a></li> <li><a class="dropdown-item{% if active_child == 'view_profile' %} active{% endif %}" href="/u/{{ current_user.link() }}">{{ _('View profile') }}</a></li>
<li><a class="dropdown-item{% if active_child == 'edit_profile' %} active{% endif %}" href="/user/settings">{{ _('Edit profile & settings') }}</a></li> <li><a class="dropdown-item{% if active_child == 'edit_profile' %} active{% endif %}" href="/user/settings">{{ _('Edit profile & settings') }}</a></li>

View file

@ -4,7 +4,7 @@
<a href="/user/settings" class="btn {{ 'btn-primary' if request.path == '/user/settings' else 'btn-outline-secondary' }}"> <a href="/user/settings" class="btn {{ 'btn-primary' if request.path == '/user/settings' else 'btn-outline-secondary' }}">
{{ _('Settings') }} {{ _('Settings') }}
</a> </a>
<a href="/u/{{ current_user.user_name.lower() }}/profile" class="btn {{ 'btn-primary' if request.path.endswith('/profile') else 'btn-outline-secondary' }}"> <a href="/u/{{ current_user.link() }}/profile" class="btn {{ 'btn-primary' if request.path.endswith('/profile') else 'btn-outline-secondary' }}">
{{ _('Profile') }} {{ _('Profile') }}
</a> </a>
<a href="/user/settings/filters" class="btn {{ 'btn-primary' if request.path == '/user/settings/filters' else 'btn-outline-secondary' }}"> <a href="/user/settings/filters" class="btn {{ 'btn-primary' if request.path == '/user/settings/filters' else 'btn-outline-secondary' }}">

View file

@ -87,7 +87,7 @@
</tr> </tr>
{% for user in blocked_users %} {% for user in blocked_users %}
<tr> <tr>
<td><a href="{{ url_for('activitypub.user_profile', actor=user.ap_id if user.ap_id is not none else user.user_name.lower()) }}">{{ user.display_name() }}</a></td> <td><a href="{{ url_for('activitypub.user_profile', actor=user.ap_id if user.ap_id is not none else user.user_name) }}">{{ user.display_name() }}</a></td>
<td><a class="no-underline confirm_first" href="{{ url_for('user.unblock_profile', actor=user.link()) }}" rel="nofollow"><span class="fe fe-delete"></span> {{ _('Unblock') }}</a></td> <td><a class="no-underline confirm_first" href="{{ url_for('user.unblock_profile', actor=user.link()) }}" rel="nofollow"><span class="fe fe-delete"></span> {{ _('Unblock') }}</a></td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -51,7 +51,7 @@
<div class="card-body"> <div class="card-body">
<div class="row"> <div class="row">
<div class="col-6"> <div class="col-6">
<a class="w-100 btn btn-primary" href="/u/{{ current_user.user_name.lower() }}/profile">{{ _('Profile') }}</a> <a class="w-100 btn btn-primary" href="/u/{{ current_user.link() }}/profile">{{ _('Profile') }}</a>
</div> </div>
<div class="col-6"> <div class="col-6">
<a class="w-100 btn btn-primary" href="/user/settings">{{ _('Settings') }}</a> <a class="w-100 btn btn-primary" href="/user/settings">{{ _('Settings') }}</a>

View file

@ -154,7 +154,7 @@
<div class="card-body"> <div class="card-body">
<div class="row"> <div class="row">
<div class="col-6"> <div class="col-6">
<a class="w-100 btn btn-primary" href="/u/{{ user.user_name.lower() }}/profile">{{ _('Profile') }}</a> <a class="w-100 btn btn-primary" href="/u/{{ user.link() }}/profile">{{ _('Profile') }}</a>
</div> </div>
<div class="col-6"> <div class="col-6">
<a class="w-100 btn btn-primary" href="/user/settings">{{ _('Settings') }}</a> <a class="w-100 btn btn-primary" href="/user/settings">{{ _('Settings') }}</a>