From 7a56f65fb3165591864b4ad9c84f6b3a4e5a68bb Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Sun, 6 Aug 2017 22:28:54 +0300 Subject: [PATCH] Use 'You' instead of your own user id --- src/TimelineItem.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/TimelineItem.cc b/src/TimelineItem.cc index ee2377ef..cc7f03a3 100644 --- a/src/TimelineItem.cc +++ b/src/TimelineItem.cc @@ -121,7 +121,8 @@ TimelineItem::TimelineItem(ImageItem *image, auto timestamp = QDateTime::fromMSecsSinceEpoch(event.timestamp()); auto displayName = TimelineViewManager::displayName(event.sender()); - descriptionMsg_ = {displayName, + QSettings settings; + descriptionMsg_ = {event.sender() == settings.value("auth/user_id") ? "You" : displayName, " sent an image", descriptiveTime(QDateTime::fromMSecsSinceEpoch(event.timestamp()))}; @@ -147,7 +148,11 @@ TimelineItem::TimelineItem(ImageItem *image, const events::MessageEvent &event, bool w auto body = event.content().body().trimmed().toHtmlEscaped(); auto timestamp = QDateTime::fromMSecsSinceEpoch(event.timestamp()); + auto displayName = TimelineViewManager::displayName(event.sender()); - descriptionMsg_ = { - TimelineViewManager::displayName(event.sender()), - QString(": %1").arg(body), - descriptiveTime(QDateTime::fromMSecsSinceEpoch(event.timestamp()))}; + QSettings settings; + descriptionMsg_ = {event.sender() == settings.value("auth/user_id") ? "You" : displayName, + QString(": %1").arg(body), + descriptiveTime(QDateTime::fromMSecsSinceEpoch(event.timestamp()))}; generateTimestamp(timestamp);