[Pkg-owncloud-commits] [owncloud] 15/75: Add caching for filelist sharing icon status to avoid many http req.

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:08:29 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v3.0.1
in repository owncloud.

commit 7752008152c05bd6dd15eac6be10995152ee7f6a
Author: Brice Maron <brice at bmaron.net>
Date:   Thu Oct 20 23:02:38 2011 +0200

    Add caching for filelist sharing icon status to avoid many http req.
---
 apps/files_sharing/js/share.js |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index aaffc38..c0fc91e 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -1,8 +1,11 @@
 $(document).ready(function() {
+	var shared_status = {};
 	if (typeof FileActions !== 'undefined') {
 		FileActions.register('all', 'Share', function(filename) {
 			var icon;
 			var file = $('#dir').val()+'/'+filename;
+			if(shared_status[file])
+				return shared_status[file].icon;
 			$.ajax({
 				type: 'GET',
 				url: OC.linkTo('files_sharing', 'ajax/getitem.php'),
@@ -20,6 +23,7 @@ $(document).ready(function() {
 					} else {
 						icon = OC.imagePath('core', 'actions/share');
 					}
+					shared_status[file]= { timestamp: new Date().getTime(), icon: icon };
 				}
 			});
 			return icon;
@@ -54,6 +58,7 @@ $(document).ready(function() {
 	$(this).click(function(event) {
 		if (!($(event.target).hasClass('drop')) && $(event.target).parents().index($('#dropdown')) == -1) {
 			if ($('#dropdown').is(':visible')) {
+				delete shared_status[$('#dropdown').data('file')]; //Remove File from icon cache
 				$('#dropdown').hide('blind', function() {
 					$('#dropdown').remove();
 					$('tr').removeClass('mouseOver');

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list