diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index 1b04097ccb1750816755d0a30eaccdacf6f11191..ec46bbe44f1b1fb0740fa05d4f13b1adc1813389 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -31,8 +31,8 @@ $(document).ready(function() {
 			// we create a share notification action to inform the user about files
 			// shared with him otherwise we just update the existing share action.
 			var allShared;
+			var $fileList = $(this);
 			if (oc_appconfig.core.sharingDisabledForUser) {
-				var $fileList = $(this);
 				allShared = $fileList.find('[data-share-owner]');
 				var shareNotification = '<a class="action action-share-notification permanent"' +
 						' data-action="Share-Notification" href="#" original-title="">' +