Skip to content

Commit

Permalink
Show invitation hint when user is alone on their instance
Browse files Browse the repository at this point in the history
  • Loading branch information
mwild1 committed Apr 16, 2024
1 parent 33d28e5 commit 220bf99
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
9 changes: 7 additions & 2 deletions snikket_web/templates/user_home.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@
{% include "copy-snippet.html" %}
{% endblock %}
{% block content %}
<h1>{% trans %}Welcome!{% endtrans %}</h1>
<p>{% trans user_name=user_info.display_name %}Welcome home, {{ user_name }}.{% endtrans %}</p>
{% if user_info.is_admin and metrics.users.active_1d <= 1 %}
<aside class="box hint">
<header>Welcome to Snikket!</header>
<p>Now your Snikket instance is up and running, the next step is to invite people to join it. Family, friends, colleagues... you choose!</p>
<a href="/admin/invitations">{% trans %}Create new invitation{% endtrans %}</a>
</aside>
{% endif %}
<nav class="welcome">
<ul>
<li class="wide">
Expand Down
7 changes: 6 additions & 1 deletion snikket_web/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ class ImportAccountDataForm(BaseForm):
@client.require_session()
async def index() -> str:
user_info = await client.get_user_info()
return await render_template("user_home.html", user_info=user_info)
metrics = await client.get_system_metrics()
return await render_template(
"user_home.html",
user_info=user_info,
metrics=metrics,
)


@bp.route('/passwd', methods=["GET", "POST"])
Expand Down

0 comments on commit 220bf99

Please sign in to comment.