Fix article rename logic

This commit is contained in:
mtkennerly 2023-12-22 21:38:35 +08:00
parent 24bfb3e006
commit c1f9367c56
No known key found for this signature in database
GPG key ID: E764BE00BE6E6408
4 changed files with 69 additions and 19 deletions

View file

@ -182,11 +182,12 @@ impl WikiCache {
}
}
Some(old_name) => {
self.0.entry(title.to_string()).and_modify(|x| {
x.page_id = page_id;
x.state = State::Outdated;
x.renamed_from.push(old_name);
});
if let Some(mut info) = self.0.remove(&old_name) {
info.page_id = page_id;
info.state = State::Outdated;
info.renamed_from.push(old_name);
self.0.insert(title, info);
}
}
}
}