mirror of
https://github.com/transmission/transmission.git
synced 2026-02-14 23:19:34 +00:00
fix: torrent dates were not bumped in some cases (#8029)
* refactor: new `tr_torrent::bump_date_edited()` * fix: `mark_edited()` should also bump `date_changed_` * fix: torrent should be marked edited when setting labels * fix: torrent should be marked change when setting file priority
This commit is contained in:
@@ -1865,7 +1865,8 @@ void tr_torrent::set_labels(labels_t const& new_labels)
|
||||
}
|
||||
}
|
||||
labels_.shrink_to_fit();
|
||||
this->set_dirty();
|
||||
set_dirty();
|
||||
mark_edited();
|
||||
}
|
||||
|
||||
// ---
|
||||
@@ -1960,6 +1961,7 @@ void tr_torrent::set_file_priorities(tr_file_index_t const* files, tr_file_index
|
||||
file_priorities_.set(files, file_count, priority);
|
||||
priority_changed_.emit(this, files, file_count, priority);
|
||||
set_dirty();
|
||||
mark_changed();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2254,7 +2256,6 @@ size_t tr_torrentFindFileToBuf(tr_torrent const* tor, tr_file_index_t file_num,
|
||||
void tr_torrent::set_download_dir(std::string_view path, bool is_new_torrent)
|
||||
{
|
||||
download_dir_ = path;
|
||||
mark_changed();
|
||||
mark_edited();
|
||||
set_dirty();
|
||||
refresh_current_dir();
|
||||
@@ -2535,7 +2536,9 @@ bool tr_torrentHasMetadata(tr_torrent const* tor)
|
||||
|
||||
void tr_torrent::mark_edited()
|
||||
{
|
||||
this->date_edited_ = tr_time();
|
||||
auto const now = tr_time();
|
||||
bump_date_edited(now);
|
||||
bump_date_changed(now);
|
||||
}
|
||||
|
||||
void tr_torrent::mark_changed()
|
||||
|
||||
@@ -440,6 +440,7 @@ struct tr_torrent
|
||||
file_priorities_.set(file, priority);
|
||||
priority_changed_.emit(this, &file, 1U, priority);
|
||||
set_dirty();
|
||||
mark_changed();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1255,11 +1256,6 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
constexpr void bump_date_changed(time_t when)
|
||||
{
|
||||
date_changed_ = std::max(date_changed_, when);
|
||||
}
|
||||
|
||||
void set_verify_state(VerifyState state);
|
||||
|
||||
[[nodiscard]] constexpr std::optional<float> verify_progress() const noexcept
|
||||
@@ -1289,7 +1285,18 @@ private:
|
||||
completion_.set_has_piece(piece, has);
|
||||
}
|
||||
|
||||
constexpr void bump_date_changed(time_t when)
|
||||
{
|
||||
date_changed_ = std::max(date_changed_, when);
|
||||
}
|
||||
|
||||
void mark_changed();
|
||||
|
||||
constexpr void bump_date_edited(time_t when)
|
||||
{
|
||||
date_edited_ = std::max(date_edited_, when);
|
||||
}
|
||||
|
||||
void mark_edited();
|
||||
|
||||
constexpr void set_dirty(bool dirty = true) noexcept
|
||||
|
||||
Reference in New Issue
Block a user