diff options
Diffstat (limited to 'ishtar_common/context_processors.py')
-rw-r--r-- | ishtar_common/context_processors.py | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/ishtar_common/context_processors.py b/ishtar_common/context_processors.py index 8131e0382..d1e088a8f 100644 --- a/ishtar_common/context_processors.py +++ b/ishtar_common/context_processors.py @@ -43,9 +43,15 @@ def _get_changelog_version_from_file(): ) if not os.path.exists(changelog_dir): return "no-version" - changelog_file = os.path.join(changelog_dir, f"changelog_1.md") - if not os.path.exists(changelog_file): + filename = "" + for fle in reversed(sorted(os.listdir(changelog_dir))): + if not fle.startswith("changelog_") or not fle.endswith(".md"): + continue + filename = fle + break + if not filename: return "no-version" + changelog_file = os.path.join(changelog_dir, filename) current_version = None with open(changelog_file, "r") as changelog: for line in changelog.readlines(): @@ -125,10 +131,11 @@ def get_base_context(request): if password_expired and not request.path.endswith("password_change/"): msg = str(_("Your password has expired. Please update it using this " "<form>.")) + form_str = _("form") msg = msg.replace( "<form>", f'<a href="{reverse("password_change")}">' - f'{_("form")} ' + f'{form_str} ' f'<i class="fa fa-external-link" aria-hidden="true"></i>' '</a>' ) @@ -140,15 +147,16 @@ def get_base_context(request): current_version = get_changelog_version() if current_version != user_version and "changelog" not in dct["CURRENT_PATH"]: if user_version: - msg = str(_("Ishtar have been updated from version <old-version> to <new-version>. " - "Check the <changelog>.")) + msg = str(_("Since your last login, Ishtar has been updated from version <old-version> to " + "<new-version>. Check the <changelog>.")) else: - msg = str(_("Ishtar have been updated to version <new-version>. Check the " - "<changelog>.")) + msg = str(_("Since your last login, Ishtar has been updated to version <new-version>. " + "Check the <changelog>.")) + changelog_str = _("changelog") msg = msg.replace( "<changelog>", f'<a href="{reverse("changelog")}">' - f'{_("changelog")} ' + f'{changelog_str} ' f'<i class="fa fa-external-link" aria-hidden="true"></i>' f'</a>' ).replace("<old-version>", user_version).replace("<new-version>", current_version) |