mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
link user profiles to their instances
This commit is contained in:
parent
815d13b1f7
commit
c8922cc67f
4 changed files with 18 additions and 12 deletions
|
@ -847,6 +847,14 @@ class User(UserMixin, db.Model):
|
|||
else:
|
||||
return self.public_url() + '/followers'
|
||||
|
||||
def instance_domain(self):
|
||||
if self.ap_domain:
|
||||
return self.ap_domain
|
||||
if self.is_local():
|
||||
return current_app.config['SERVER_NAME']
|
||||
else:
|
||||
return self.instance.domain
|
||||
|
||||
def get_reset_password_token(self, expires_in=600):
|
||||
return jwt.encode(
|
||||
{'reset_password': self.id, 'exp': time() + expires_in},
|
||||
|
|
|
@ -20,13 +20,17 @@
|
|||
{% if people %}
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>About</th>
|
||||
<th>{{ _('Name') }}</th>
|
||||
<th>{{ _('About') }}</th>
|
||||
<th>{{ _('Posts') }}</th>
|
||||
<th>{{ _('Comments') }}</th>
|
||||
</tr>
|
||||
{% for person in people %}
|
||||
<tr>
|
||||
<td>{{ render_username(person) }}</td>
|
||||
<td valign="top">{{ render_username(person) }}</td>
|
||||
<td>{{ person.about_html | safe if person.about_html }}</td>
|
||||
<td valign="top">{{ person.post_count }}</td>
|
||||
<td valign="top">{{ person.post_reply_count }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
|
|
@ -89,7 +89,8 @@
|
|||
{% endif %}
|
||||
|
||||
</div>
|
||||
<p class="small">{{ _('Joined') }}: {{ arrow.get(user.created).humanize(locale=locale) }}<br />
|
||||
<p class="small">{{ _('Instance') }}: <a href="{{ url_for('instance.instance_overview', instance_domain=user.instance_domain()) }}">{{ user.instance_domain() }}</a><br />
|
||||
{{ _('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 />
|
||||
|
|
|
@ -34,14 +34,7 @@ import json as python_json
|
|||
@bp.route('/people', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def show_people():
|
||||
if current_user.is_admin():
|
||||
people = User.query.filter_by(ap_id=None, deleted=False, banned=False).all()
|
||||
else:
|
||||
people = User.query.filter_by(ap_id=None, deleted=False, banned=False, searchable=True).all()
|
||||
return render_template('user/people.html', people=people, moderating_communities=moderating_communities(current_user.get_id()),
|
||||
joined_communities=joined_communities(current_user.get_id()),
|
||||
menu_topics=menu_topics(), site=g.site,
|
||||
title=_('People'))
|
||||
return redirect(url_for('instance.instance_people', instance_domain=current_app.config['SERVER_NAME']))
|
||||
|
||||
|
||||
@bp.route('/user/<int:user_id>', methods=['GET'])
|
||||
|
|
Loading…
Add table
Reference in a new issue