Make sure to show intro to user only once

This commit is contained in:
Son NK 2020-04-13 13:23:17 +02:00
parent dee6d4959d
commit 3d10fab3a6
2 changed files with 12 additions and 5 deletions

View File

@ -346,15 +346,12 @@
<script>
var clipboard = new ClipboardJS('.clipboard');
var introShown = store.get("introShown");
if ("yes" !== introShown) {
{% if show_intro %}
// only show intro when screen is big enough to show "developer" tab
if (window.innerWidth >= 1024) {
introJs().start();
store.set("introShown", "yes")
}
}
{% endif %}
$(".delete-email").on("click", function (e) {
let alias = $(this).parent().find(".alias").val();

View File

@ -175,6 +175,15 @@ def index():
mailboxes = current_user.mailboxes()
show_intro = False
if not current_user.intro_shown:
LOG.d("Show intro to %s", current_user)
show_intro = True
# to make sure not showing intro to user again
current_user.intro_shown = True
db.session.commit()
return render_template(
"dashboard/index.html",
client_users=client_users,
@ -183,6 +192,7 @@ def index():
query=query,
AliasGeneratorEnum=AliasGeneratorEnum,
mailboxes=mailboxes,
show_intro=show_intro,
)