Merge pull request #2371 from nextcloud/issue-2369-add-share-indicator-for-mail-shares

Add share indicator for mail shares
This commit is contained in:
Lukas Reschke 2016-12-01 12:17:56 +01:00 committed by GitHub
commit a87638c6ab
4 changed files with 23 additions and 3 deletions

View File

@ -120,7 +120,8 @@ class SharesPlugin extends \Sabre\DAV\ServerPlugin {
\OCP\Share::SHARE_TYPE_USER, \OCP\Share::SHARE_TYPE_USER,
\OCP\Share::SHARE_TYPE_GROUP, \OCP\Share::SHARE_TYPE_GROUP,
\OCP\Share::SHARE_TYPE_LINK, \OCP\Share::SHARE_TYPE_LINK,
\OCP\Share::SHARE_TYPE_REMOTE \OCP\Share::SHARE_TYPE_REMOTE,
\OCP\Share::SHARE_TYPE_EMAIL,
]; ];
foreach ($requestedShareTypes as $requestedShareType) { foreach ($requestedShareTypes as $requestedShareType) {
// one of each type is enough to find out about the types // one of each type is enough to find out about the types

View File

@ -114,6 +114,8 @@
shareType = parseInt(shareType, 10); shareType = parseInt(shareType, 10);
if (shareType === OC.Share.SHARE_TYPE_LINK) { if (shareType === OC.Share.SHARE_TYPE_LINK) {
hasLink = true; hasLink = true;
} else if (shareType === OC.Share.SHARE_TYPE_EMAIL) {
hasLink = true;
} else if (shareType === OC.Share.SHARE_TYPE_USER) { } else if (shareType === OC.Share.SHARE_TYPE_USER) {
hasShares = true; hasShares = true;
} else if (shareType === OC.Share.SHARE_TYPE_GROUP) { } else if (shareType === OC.Share.SHARE_TYPE_GROUP) {
@ -159,8 +161,17 @@
shareTab.on('sharesChanged', function(shareModel) { shareTab.on('sharesChanged', function(shareModel) {
var fileInfoModel = shareModel.fileInfoModel; var fileInfoModel = shareModel.fileInfoModel;
var $tr = fileList.findFileEl(fileInfoModel.get('name')); var $tr = fileList.findFileEl(fileInfoModel.get('name'));
// We count email shares as link share
var hasLinkShare = shareModel.hasLinkShare();
shareModel.get('shares').forEach(function (share) {
if (share.share_type === OC.Share.SHARE_TYPE_EMAIL) {
hasLinkShare = true;
}
});
OCA.Sharing.Util._updateFileListDataAttributes(fileList, $tr, shareModel); OCA.Sharing.Util._updateFileListDataAttributes(fileList, $tr, shareModel);
if (!OCA.Sharing.Util._updateFileActionIcon($tr, shareModel.hasUserShares(), shareModel.hasLinkShare())) { if (!OCA.Sharing.Util._updateFileActionIcon($tr, shareModel.hasUserShares(), hasLinkShare)) {
// remove icon, if applicable // remove icon, if applicable
OC.Share.markFileAsShared($tr, false, false); OC.Share.markFileAsShared($tr, false, false);
} }

View File

@ -5,7 +5,7 @@
<description>Share provider which allows you to share files by mail</description> <description>Share provider which allows you to share files by mail</description>
<licence>AGPL</licence> <licence>AGPL</licence>
<author>Bjoern Schiessle</author> <author>Bjoern Schiessle</author>
<version>1.0.0</version> <version>1.0.1</version>
<namespace>ShareByMail</namespace> <namespace>ShareByMail</namespace>
<category>other</category> <category>other</category>
<dependencies> <dependencies>
@ -13,6 +13,10 @@
</dependencies> </dependencies>
<default_enable/> <default_enable/>
<types>
<filesystem/>
</types>
<activity> <activity>
<providers> <providers>
<provider>OCA\ShareByMail\Activity</provider> <provider>OCA\ShareByMail\Activity</provider>

View File

@ -206,6 +206,10 @@ class ProviderFactory implements IProviderFactory {
} }
public function getAllProviders() { public function getAllProviders() {
$shareByMail = $this->getShareByMailProvider();
if ($shareByMail !== null) {
return [$this->defaultShareProvider(), $this->federatedShareProvider(), $shareByMail];
}
return [$this->defaultShareProvider(), $this->federatedShareProvider()]; return [$this->defaultShareProvider(), $this->federatedShareProvider()];
} }
} }