Skip to content
Snippets Groups Projects
Commit 0e5ca019 authored by kaiyou's avatar kaiyou
Browse files

Improve matrix actions for browsing users

parent d69eb4e7
No related branches found
No related tags found
No related merge requests found
......@@ -81,8 +81,8 @@ class SynapseApplication(base.SAMLApplication):
class RoomForm(flask_wtf.FlaskForm):
roomid = fields.StringField(_("RoomID"))
submit = fields.SubmitField(_("Display"))
form = RoomForm()
roomid = flask.request.values.get("roomid")
form = RoomForm(data=dict(roomid=roomid))
if roomid:
client = self.get_axon(service)
room = client.get_room(roomid)
......@@ -102,6 +102,18 @@ class SynapseApplication(base.SAMLApplication):
members=members, service=service
)
@base.action("Get user details", profile=True)
def get_user_details(self, profile):
""" Display some user details
"""
client = self.get_axon(profile.service)
mxid = "@" + profile.username + ":" + profile.service.config.get("domain")
user = client.get_user(mxid)
user.update(client.get_user_rooms(mxid))
return flask.render_template(
"application_synapse/user.html", user=user, profile=profile
)
@register("writefreely")
class WriteFreelyApplication(base.OIDCApplication):
......
{% import "macros.html" as macros %}
{{ macros.form(form) }}
{% if room.get("room_id") %}
{% if room and room.get("room_id") %}
<div class="row">
<div class="col-md-6">
<div class="table-responsive no-padding">
......@@ -11,7 +11,7 @@
{% for member, profile in members.items() %}
<tr>
{% if profile %}
<td><a href="{{ url_for("profile.details", profile_uuid=profile.uuid) }}">{{ member }}</a></td>
<td><a href="{{ url_for("profile.action", service_uuid=service.uuid, profile_uuid=profile.uuid, action="get_user_details") }}">{{ member }}</a></td>
{% else %}
<td>{{ member }}</td>
{% endif %}
......
{% if user %}
<div class="row">
<div class="col-md-6">
<div class="table-responsive no-padding">
<table class="table table-hover">
<tr>
<th>{% trans %}Room{% endtrans %}</th>
</tr>
{% for room in user["joined_rooms"] %}
<tr>
<td><a href="{{ url_for("service.action", service_uuid=profile.service.uuid, action="get_room", roomid=room) }}">{{ room }}</a></td>
</tr>
{% endfor %}
</table>
</div>
</div>
<div class="col-md-6">
<dl>
{% for name, value in user.items() %}
<dt>{{ name }}</dt>
<dd>{{ value }}</dd>
{% endfor %}
</dl>
</div>
</div>
</div>
</div>
{% endif %}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment