This commit is contained in:
Aevann1 2021-09-10 06:32:01 +02:00
parent 9d46066c09
commit d28d2cc318
11 changed files with 25 additions and 14 deletions

View file

@ -311,7 +311,7 @@ function post(url, callback, errortext) {
xhr.send(form); xhr.send(form);
}; };
function post_toast(url, callback, data) { function post_toast(url, reload, data) {
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open("POST", url, true); xhr.open("POST", url, true);
var form = new FormData() var form = new FormData()
@ -335,8 +335,8 @@ function post_toast(url, callback, data) {
} catch(e) { } catch(e) {
document.getElementById('toast-post-success-text').innerText = "Action successful!"; document.getElementById('toast-post-success-text').innerText = "Action successful!";
} }
try {callback(xhr)}
catch(e) {} if (reload == 1) {window.location.reload(true)}
return true return true
} else if (xhr.status >= 300 && xhr.status < 400) { } else if (xhr.status >= 300 && xhr.status < 400) {

View file

@ -843,3 +843,13 @@ def settings_title_change(v):
g.db.add(v) g.db.add(v)
return redirect("/settings/profile") return redirect("/settings/profile")
@app.post("/settings/badges")
@auth_required
@validate_formkey
def settings_badge_recheck(v):
v.refresh_selfset_badges()
return {"message":"Badges Refreshed"}

View file

@ -1251,7 +1251,7 @@
{% include "expanded_image_modal.html" %} {% include "expanded_image_modal.html" %}
<script src="/assets/js/general15.js"></script> <script src="/assets/js/general16.js"></script>
<!-- ClipboardJS --> <!-- ClipboardJS -->

View file

@ -144,6 +144,6 @@ We also have some custom hooks for mentioning users and subreddits. Note that th
{% include "expanded_image_modal.html" %} {% include "expanded_image_modal.html" %}
<script src="/assets/js/general15.js"></script> <script src="/assets/js/general16.js"></script>
{% endblock %} {% endblock %}

View file

@ -130,7 +130,7 @@
{% include "bootstrap.html" %} {% include "bootstrap.html" %}
<script src="/assets/js/general15.js"></script> <script src="/assets/js/general16.js"></script>
</body> </body>

View file

@ -254,7 +254,7 @@
</div> </div>
</div> </div>
<script src="/assets/js/general15.js"></script> <script src="/assets/js/general16.js"></script>
{% block onload %}{% endblock %} {% block onload %}{% endblock %}

View file

@ -226,7 +226,7 @@
}); });
</script> </script>
<script src="/assets/js/general15.js"></script> <script src="/assets/js/general16.js"></script>
{% block scripts %} {% block scripts %}
{% endblock %} {% endblock %}

View file

@ -233,7 +233,7 @@
<!-- {{'SITE_NAME' | app_config}} JS --> <!-- {{'SITE_NAME' | app_config}} JS -->
<script src="/assets/js/general15.js"></script> <script src="/assets/js/general16.js"></script>
</body> </body>

View file

@ -144,7 +144,7 @@
<!-- {{'SITE_NAME' | app_config}} JS --> <!-- {{'SITE_NAME' | app_config}} JS -->
<script src="/assets/js/general15.js"></script> <script src="/assets/js/general16.js"></script>
</body> </body>

View file

@ -482,7 +482,7 @@
<!-- {{'SITE_NAME' | app_config}} JS --> <!-- {{'SITE_NAME' | app_config}} JS -->
<script src="/assets/js/general15.js"></script> <script src="/assets/js/general16.js"></script>
<!-- ClipboardJS --> <!-- ClipboardJS -->

View file

@ -244,6 +244,7 @@
{% elif v and v.id == u.id %} {% elif v and v.id == u.id %}
<a href="/settings/profile" class="btn btn-secondary">Edit profile</a> <a href="/settings/profile" class="btn btn-secondary">Edit profile</a>
<a href="/views" class="btn btn-secondary">Profile views</a> <a href="/views" class="btn btn-secondary">Profile views</a>
<a href="javascript:void(0)" onclick="post_toast('/settings/badges','1')" class="btn btn-secondary">Refresh Badges</a>
{% endif %} {% endif %}
{% if v and v.id != u.id and v.admin_level > 1 %} {% if v and v.id != u.id and v.admin_level > 1 %}
<br><br> <br><br>
@ -445,7 +446,7 @@
</div> </div>
{% if v and v.id == u.id %} {% if v and v.id == u.id %}
<a href="/settings/profile" class="btn btn-secondary btn-sm">Edit profile</a> <a href="/settings/profile" class="btn btn-secondary btn-sm">Edit profile</a>
<a href="/views" class="btn btn-secondary btn-sm">Profile views</a> <a href="javascript:void(0)" onclick="post_toast('/settings/badges','1')" class="btn btn-secondary">Refresh Badges</a>
{% endif %} {% endif %}
{% if v and v.id != u.id %} {% if v and v.id != u.id %}
<a id="button-unsub2" class="btn btn-secondary {% if not is_following %}d-none{% endif %}" href="javascript:void(0)" onclick="post_toast('/unfollow/{{u.username}}', callback=function(){document.getElementById('button-unsub2').classList.toggle('d-none');document.getElementById('button-sub2').classList.toggle('d-none');})">Unfollow</a> <a id="button-unsub2" class="btn btn-secondary {% if not is_following %}d-none{% endif %}" href="javascript:void(0)" onclick="post_toast('/unfollow/{{u.username}}', callback=function(){document.getElementById('button-unsub2').classList.toggle('d-none');document.getElementById('button-sub2').classList.toggle('d-none');})">Unfollow</a>