Skip to content

Commit 0453149

Browse files
GretaDnpmbuildbot[bot]
authored andcommitted
Fix default action for deleted shares
Signed-off-by: GretaD <gretadoci@gmail.com> Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
1 parent 34e5909 commit 0453149

5 files changed

Lines changed: 30 additions & 5 deletions

File tree

apps/files/css/files.scss

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,8 @@ table td.fileaction {
320320
width: 32px;
321321
text-align: center;
322322
}
323-
table td.filename a.name {
323+
table td.filename a.name,
324+
table td.filename p.name {
324325
display: flex;
325326
position:relative; /* Firefox needs to explicitly have this default set … */
326327
-moz-box-sizing: border-box;
@@ -356,6 +357,9 @@ table td.filename .thumbnail {
356357
position: absolute;
357358
z-index: 4;
358359
}
360+
table td.filename p.name .thumbnail {
361+
cursor: default;
362+
}
359363

360364
// Show slight border around previews for images, txt, etc.
361365
table tr[data-has-preview='true'] .thumbnail {
@@ -477,7 +481,8 @@ table td.selection {
477481
-webkit-transition:background-image 500ms; -moz-transition:background-image 500ms; -o-transition:background-image 500ms; transition:background-image 500ms;
478482
}
479483

480-
#fileList tr td.filename a.name label {
484+
#fileList tr td.filename a.name label,
485+
#fileList tr td.filename p.name label {
481486
position: absolute;
482487
width: 80%;
483488
height: 50px;

apps/files/js/filelist.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,14 @@
130130
*/
131131
dirInfo: null,
132132

133+
/**
134+
* Whether to prevent or to execute the default file actions when the
135+
* file name is clicked.
136+
*
137+
* @type boolean
138+
*/
139+
_defaultFileActionsDisabled: false,
140+
133141
/**
134142
* File actions handler, defaults to OCA.Files.FileActions
135143
* @type OCA.Files.FileActions
@@ -292,6 +300,10 @@
292300
this._detailsView.$el.addClass('disappear');
293301
}
294302

303+
if (options && options.defaultFileActionsDisabled) {
304+
this._defaultFileActionsDisabled = options.defaultFileActionsDisabled
305+
}
306+
295307
this._initFileActions(options.fileActions);
296308

297309
if (this._detailsView) {
@@ -876,7 +888,9 @@
876888
if (!this._detailsView || $(event.target).is('.nametext, .name, .thumbnail') || $(event.target).closest('.nametext').length) {
877889
var filename = $tr.attr('data-file');
878890
var renaming = $tr.data('renaming');
879-
if (!renaming) {
891+
if (this._defaultFileActionsDisabled) {
892+
event.preventDefault();
893+
} else if (!renaming) {
880894
this.fileActions.currentFile = $tr.find('td');
881895
var mime = this.fileActions.getCurrentMimeType();
882896
var type = this.fileActions.getCurrentType();
@@ -1524,6 +1538,11 @@
15241538
"class": "name",
15251539
"href": linkUrl
15261540
});
1541+
if (this._defaultFileActionsDisabled) {
1542+
linkElem = $('<p></p>').attr({
1543+
"class": "name"
1544+
})
1545+
}
15271546

15281547
linkElem.append('<div class="thumbnail-wrapper"><div class="thumbnail" style="background-image:url(' + icon + ');"></div></div>');
15291548

apps/files_sharing/js/app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ OCA.Sharing.App = {
111111
$el,
112112
{
113113
id: 'shares.deleted',
114+
defaultFileActionsDisabled: true,
114115
showDeleted: true,
115116
sharedWithUser: true,
116117
fileActions: this._restoreShareAction(),

apps/files_sharing/js/dist/files_sharing.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/files_sharing/js/dist/files_sharing.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)