Fix get_sidebar_config

This commit is contained in:
OzzieIsaacs 2020-12-12 12:03:11 +01:00
parent 1905e0ee6f
commit fa95d064ff
2 changed files with 4 additions and 4 deletions

View file

@ -42,7 +42,7 @@ from . import constants, logger, helper, services
from . import db, calibre_db, ub, web_server, get_locale, config, updater_thread, babel, gdriveutils from . import db, calibre_db, ub, web_server, get_locale, config, updater_thread, babel, gdriveutils
from .helper import check_valid_domain, send_test_mail, reset_password, generate_password_hash from .helper import check_valid_domain, send_test_mail, reset_password, generate_password_hash
from .gdriveutils import is_gdrive_ready, gdrive_support from .gdriveutils import is_gdrive_ready, gdrive_support
from .render_template import render_title_template from .render_template import render_title_template, get_sidebar_config
from . import debug_info from . import debug_info
try: try:
@ -1050,7 +1050,7 @@ def _handle_edit_user(to_save, content,languages, translations, kobo_support):
content.role &= ~constants.ROLE_ANONYMOUS content.role &= ~constants.ROLE_ANONYMOUS
val = [int(k[5:]) for k in to_save if k.startswith('show_')] val = [int(k[5:]) for k in to_save if k.startswith('show_')]
sidebar = ub.get_sidebar_config() sidebar = get_sidebar_config()
for element in sidebar: for element in sidebar:
value = element['visibility'] value = element['visibility']
if value in val and not content.check_visibility(value): if value in val and not content.check_visibility(value):

View file

@ -25,7 +25,7 @@ from . import config, constants
from .ub import User from .ub import User
def _get_sidebar_config(kwargs=None): def get_sidebar_config(kwargs=None):
kwargs = kwargs or [] kwargs = kwargs or []
if 'content' in kwargs: if 'content' in kwargs:
content = kwargs['content'] content = kwargs['content']
@ -93,7 +93,7 @@ def _get_sidebar_config(kwargs=None):
# Returns the template for rendering and includes the instance name # Returns the template for rendering and includes the instance name
def render_title_template(*args, **kwargs): def render_title_template(*args, **kwargs):
sidebar = _get_sidebar_config(kwargs) sidebar = get_sidebar_config(kwargs)
return render_template(instance=config.config_calibre_web_title, sidebar=sidebar, return render_template(instance=config.config_calibre_web_title, sidebar=sidebar,
accept=constants.EXTENSIONS_UPLOAD, accept=constants.EXTENSIONS_UPLOAD,
*args, **kwargs) *args, **kwargs)