From 20a43d1982188cee9fed5342ad5ade0a3d21d0f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20M=C3=BCller?= <thomas.mueller@tmit.eu>
Date: Wed, 18 Sep 2013 13:09:47 +0200
Subject: [PATCH] remove file action elements before recreating them

---
 apps/files/js/fileactions.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index 330fe86f6b..009ea62de9 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -68,6 +68,9 @@ var FileActions = {
 		if ($('tr[data-file="'+file+'"]').data('renaming')) {
 			return;
 		}
+
+		// recreate fileactions
+		parent.children('a.name').find('.fileactions').remove();
 		parent.children('a.name').append('<span class="fileactions" />');
 		var defaultAction = FileActions.getDefault(FileActions.getCurrentMimeType(), FileActions.getCurrentType(), FileActions.getCurrentPermissions());
 
@@ -117,6 +120,8 @@ var FileActions = {
 			addAction('Share', actions.Share);
 		}
 
+		// remove the existing delete action
+		parent.parent().children().last().find('.action.delete').remove();
 		if (actions['Delete']) {
 			var img = FileActions.icons['Delete'];
 			if (img.call) {
-- 
GitLab