Skip to content
Code-Schnipsel Gruppen Projekte
Commit 7a66d570 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

Merge branch 'next-2.x' into 'main'

fix: update variable declarations and cache handling

See merge request !113
Übergeordnete 8ffb7d18 a8ecb4a0
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
2 Merge Requests!114Update 'next-3.x' with latest changes from 'main',!113fix: update variable declarations and cache handling
Pipeline-Nr. 16137 mit Warnungen bestanden
...@@ -84,19 +84,19 @@ define('package/quiqqer/products/bin/classes/Products', [ ...@@ -84,19 +84,19 @@ define('package/quiqqer/products/bin/classes/Products', [
*/ */
openProduct: function (productId) { openProduct: function (productId) {
return this.getChild(productId).then(function (attributes) { return this.getChild(productId).then(function (attributes) {
var panel = attributes.typePanel; let panel = attributes.typePanel;
if (panel === '' || typeof panel === 'undefined') { if (panel === '' || typeof panel === 'undefined') {
panel = 'package/quiqqer/products/bin/controls/products/Product'; panel = 'package/quiqqer/products/bin/controls/products/Product';
} }
return new Promise(function (resolve) { return new Promise(function (resolve) {
var needles = []; let needles = [];
needles.push(panel); needles.push(panel);
needles.push('utils/Panels'); needles.push('utils/Panels');
require(needles, function (Panel, Utils) { require(needles, function (Panel, Utils) {
var Control = new Panel({ const Control = new Panel({
productId: productId productId: productId
}); });
...@@ -175,7 +175,7 @@ define('package/quiqqer/products/bin/classes/Products', [ ...@@ -175,7 +175,7 @@ define('package/quiqqer/products/bin/classes/Products', [
} }
require(['Projects'], function (Projects) { require(['Projects'], function (Projects) {
var Project = Projects.get(result.project), const Project = Projects.get(result.project),
Media = Project.getMedia(); Media = Project.getMedia();
Media.get(result.id).then(resolve).catch(function () { Media.get(result.id).then(resolve).catch(function () {
...@@ -231,8 +231,13 @@ define('package/quiqqer/products/bin/classes/Products', [ ...@@ -231,8 +231,13 @@ define('package/quiqqer/products/bin/classes/Products', [
const jsonData = JSON.stringify({productId, fields}); const jsonData = JSON.stringify({productId, fields});
const key = btoa(String.fromCharCode(...new TextEncoder().encode(jsonData))).slice(0, 32); const key = btoa(String.fromCharCode(...new TextEncoder().encode(jsonData))).slice(0, 32);
let inAdministration = false;
if (typeof QUIQQER.inAdministration !== 'undefined' && QUIQQER.inAdministration) {
inAdministration = !!QUIQQER.inAdministration;
}
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
if (!forceCache && typeof requestCache[key] !== 'undefined') { if (!forceCache && typeof requestCache[key] !== 'undefined' && !inAdministration) {
// JSON.parse(JSON.stringify because JS reference usage // JSON.parse(JSON.stringify because JS reference usage
return resolve(JSON.parse(JSON.stringify(requestCache[key]))); return resolve(JSON.parse(JSON.stringify(requestCache[key])));
} }
...@@ -489,7 +494,7 @@ define('package/quiqqer/products/bin/classes/Products', [ ...@@ -489,7 +494,7 @@ define('package/quiqqer/products/bin/classes/Products', [
'package/quiqqer/products/bin/controls/products/Product', 'package/quiqqer/products/bin/controls/products/Product',
'utils/Panels' 'utils/Panels'
], function (ProductPanel, Panels) { ], function (ProductPanel, Panels) {
var PPanel = new ProductPanel({ const PPanel = new ProductPanel({
productId: productId, productId: productId,
'#id': productId '#id': productId
}); });
...@@ -504,7 +509,7 @@ define('package/quiqqer/products/bin/classes/Products', [ ...@@ -504,7 +509,7 @@ define('package/quiqqer/products/bin/classes/Products', [
* @param {number} pid * @param {number} pid
*/ */
addToVisited: function (pid) { addToVisited: function (pid) {
var visited = this.getVisitedProductIds(); let visited = this.getVisitedProductIds();
visited.push(pid); visited.push(pid);
visited = visited.unique(); visited = visited.unique();
...@@ -522,7 +527,7 @@ define('package/quiqqer/products/bin/classes/Products', [ ...@@ -522,7 +527,7 @@ define('package/quiqqer/products/bin/classes/Products', [
* @returns {Array} * @returns {Array}
*/ */
getVisitedProductIds: function () { getVisitedProductIds: function () {
var visited = QUI.Storage.get('quiqqer-products-visited'); let visited = QUI.Storage.get('quiqqer-products-visited');
if (!visited) { if (!visited) {
return []; return [];
......
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren