mirror of
https://github.com/nextcloud/desktop.git
synced 2024-12-22 13:44:34 +03:00
When handling fetched shares, record shared-with-me related information in sharemodel properties
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
a72f23a4d3
commit
cf0dd27b5f
1 changed files with 19 additions and 4 deletions
|
@ -491,10 +491,25 @@ void ShareModel::slotSharesFetched(const QList<SharePtr> &shares)
|
||||||
qCInfo(lcSharing) << "Fetched" << shares.count() << "shares";
|
qCInfo(lcSharing) << "Fetched" << shares.count() << "shares";
|
||||||
|
|
||||||
for (const auto &share : shares) {
|
for (const auto &share : shares) {
|
||||||
if (share.isNull() ||
|
if (share.isNull()) {
|
||||||
share->account().isNull() ||
|
continue;
|
||||||
share->getUidOwner() != share->account()->davUser()) {
|
} 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<UserGroupShare>();
|
||||||
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue