diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-08-29 01:12:46 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-08-29 01:12:46 +0200 |
| commit | de89da97f4c2fb73426697a16cf8027490e91bae (patch) | |
| tree | c19bb8e9291757ea819e9d67a619e9919e6ae67a | |
| parent | a64f55f3a55ae8db95022ff8b5574c1eb4f2dc9f (diff) | |
Make find_release_notes() more testable.
| -rw-r--r-- | src/lib/release_notes.cc | 14 | ||||
| -rw-r--r-- | 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<string> -find_release_notes() +find_release_notes(optional<string> 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("<h1>DCP-o-matic %1 release notes</h1>", current); + const string header = String::compose("<h1>DCP-o-matic %1 release notes</h1>", *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 <string> -extern boost::optional<std::string> find_release_notes(); +extern boost::optional<std::string> find_release_notes(boost::optional<std::string> current = boost::optional<std::string>()); |
