Merge branch 'bug/gravatar-logical' into 'dev'

Gravatar/Terminal Tweaks for v4.0.13

See merge request crafty-controller/crafty-4!465
This commit is contained in:
Iain Powrie 2022-09-20 01:01:24 +00:00
commit 476025a370
3 changed files with 9 additions and 6 deletions

View File

@ -157,7 +157,7 @@ class UsersController:
base_data = HelperUsers.get_user(user_id)
up_data = {}
# check if we updated user email. If so we update gravatar
if user_data["email"]:
if user_data["email"] != base_data["email"]:
pfp = self.helper.get_gravatar_image(user_data["email"])
up_data["pfp"] = pfp
# create sets to store role data

View File

@ -668,7 +668,7 @@ class Helpers:
rating = "g"
# Get grvatar hash for profile pictures
if not self.check_internet() or email != "default@example.com" or email != "":
if self.check_internet() and email != "default@example.com" and email:
gravatar = libgravatar.Gravatar(libgravatar.sanitize_email(email))
url = gravatar.get_image(
size=80,

View File

@ -196,8 +196,12 @@
function new_line_handler(data) {
$('#virt_console').append(data.line)
const elem = document.getElementById('virt_console');
if (!scrolled) {
scrollConsole()
try{
if (!scrolled) {
scrollConsole();
}
}catch{
scrollConsole();
}
}
@ -298,7 +302,6 @@
const chkScroll = (e) => {
const elem = $(e.currentTarget);
if (Math.round(elem[0].scrollHeight - elem.scrollTop()) <= elem.outerHeight()) {
document.getElementById("to-bottom").style.visibility = "hidden";
scrolled = false;
@ -316,7 +319,7 @@
}
$(document).ready(() => {
var scrolled;
var scrolled = false;
$('#virt_console').on('scroll', chkScroll);
$('#to-bottom').on('click', scrollToBottom)
});