diff --git a/src/gui/filedetails/sharemodel.cpp b/src/gui/filedetails/sharemodel.cpp index 6c4b6f65c..1dd49ef27 100644 --- a/src/gui/filedetails/sharemodel.cpp +++ b/src/gui/filedetails/sharemodel.cpp @@ -491,10 +491,25 @@ void ShareModel::slotSharesFetched(const QList &shares) qCInfo(lcSharing) << "Fetched" << shares.count() << "shares"; for (const auto &share : shares) { - if (share.isNull() || - share->account().isNull() || - share->getUidOwner() != share->account()->davUser()) { - + if (share.isNull()) { + continue; + } else if (const auto selfUserId = _accountState->account()->davUser(); share->getUidOwner() != selfUserId) { + if (share->getShareType() == Share::TypeUser && + share->getShareWith() && + share->getShareWith()->shareWith() == selfUserId) + { + const auto userShare = share.objectCast(); + const auto expireDate = userShare->getExpireDate(); + const auto daysToExpire = QDate::currentDate().daysTo(expireDate); + _sharedWithMeExpires = expireDate.isValid(); + Q_EMIT sharedWithMeExpiresChanged(); + _sharedWithMeRemainingTimeString = daysToExpire > 1 + ? tr("%1 days").arg(daysToExpire) + : daysToExpire > 0 + ? tr("1 day") + : tr("Today"); + Q_EMIT sharedWithMeRemainingTimeStringChanged(); + } continue; }