Skip to content

Commit 9503528

Browse files
committed
Rebase fixes
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
1 parent 0807918 commit 9503528

7 files changed

Lines changed: 55 additions & 59 deletions

File tree

apps/files_sharing/lib/Controller/ShareAPIController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ public function updateShare(
783783
$publicUpload === null &&
784784
$expireDate === null &&
785785
$note === null &&
786-
$label === null,
786+
$label === null &&
787787
$hideDownload === null
788788
) {
789789
throw new OCSBadRequestException($this->l->t('Wrong or no update parameter given'));

core/js/share/sharedialoglinkshareview_popover_menu.handlebars

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<div class="popovermenu menu">
22
<ul>
33
<li>
4-
<button class="menuitem clipboardButton" data-clipboard-text="{{shareLinkURL}}">
4+
<a href="#" class="menuitem clipboardButton" data-clipboard-text="{{shareLinkURL}}">
55
<span class="icon icon-clippy" ></span>
66
<span>{{copyLabel}}</span>
7-
</button>
7+
</a>
88
</li>
99
<li class="hidden linkTextMenu">
1010
<span class="menuitem icon-link-text">

core/js/sharedialoglinkshareview.js

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,10 @@
178178
},
179179

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

184187
var hideDownload = false;
@@ -187,7 +190,16 @@
187190
}
188191

189192
this.model.saveLinkShare({
190-
hideDownload: hideDownload
193+
hideDownload: hideDownload,
194+
cid: shareId
195+
}, {
196+
success: function() {
197+
$checkbox.siblings('.icon-loading-small').addClass('hidden').removeClass('inlineblock');
198+
},
199+
error: function(obj, msg) {
200+
OC.Notification.showTemporary(t('core', 'Unable to toggle this option'));
201+
$checkbox.siblings('.icon-loading-small').addClass('hidden').removeClass('inlineblock');
202+
}
191203
});
192204
},
193205

@@ -279,6 +291,14 @@
279291
this.model.saveLinkShare({
280292
permissions: permissions,
281293
cid: shareId
294+
}, {
295+
success: function() {
296+
$checkbox.siblings('.icon-loading-small').addClass('hidden').removeClass('inlineblock');
297+
},
298+
error: function(obj, msg) {
299+
OC.Notification.showTemporary(t('core', 'Unable to toggle this option'));
300+
$checkbox.siblings('.icon-loading-small').addClass('hidden').removeClass('inlineblock');
301+
}
282302
});
283303
},
284304

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

412-
var showHideDownloadCheckbox = !this.model.isFolder();
413-
var hideDownload = this.model.get('linkShare').hideDownload;
414-
415432
var publicEditable =
416433
!this.model.isFolder()
417434
&& this.model.updatePermissionPossible();
@@ -446,8 +463,6 @@
446463
copyLabel: t('core', 'Copy link'),
447464
social: social,
448465
urlLabel: t('core', 'Link'),
449-
showHideDownloadCheckbox: showHideDownloadCheckbox,
450-
hideDownload: hideDownload,
451466
hideDownloadLabel: t('core', 'Hide download'),
452467
enablePasswordLabel: t('core', 'Password protect'),
453468
passwordLabel: t('core', 'Password'),
@@ -514,9 +529,15 @@
514529
var $element = $(event.target);
515530
var $li = $element.closest('li[data-share-id]');
516531
var $menu = $li.find('.sharingOptionsGroup .popovermenu');
532+
var shareId = $li.data('share-id');
533+
534+
var linkShares = this.model.get('linkShares');
535+
var shareIndex = _.findIndex(linkShares, function(share) {return share.id === shareId})
536+
537+
console.log(this, linkShares[shareIndex])
517538

518539
OC.showMenu(null, $menu);
519-
this._menuOpen = $li.data('share-id');
540+
this._menuOpen = shareId;
520541
},
521542

522543
/**
@@ -620,21 +641,20 @@
620641
* @returns {Array}
621642
*/
622643
getShareeList: function() {
623-
var universal = this.getShareProperties();
624-
625644
var shares = this.model.get('linkShares');
626645

646+
console.log(this, shares);
647+
627648
if(!this.model.hasLinkShares()) {
628649
return [];
629650
}
630651

631652
var list = [];
632653
for(var index = 0; index < shares.length; index++) {
633654
var share = this.getShareeObject(index);
634-
635655
// first empty {} is necessary, otherwise we get in trouble
636656
// with references
637-
list.push(_.extend({}, universal, share));
657+
list.push(_.extend({}, share));
638658
}
639659

640660
return list;
@@ -689,6 +709,9 @@
689709
expireDate = moment(share.expiration, 'YYYY-MM-DD').format('DD-MM-YYYY');
690710
}
691711

712+
var showHideDownloadCheckbox = !this.model.isFolder();
713+
var hideDownload = share.hideDownload;
714+
692715
var maxDate = null;
693716

694717
if(hasExpireDate) {
@@ -709,7 +732,7 @@
709732

710733
return {
711734
cid: share.id,
712-
shareLinkURL: share.link,
735+
shareLinkURL: share.url,
713736
passwordPlaceholder: isPasswordSet ? PASSWORD_PLACEHOLDER : PASSWORD_PLACEHOLDER_MESSAGE,
714737
isPasswordSet: isPasswordSet || isPasswordEnabledByDefault || isPasswordEnforced,
715738
showPasswordCheckBox: showPasswordCheckBox,
@@ -720,7 +743,9 @@
720743
expireDate: expireDate,
721744
shareNote: share.note,
722745
hasNote: share.note !== '',
723-
maxDate: maxDate
746+
maxDate: maxDate,
747+
showHideDownloadCheckbox: showHideDownloadCheckbox,
748+
hideDownload: hideDownload,
724749
}
725750
},
726751

@@ -740,13 +765,6 @@
740765

741766
},
742767

743-
getShareProperties: function() {
744-
return {
745-
linkShareLabel: t('core', 'Share link'),
746-
linkShareEnableLabel: t('core', 'Enable'),
747-
};
748-
},
749-
750768
onUnshare: function(event) {
751769
event.preventDefault();
752770
event.stopPropagation();

core/js/shareitemmodel.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -628,10 +628,13 @@
628628
* @returns {int}
629629
*/
630630
linkSharePermissions: function(shareId) {
631+
var linkShares = this.get('linkShares');
632+
var shareIndex = _.findIndex(linkShares, function(share) {return share.id === shareId})
633+
631634
if (!this.hasLinkShares()) {
632635
return -1;
633-
} else if (this.get('linkShares')[shareId]) {
634-
return this.get('linkShares')[shareId].permissions;
636+
} else if (linkShares.length > 0 && shareIndex !== -1) {
637+
return linkShares[shareIndex].permissions;
635638
}
636639
return -1;
637640
},
@@ -842,7 +845,7 @@
842845
|| share.item_source === this.get('itemSource'));
843846

844847
if (isShareLink) {
845-
/*
848+
/**
846849
* Ignore reshared link shares for now
847850
* FIXME: Find a way to display properly
848851
*/
@@ -862,17 +865,9 @@
862865
} else {
863866
link += OC.generateUrl('/s/') + share.token;
864867
}
865-
linkShare = {
866-
isLinkShare: true,
867-
id: share.id,
868-
token: share.token,
869-
password: share.share_with,
870-
link: link,
871-
permissions: share.permissions,
872-
// currently expiration is only effective for link shares.
873-
expiration: share.expiration,
874-
stime: share.stime
875-
};
868+
linkShares.push(_.extend({}, share, {
869+
password: share.share_with
870+
}));
876871

877872
return share;
878873
}

core/js/sharetemplates.js

Lines changed: 4 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/composer/composer/autoload_classmap.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,6 @@
489489
'OC\\Authentication\\Token\\DefaultTokenCleanupJob' => $baseDir . '/lib/private/Authentication/Token/DefaultTokenCleanupJob.php',
490490
'OC\\Authentication\\Token\\DefaultTokenMapper' => $baseDir . '/lib/private/Authentication/Token/DefaultTokenMapper.php',
491491
'OC\\Authentication\\Token\\DefaultTokenProvider' => $baseDir . '/lib/private/Authentication/Token/DefaultTokenProvider.php',
492-
'OC\\Authentication\\Token\\ExpiredTokenException' => $baseDir . '/lib/private/Authentication/Exceptions/ExpiredTokenException.php',
493492
'OC\\Authentication\\Token\\IProvider' => $baseDir . '/lib/private/Authentication/Token/IProvider.php',
494493
'OC\\Authentication\\Token\\IToken' => $baseDir . '/lib/private/Authentication/Token/IToken.php',
495494
'OC\\Authentication\\Token\\Manager' => $baseDir . '/lib/private/Authentication/Token/Manager.php',

lib/composer/composer/autoload_static.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,6 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
519519
'OC\\Authentication\\Token\\DefaultTokenCleanupJob' => __DIR__ . '/../../..' . '/lib/private/Authentication/Token/DefaultTokenCleanupJob.php',
520520
'OC\\Authentication\\Token\\DefaultTokenMapper' => __DIR__ . '/../../..' . '/lib/private/Authentication/Token/DefaultTokenMapper.php',
521521
'OC\\Authentication\\Token\\DefaultTokenProvider' => __DIR__ . '/../../..' . '/lib/private/Authentication/Token/DefaultTokenProvider.php',
522-
'OC\\Authentication\\Token\\ExpiredTokenException' => __DIR__ . '/../../..' . '/lib/private/Authentication/Exceptions/ExpiredTokenException.php',
523522
'OC\\Authentication\\Token\\IProvider' => __DIR__ . '/../../..' . '/lib/private/Authentication/Token/IProvider.php',
524523
'OC\\Authentication\\Token\\IToken' => __DIR__ . '/../../..' . '/lib/private/Authentication/Token/IToken.php',
525524
'OC\\Authentication\\Token\\Manager' => __DIR__ . '/../../..' . '/lib/private/Authentication/Token/Manager.php',

0 commit comments

Comments
 (0)