mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Use expireDate if returned by the OCS Share API
If an app modifies the expiration date (for example the password policy app) then on more recent versions of the server we will get the share object back REST style. We should use that info! Fixes #4409
This commit is contained in:
parent
9f30e83413
commit
598941948c
@ -180,9 +180,19 @@ void LinkShare::setExpireDate(const QDate &date)
|
||||
job->setExpireDate(getId(), date);
|
||||
}
|
||||
|
||||
void LinkShare::slotExpireDateSet(const QVariantMap&, const QVariant &value)
|
||||
void LinkShare::slotExpireDateSet(const QVariantMap& reply, const QVariant &value)
|
||||
{
|
||||
_expireDate = value.toDate();
|
||||
auto data = reply.value("ocs").toMap().value("data").toMap();
|
||||
|
||||
/*
|
||||
* If the reply provides a data back (more REST style)
|
||||
* they use this date.
|
||||
*/
|
||||
if (data.value("expiration").isValid()) {
|
||||
_expireDate = QDate::fromString(data.value("expiration").toString(), "yyyy-MM-dd 00:00:00");
|
||||
} else {
|
||||
_expireDate = value.toDate();
|
||||
}
|
||||
emit expireDateSet();
|
||||
}
|
||||
|
||||
|
||||
@ -190,7 +190,7 @@ signals:
|
||||
private slots:
|
||||
void slotPasswordSet(const QVariantMap&, const QVariant &value);
|
||||
void slotPublicUploadSet(const QVariantMap&, const QVariant &value);
|
||||
void slotExpireDateSet(const QVariantMap&, const QVariant &value);
|
||||
void slotExpireDateSet(const QVariantMap& reply, const QVariant &value);
|
||||
void slotSetPasswordError(int statusCode, const QString &message);
|
||||
|
||||
private:
|
||||
|
||||
@ -153,6 +153,10 @@ void ShareLinkWidget::setExpireDate(const QDate &date)
|
||||
|
||||
void ShareLinkWidget::slotExpireSet()
|
||||
{
|
||||
auto date = _share->getExpireDate();
|
||||
if (date.isValid()) {
|
||||
_ui->calendar->setDate(date);
|
||||
}
|
||||
_pi_date->stopAnimation();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user