From 3607aa32ca1673913dbf576912fd4aa7115ac877 Mon Sep 17 00:00:00 2001 From: Philipp Date: Sat, 26 Nov 2022 23:34:16 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Hypolite Petovan --- src/Model/Photo.php | 2 +- view/js/filebrowser.js | 8 ++++---- view/js/main.js | 6 +++--- view/theme/frio/js/filebrowser.js | 1 - view/theme/frio/js/modal.js | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Model/Photo.php b/src/Model/Photo.php index a139ba715..12d0c2f92 100644 --- a/src/Model/Photo.php +++ b/src/Model/Photo.php @@ -185,7 +185,7 @@ class Photo { $photos = DBA::toArray( DBA::p( - "SELECT DISTINCT(`album`) AS `albume` FROM `photo` WHERE `uid` = ? AND NOT `photo-type` IN (?, ?)", + "SELECT DISTINCT(`album`) AS `album` FROM `photo` WHERE `uid` = ? AND NOT `photo-type` IN (?, ?)", $uid, static::CONTACT_AVATAR, static::CONTACT_BANNER diff --git a/view/js/filebrowser.js b/view/js/filebrowser.js index 1b8a4d51f..a1ed09d24 100644 --- a/view/js/filebrowser.js +++ b/view/js/filebrowser.js @@ -60,11 +60,11 @@ const FileBrowser = { init: function (nickname, type) { FileBrowser.nickname = nickname; FileBrowser.type = type; - FileBrowser.event = "fbrowser." + type; - if (location['hash'] !== "") { + FileBrowser.event = 'fbrowser.' + type; + if (location['hash'] !== '') { const h = location['hash'].replace('#', ''); - FileBrowser.event = FileBrowser.event + "." + h.split("-")[0]; - FileBrowser.id = h.split("-")[1]; + FileBrowser.event = FileBrowser.event + '.' + h.split('-')[0]; + FileBrowser.id = h.split('-')[1]; } console.log('FileBrowser:', nickname, type, FileBrowser.event, FileBrowser.id); diff --git a/view/js/main.js b/view/js/main.js index 3ba8240fe..782eb4ec5 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -166,7 +166,7 @@ $(function() { /* event from comment textarea button popups */ /* insert returned bbcode at cursor position or replace selected text */ - $("body").on("fbrowser.photos.comment", function(e, filename, bbcode, id) { + $('body').on('fbrowser.photos.comment', function(e, filename, bbcode, id) { $.colorbox.close(); var textarea = document.getElementById("comment-edit-text-" +id); var start = textarea.selectionStart; @@ -1069,7 +1069,7 @@ var Dialog = { * to the event handler */ doImageBrowser : function (name, id) { - var url = Dialog._get_url("photos",name,id); + var url = Dialog._get_url('photos', name, id); return Dialog.show(url); }, @@ -1086,7 +1086,7 @@ var Dialog = { * to the event handler */ doFileBrowser : function (name, id) { - var url = Dialog._get_url("attachment",name,id); + var url = Dialog._get_url('attachment', name, id); return Dialog.show(url); }, diff --git a/view/theme/frio/js/filebrowser.js b/view/theme/frio/js/filebrowser.js index d7217fdbc..b8e508645 100644 --- a/view/theme/frio/js/filebrowser.js +++ b/view/theme/frio/js/filebrowser.js @@ -113,7 +113,6 @@ var FileBrowser = { embed = '[url=' + this.dataset.link + '][img=' + this.dataset.img + ']' + this.dataset.alt + '[/img][/url]'; } if (FileBrowser.type === 'attachment') { - // attachment links are "baseurl/attach/id"; we need id embed = '[attachment]' + this.dataset.link + '[/attachment]'; } diff --git a/view/theme/frio/js/modal.js b/view/theme/frio/js/modal.js index 5e21a0b0b..d54bd40c9 100644 --- a/view/theme/frio/js/modal.js +++ b/view/theme/frio/js/modal.js @@ -132,7 +132,7 @@ Dialog.show = function (url, title) { Dialog._get_url = function (type, name, id) { var hash = name; if (id !== undefined) hash = hash + "-" + id; - return "profile/" + localNickname + "/" + type + "/browser?mode=none&theme=frio#" + hash; + return 'profile/' + localNickname + '/' + type + '/browser?mode=none&theme=frio#' + hash; }; // Does load the filebrowser into the jot modal.