1
0
Fork 0
mirror of https://github.com/Lynnesbian/FediBooks/ synced 2024-12-27 14:58:59 +00:00

users can now toggle accounts the bot learns from

This commit is contained in:
Lynne Megido 2019-09-02 20:44:03 +10:00
parent bca0da6c45
commit ec758d9d8f
2 changed files with 11 additions and 2 deletions

View file

@ -26,7 +26,7 @@
<div class="panel-status">{{ "Active" if user['enabled'] else "Inactive" }}</div>
</div>
<div class="panel-actions">
<a class="button btn-secondary" href="/bot/accounts/toggle/insert id here" title="Turn on/off"><i class="fas fa-power-off"></i></a><a class="button btn-dangerous" href="/bot/accounts/delete/insert id here" title="Delete"><i class="fas fa-trash"></i></a>
<a class="button btn-secondary" href="/bot/accounts/toggle/{{ user['fedi_id'] }}" title="Turn on/off"><i class="fas fa-power-off"></i></a><a class="button btn-dangerous" href="/bot/accounts/delete/{{ user['fedi_id'] }}" title="Delete"><i class="fas fa-trash"></i></a>
</div>
</div>
{% endfor %}

View file

@ -172,10 +172,19 @@ def bot_accounts_add():
c.close()
mysql.connection.commit()
return redirect("/bot/accounts/{}".format(session['bot']))
return redirect("/bot/accounts/{}".format(session['bot']), 303)
return render_template("bot_accounts_add.html")
@app.route("/bot/accounts/toggle/<id>")
def bot_accounts_toggle(id):
c = mysql.connection.cursor()
c.execute("UPDATE `bot_learned_accounts` SET `enabled` = NOT `enabled` WHERE `fedi_id` = %s AND `bot_id` = %s", (id, session['bot']))
mysql.connection.commit()
c.close()
return redirect("/bot/accounts/{}".format(session['bot']), 303)
@app.route("/bot/create/", methods=['GET', 'POST'])
def bot_create():
#TODO: error handling