summary refs log tree commit diff
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2022-04-22 23:45:34 +0000
committerGitHub <noreply@github.com>2022-04-22 23:45:34 +0000
commitc637989ac06c58269ddac5e104dd7fb36031b3b7 (patch)
tree22074c57dad5c32ba680c5b357851cf878cc8960
parentAdd member list and settings buttons to spaces (#1051) (diff)
parentShow pack Id for image pack changes in timeline (diff)
downloadnheko-c637989ac06c58269ddac5e104dd7fb36031b3b7.tar.xz
Merge pull request #1054 from tastytea/image-pack-changes/pack-id
Show pack Id for image pack changes in timeline
-rw-r--r--src/timeline/TimelineModel.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp

index 9c12b967..4309fb24 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp
@@ -2250,18 +2250,27 @@ TimelineModel::formatImagePackEvent(const QString &id) auto added = calcChange(newImages, oldImages); auto removed = calcChange(oldImages, newImages); - auto sender = utils::replaceEmoji(displayName(QString::fromStdString(event->sender))); + 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())