diff options
author | Olivier Paroz <github@oparoz.com> | 2016-06-20 19:41:48 +0300 |
---|---|---|
committer | Olivier Paroz <github@oparoz.com> | 2016-06-20 19:45:58 +0300 |
commit | 6c6828fa955fb1b7f3be15c43698dc14df9f715a (patch) | |
tree | 2b2e8635fa7a737836a83797a9e01be0fe4eda50 | |
parent | 22b2a54b3099b5b022f35c84a688602e9b330ec7 (diff) |
Fix delete image for Filesv15.1-stable8.2
[ci skip]
(cherry picked from commit 45dc311)
(cherry picked from commit ab68a44)
-rw-r--r-- | js/slideshow.js | 17 | ||||
-rw-r--r-- | js/slideshowcontrols.js | 12 |
2 files changed, 21 insertions, 8 deletions
diff --git a/js/slideshow.js b/js/slideshow.js index 2ca2bec0..93fd88d0 100644 --- a/js/slideshow.js +++ b/js/slideshow.js @@ -270,6 +270,23 @@ }, /** + * Deletes an image from the slideshow + * + * @param {object} image + * @param {number} currentIndex + */ + deleteImage: function (image, currentIndex) { + // These are Gallery specific commands to be replaced + // which should sit somewhere else + if (!window.galleryFileAction) { + delete Gallery.imageMap[image.path]; + delete Thumbnails.map[image.file]; + Gallery.albumMap[Gallery.currentAlbum].images.splice(currentIndex, 1); + Gallery.view.init(Gallery.currentAlbum); + } + }, + + /** * Automatically fades the controls after 3 seconds * * @private diff --git a/js/slideshowcontrols.js b/js/slideshowcontrols.js index 980bf1a2..8d6c6921 100644 --- a/js/slideshowcontrols.js +++ b/js/slideshowcontrols.js @@ -1,4 +1,4 @@ -/* global OC, Gallery, SlideShow */ +/* global OC, SlideShow */ (function ($, SlideShow) { "use strict"; /** @@ -434,17 +434,14 @@ * @private */ _deleteImage: function () { - var imagePath = this.images[this.current].path; - var fileId = Gallery.imageMap[imagePath].fileId; + var image = this.images[this.current]; var self = this; $.ajax({ type: 'DELETE', - url: OC.getRootPath() + '/remote.php/webdav/' + imagePath, + url: OC.getRootPath() + '/remote.php/webdav/' + image.path, success: function () { + self.slideshow.deleteImage(image, self.current); self.images.splice(self.current, 1); - delete Gallery.imageMap[imagePath]; - delete Thumbnails.map[fileId]; - Gallery.albumMap[Gallery.currentAlbum].images.splice(self.current, 1); if (self.images.length === 0) { self._exit(); } @@ -452,7 +449,6 @@ self.current = self.current % self.images.length; self._updateSlideshow(self.current); } - Gallery.view.init(Gallery.currentAlbum); } }); } |