From de89da97f4c2fb73426697a16cf8027490e91bae Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 29 Aug 2022 01:12:46 +0200 Subject: [PATCH] Make find_release_notes() more testable. --- src/lib/release_notes.cc | 14 ++++++++------ src/lib/release_notes.h | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/lib/release_notes.cc b/src/lib/release_notes.cc index b1eb95257..face4df2c 100644 --- a/src/lib/release_notes.cc +++ b/src/lib/release_notes.cc @@ -31,19 +31,21 @@ using boost::optional; optional -find_release_notes() +find_release_notes(optional current) { auto last = Config::instance()->last_release_notes_version(); - auto current = string(dcpomatic_version); - if (last && *last == current) { + if (!current) { + current = string(dcpomatic_version); + } + if (last && *last == *current) { return {}; } - Config::instance()->set_last_release_notes_version(current); + Config::instance()->set_last_release_notes_version(*current); - const string header = String::compose("

DCP-o-matic %1 release notes

", current); + const string header = String::compose("

DCP-o-matic %1 release notes

", *current); - if (current == "2.16.18") { + if (*current == "2.16.18") { return header + _("In this version there are changes to the way that subtitles are positioned. " "Positioning should now be more correct, with respect to the standards, but you " diff --git a/src/lib/release_notes.h b/src/lib/release_notes.h index 36f66d257..a5026b432 100644 --- a/src/lib/release_notes.h +++ b/src/lib/release_notes.h @@ -23,4 +23,4 @@ #include -extern boost::optional find_release_notes(); +extern boost::optional find_release_notes(boost::optional current = boost::optional()); -- 2.30.2