Display share note when there is one associated with a share link.
authorCamila <hello@camila.codes>
Tue, 14 Sep 2021 18:57:28 +0000 (20:57 +0200)
committerallexzander (Rebase PR Action) <allexzander@users.noreply.github.com>
Fri, 17 Sep 2021 06:57:08 +0000 (06:57 +0000)
Signed-off-by: Camila <hello@camila.codes>
src/gui/sharemanager.cpp
src/gui/sharemanager.h

index dbeab86257807954c844e6b718a9bbe427316647..4b40213e39bbc80e415aff7e09514e4db8c9c366 100644 (file)
@@ -195,10 +195,12 @@ LinkShare::LinkShare(AccountPtr account,
     Permissions permissions,
     bool isPasswordSet,
     const QUrl &url,
-    const QDate &expireDate)
+    const QDate &expireDate,
+    const QString &note)
     : Share(account, id, uidowner, ownerDisplayName, path, Share::TypeLink, isPasswordSet, permissions)
     , _name(name)
     , _token(token)
+    , _note(note)
     , _expireDate(expireDate)
     , _url(url)
 {
@@ -529,6 +531,11 @@ QSharedPointer<LinkShare> ShareManager::parseLinkShare(const QJsonObject &data)
     if (data.value("expiration").isString()) {
         expireDate = QDate::fromString(data.value("expiration").toString(), "yyyy-MM-dd 00:00:00");
     }
+    
+    QString note;
+    if (data.value("note").isString()) {
+        note = data.value("note").toString();
+    }
 
     return QSharedPointer<LinkShare>(new LinkShare(_account,
         data.value("id").toVariant().toString(), // "id" used to be an integer, support both
@@ -540,7 +547,8 @@ QSharedPointer<LinkShare> ShareManager::parseLinkShare(const QJsonObject &data)
         (Share::Permissions)data.value("permissions").toInt(),
         data.value("share_with").isString(), // has password?
         url,
-        expireDate));
+        expireDate,
+        note));
 }
 
 QSharedPointer<Share> ShareManager::parseShare(const QJsonObject &data)
index a764163f63c359c05615505b82c63dd2595ecdce..64a3a22da5097c14b3299faff8cbaf04fef83303 100644 (file)
@@ -175,7 +175,8 @@ public:
         const Permissions permissions,
         bool isPasswordSet,
         const QUrl &url,
-        const QDate &expireDate);
+        const QDate &expireDate,
+        const QString &note);
 
     /*
      * Get the share link
@@ -205,7 +206,6 @@ public:
     /*
      * Returns the note of the link share.
      */
-
     QString getNote() const;
 
     /*
@@ -215,7 +215,6 @@ public:
      */
     void setName(const QString &name);
 
-
     /*
      * Set the note of the link share.
      */