Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/files_sharing/lib/Controller/ShareAPIController.php13
-rw-r--r--apps/files_sharing/src/components/SharingEntryLink.vue24
-rw-r--r--apps/sharebymail/lib/ShareByMailProvider.php9
-rw-r--r--apps/sharebymail/tests/ShareByMailProviderTest.php3
4 files changed, 39 insertions, 10 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php
index a051f9141ff..044a2f51c19 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -558,11 +558,11 @@ class ShareAPIController extends OCSController {
// Only share by mail have a recipient
if ($shareType === IShare::TYPE_EMAIL) {
$share->setSharedWith($shareWith);
- } else {
- // Only link share have a label
- if (!empty($label)) {
- $share->setLabel($label);
- }
+ }
+
+ // If we have a label, use it
+ if (!empty($label)) {
+ $share->setLabel($label);
}
if ($sendPasswordByTalk === 'true') {
@@ -1127,8 +1127,7 @@ class ShareAPIController extends OCSController {
$share->setPassword($password);
}
- // only link shares have labels
- if ($share->getShareType() === IShare::TYPE_LINK && $label !== null) {
+ if ($label !== null) {
if (strlen($label) > 255) {
throw new OCSBadRequestException("Maxmimum label length is 255");
}
diff --git a/apps/files_sharing/src/components/SharingEntryLink.vue b/apps/files_sharing/src/components/SharingEntryLink.vue
index 44c3c986e17..982ed4bff3a 100644
--- a/apps/files_sharing/src/components/SharingEntryLink.vue
+++ b/apps/files_sharing/src/components/SharingEntryLink.vue
@@ -29,6 +29,9 @@
<h5 :title="title">
{{ title }}
</h5>
+ <p v-if="subtitle">
+ {{ subtitle }}
+ </p>
</div>
<!-- clipboard -->
@@ -406,7 +409,6 @@ export default {
/**
* Link share label
- * TODO: allow editing
* @returns {string}
*/
title() {
@@ -424,6 +426,11 @@ export default {
})
}
if (this.share.label && this.share.label.trim() !== '') {
+ if (this.isEmailShareType) {
+ return t('files_sharing', 'Mail share ({label})', {
+ label: this.share.label.trim(),
+ })
+ }
return t('files_sharing', 'Share link ({label})', {
label: this.share.label.trim(),
})
@@ -436,6 +443,18 @@ export default {
},
/**
+ * Show the email on a second line if a label is set for mail shares
+ * @returns {string}
+ */
+ subtitle() {
+ if (this.isEmailShareType
+ && this.title !== this.share.shareWith) {
+ return this.share.shareWith
+ }
+ return null
+ },
+
+ /**
* Does the current share have an expiration date
* @returns {boolean}
*/
@@ -933,6 +952,9 @@ export default {
overflow: hidden;
white-space: nowrap;
}
+ p {
+ color: var(--color-text-maxcontrast);
+ }
}
&:not(.sharing-entry--share) &__actions {
diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php
index 2484ccdd720..e1585955c62 100644
--- a/apps/sharebymail/lib/ShareByMailProvider.php
+++ b/apps/sharebymail/lib/ShareByMailProvider.php
@@ -322,6 +322,7 @@ class ShareByMailProvider implements IShareProvider {
$share->getPassword(),
$share->getSendPasswordByTalk(),
$share->getHideDownload(),
+ $share->getLabel(),
$share->getExpirationDate()
);
@@ -659,10 +660,11 @@ class ShareByMailProvider implements IShareProvider {
* @param string $password
* @param bool $sendPasswordByTalk
* @param bool $hideDownload
+ * @param string $label
* @param \DateTime|null $expirationTime
* @return int
*/
- protected function addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $uidOwner, $permissions, $token, $password, $sendPasswordByTalk, $hideDownload, $expirationTime) {
+ protected function addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $uidOwner, $permissions, $token, $password, $sendPasswordByTalk, $hideDownload, $label, $expirationTime) {
$qb = $this->dbConnection->getQueryBuilder();
$qb->insert('share')
->setValue('share_type', $qb->createNamedParameter(IShare::TYPE_EMAIL))
@@ -677,7 +679,8 @@ class ShareByMailProvider implements IShareProvider {
->setValue('password', $qb->createNamedParameter($password))
->setValue('password_by_talk', $qb->createNamedParameter($sendPasswordByTalk, IQueryBuilder::PARAM_BOOL))
->setValue('stime', $qb->createNamedParameter(time()))
- ->setValue('hide_download', $qb->createNamedParameter((int)$hideDownload, IQueryBuilder::PARAM_INT));
+ ->setValue('hide_download', $qb->createNamedParameter((int)$hideDownload, IQueryBuilder::PARAM_INT))
+ ->setValue('label', $qb->createNamedParameter($label));
if ($expirationTime !== null) {
$qb->setValue('expiration', $qb->createNamedParameter($expirationTime, IQueryBuilder::PARAM_DATE));
@@ -720,6 +723,7 @@ class ShareByMailProvider implements IShareProvider {
->set('uid_owner', $qb->createNamedParameter($share->getShareOwner()))
->set('uid_initiator', $qb->createNamedParameter($share->getSharedBy()))
->set('password', $qb->createNamedParameter($share->getPassword()))
+ ->set('label', $qb->createNamedParameter($share->getLabel()))
->set('password_by_talk', $qb->createNamedParameter($share->getSendPasswordByTalk(), IQueryBuilder::PARAM_BOOL))
->set('expiration', $qb->createNamedParameter($share->getExpirationDate(), IQueryBuilder::PARAM_DATE))
->set('note', $qb->createNamedParameter($share->getNote()))
@@ -982,6 +986,7 @@ class ShareByMailProvider implements IShareProvider {
$share->setShareTime($shareTime);
$share->setSharedWith($data['share_with']);
$share->setPassword($data['password']);
+ $share->setLabel($data['label']);
$share->setSendPasswordByTalk((bool)$data['password_by_talk']);
$share->setHideDownload((bool)$data['hide_download']);
diff --git a/apps/sharebymail/tests/ShareByMailProviderTest.php b/apps/sharebymail/tests/ShareByMailProviderTest.php
index fede0d225a2..bb6e7d0a353 100644
--- a/apps/sharebymail/tests/ShareByMailProviderTest.php
+++ b/apps/sharebymail/tests/ShareByMailProviderTest.php
@@ -524,6 +524,7 @@ class ShareByMailProviderTest extends TestCase {
$password = 'password';
$sendPasswordByTalk = true;
$hideDownload = true;
+ $label = 'label';
$expiration = new \DateTime();
@@ -542,6 +543,7 @@ class ShareByMailProviderTest extends TestCase {
$password,
$sendPasswordByTalk,
$hideDownload,
+ $label,
$expiration
]
);
@@ -567,6 +569,7 @@ class ShareByMailProviderTest extends TestCase {
$this->assertSame($password, $result[0]['password']);
$this->assertSame($sendPasswordByTalk, (bool)$result[0]['password_by_talk']);
$this->assertSame($hideDownload, (bool)$result[0]['hide_download']);
+ $this->assertSame($label, $result[0]['label']);
$this->assertSame($expiration->getTimestamp(), \DateTime::createFromFormat('Y-m-d H:i:s', $result[0]['expiration'])->getTimestamp());
}