mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Show pack Id for image pack changes in timeline
Show either pack name, state key or (empty).
This commit is contained in:
parent
3b2f47c56f
commit
ffc5426e87
1 changed files with 13 additions and 4 deletions
|
@ -2251,17 +2251,26 @@ TimelineModel::formatImagePackEvent(const QString &id)
|
|||
auto removed = calcChange(oldImages, newImages);
|
||||
|
||||
auto sender = utils::replaceEmoji(displayName(QString::fromStdString(event->sender)));
|
||||
const auto packId = [&event]() -> QString {
|
||||
if (!event->content.pack->display_name.empty()) {
|
||||
return event->content.pack->display_name.c_str();
|
||||
} else if (!event->state_key.empty()) {
|
||||
return event->state_key.c_str();
|
||||
}
|
||||
return tr("(empty)");
|
||||
}();
|
||||
|
||||
QString msg;
|
||||
|
||||
if (!removed.isEmpty()) {
|
||||
msg = tr("%1 removed the following images from the pack:<br>%2")
|
||||
.arg(sender, removed.join(", "));
|
||||
msg = tr("%1 removed the following images from the pack %2:<br>%3")
|
||||
.arg(sender, packId, removed.join(", "));
|
||||
}
|
||||
if (!added.isEmpty()) {
|
||||
if (!msg.isEmpty())
|
||||
msg += "<br>";
|
||||
msg += tr("%1 added the following images to the pack:<br>%2").arg(sender, added.join(", "));
|
||||
msg += tr("%1 added the following images to the pack %2:<br>%3")
|
||||
.arg(sender, packId, added.join(", "));
|
||||
}
|
||||
|
||||
if (msg.isEmpty())
|
||||
|
|
Loading…
Reference in a new issue