Skip to content

Commit

Permalink
Rebase fixes
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Oct 31, 2018
1 parent 0807918 commit 9503528
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 59 deletions.
2 changes: 1 addition & 1 deletion apps/files_sharing/lib/Controller/ShareAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ public function updateShare(
$publicUpload === null &&
$expireDate === null &&
$note === null &&
$label === null,
$label === null &&
$hideDownload === null
) {
throw new OCSBadRequestException($this->l->t('Wrong or no update parameter given'));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<div class="popovermenu menu">
<ul>
<li>
<button class="menuitem clipboardButton" data-clipboard-text="{{shareLinkURL}}">
<a href="#" class="menuitem clipboardButton" data-clipboard-text="{{shareLinkURL}}">
<span class="icon icon-clippy" ></span>
<span>{{copyLabel}}</span>
</button>
</a>
</li>
<li class="hidden linkTextMenu">
<span class="menuitem icon-link-text">
Expand Down
60 changes: 39 additions & 21 deletions core/js/sharedialoglinkshareview.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@
},

onHideDownloadChange: function() {
var $checkbox = this.$('.hideDownloadCheckbox');
var $element = $(event.target);
var $li = $element.closest('li[data-share-id]');
var shareId = $li.data('share-id');
var $checkbox = $li.find('.hideDownloadCheckbox');
$checkbox.siblings('.icon-loading-small').removeClass('hidden').addClass('inlineblock');

var hideDownload = false;
Expand All @@ -187,7 +190,16 @@
}

this.model.saveLinkShare({
hideDownload: hideDownload
hideDownload: hideDownload,
cid: shareId
}, {
success: function() {
$checkbox.siblings('.icon-loading-small').addClass('hidden').removeClass('inlineblock');
},
error: function(obj, msg) {
OC.Notification.showTemporary(t('core', 'Unable to toggle this option'));
$checkbox.siblings('.icon-loading-small').addClass('hidden').removeClass('inlineblock');
}
});
},

Expand Down Expand Up @@ -279,6 +291,14 @@
this.model.saveLinkShare({
permissions: permissions,
cid: shareId
}, {
success: function() {
$checkbox.siblings('.icon-loading-small').addClass('hidden').removeClass('inlineblock');
},
error: function(obj, msg) {
OC.Notification.showTemporary(t('core', 'Unable to toggle this option'));
$checkbox.siblings('.icon-loading-small').addClass('hidden').removeClass('inlineblock');
}
});
},

Expand Down Expand Up @@ -409,9 +429,6 @@
var passwordPlaceholderInitial = this.configModel.get('enforcePasswordForPublicLink')
? PASSWORD_PLACEHOLDER_MESSAGE : PASSWORD_PLACEHOLDER_MESSAGE_OPTIONAL;

var showHideDownloadCheckbox = !this.model.isFolder();
var hideDownload = this.model.get('linkShare').hideDownload;

var publicEditable =
!this.model.isFolder()
&& this.model.updatePermissionPossible();
Expand Down Expand Up @@ -446,8 +463,6 @@
copyLabel: t('core', 'Copy link'),
social: social,
urlLabel: t('core', 'Link'),
showHideDownloadCheckbox: showHideDownloadCheckbox,
hideDownload: hideDownload,
hideDownloadLabel: t('core', 'Hide download'),
enablePasswordLabel: t('core', 'Password protect'),
passwordLabel: t('core', 'Password'),
Expand Down Expand Up @@ -514,9 +529,15 @@
var $element = $(event.target);
var $li = $element.closest('li[data-share-id]');
var $menu = $li.find('.sharingOptionsGroup .popovermenu');
var shareId = $li.data('share-id');

var linkShares = this.model.get('linkShares');
var shareIndex = _.findIndex(linkShares, function(share) {return share.id === shareId})

console.log(this, linkShares[shareIndex])

OC.showMenu(null, $menu);
this._menuOpen = $li.data('share-id');
this._menuOpen = shareId;
},

/**
Expand Down Expand Up @@ -620,21 +641,20 @@
* @returns {Array}
*/
getShareeList: function() {
var universal = this.getShareProperties();

var shares = this.model.get('linkShares');

console.log(this, shares);

if(!this.model.hasLinkShares()) {
return [];
}

var list = [];
for(var index = 0; index < shares.length; index++) {
var share = this.getShareeObject(index);

// first empty {} is necessary, otherwise we get in trouble
// with references
list.push(_.extend({}, universal, share));
list.push(_.extend({}, share));
}

return list;
Expand Down Expand Up @@ -689,6 +709,9 @@
expireDate = moment(share.expiration, 'YYYY-MM-DD').format('DD-MM-YYYY');
}

var showHideDownloadCheckbox = !this.model.isFolder();
var hideDownload = share.hideDownload;

var maxDate = null;

if(hasExpireDate) {
Expand All @@ -709,7 +732,7 @@

return {
cid: share.id,
shareLinkURL: share.link,
shareLinkURL: share.url,
passwordPlaceholder: isPasswordSet ? PASSWORD_PLACEHOLDER : PASSWORD_PLACEHOLDER_MESSAGE,
isPasswordSet: isPasswordSet || isPasswordEnabledByDefault || isPasswordEnforced,
showPasswordCheckBox: showPasswordCheckBox,
Expand All @@ -720,7 +743,9 @@
expireDate: expireDate,
shareNote: share.note,
hasNote: share.note !== '',
maxDate: maxDate
maxDate: maxDate,
showHideDownloadCheckbox: showHideDownloadCheckbox,
hideDownload: hideDownload,
}
},

Expand All @@ -740,13 +765,6 @@

},

getShareProperties: function() {
return {
linkShareLabel: t('core', 'Share link'),
linkShareEnableLabel: t('core', 'Enable'),
};
},

onUnshare: function(event) {
event.preventDefault();
event.stopPropagation();
Expand Down
23 changes: 9 additions & 14 deletions core/js/shareitemmodel.js
Original file line number Diff line number Diff line change
Expand Up @@ -628,10 +628,13 @@
* @returns {int}
*/
linkSharePermissions: function(shareId) {
var linkShares = this.get('linkShares');
var shareIndex = _.findIndex(linkShares, function(share) {return share.id === shareId})

if (!this.hasLinkShares()) {
return -1;
} else if (this.get('linkShares')[shareId]) {
return this.get('linkShares')[shareId].permissions;
} else if (linkShares.length > 0 && shareIndex !== -1) {
return linkShares[shareIndex].permissions;
}
return -1;
},
Expand Down Expand Up @@ -842,7 +845,7 @@
|| share.item_source === this.get('itemSource'));

if (isShareLink) {
/*
/**
* Ignore reshared link shares for now
* FIXME: Find a way to display properly
*/
Expand All @@ -862,17 +865,9 @@
} else {
link += OC.generateUrl('/s/') + share.token;
}
linkShare = {
isLinkShare: true,
id: share.id,
token: share.token,
password: share.share_with,
link: link,
permissions: share.permissions,
// currently expiration is only effective for link shares.
expiration: share.expiration,
stime: share.stime
};
linkShares.push(_.extend({}, share, {
password: share.share_with
}));

return share;
}
Expand Down
23 changes: 4 additions & 19 deletions core/js/sharetemplates.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion lib/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,6 @@
'OC\\Authentication\\Token\\DefaultTokenCleanupJob' => $baseDir . '/lib/private/Authentication/Token/DefaultTokenCleanupJob.php',
'OC\\Authentication\\Token\\DefaultTokenMapper' => $baseDir . '/lib/private/Authentication/Token/DefaultTokenMapper.php',
'OC\\Authentication\\Token\\DefaultTokenProvider' => $baseDir . '/lib/private/Authentication/Token/DefaultTokenProvider.php',
'OC\\Authentication\\Token\\ExpiredTokenException' => $baseDir . '/lib/private/Authentication/Exceptions/ExpiredTokenException.php',
'OC\\Authentication\\Token\\IProvider' => $baseDir . '/lib/private/Authentication/Token/IProvider.php',
'OC\\Authentication\\Token\\IToken' => $baseDir . '/lib/private/Authentication/Token/IToken.php',
'OC\\Authentication\\Token\\Manager' => $baseDir . '/lib/private/Authentication/Token/Manager.php',
Expand Down
1 change: 0 additions & 1 deletion lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,6 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OC\\Authentication\\Token\\DefaultTokenCleanupJob' => __DIR__ . '/../../..' . '/lib/private/Authentication/Token/DefaultTokenCleanupJob.php',
'OC\\Authentication\\Token\\DefaultTokenMapper' => __DIR__ . '/../../..' . '/lib/private/Authentication/Token/DefaultTokenMapper.php',
'OC\\Authentication\\Token\\DefaultTokenProvider' => __DIR__ . '/../../..' . '/lib/private/Authentication/Token/DefaultTokenProvider.php',
'OC\\Authentication\\Token\\ExpiredTokenException' => __DIR__ . '/../../..' . '/lib/private/Authentication/Exceptions/ExpiredTokenException.php',
'OC\\Authentication\\Token\\IProvider' => __DIR__ . '/../../..' . '/lib/private/Authentication/Token/IProvider.php',
'OC\\Authentication\\Token\\IToken' => __DIR__ . '/../../..' . '/lib/private/Authentication/Token/IToken.php',
'OC\\Authentication\\Token\\Manager' => __DIR__ . '/../../..' . '/lib/private/Authentication/Token/Manager.php',
Expand Down

0 comments on commit 9503528

Please sign in to comment.