[extensions-web/bugfix/v40-frontend-versionscheme: 2/2] js: extensionUtils: tune grabProperExtensionVersion logic




commit 3955a1ae33899e94ebe147b4400735f8fb7ccca7
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Mon Mar 1 22:20:48 2021 +0400

    js: extensionUtils: tune grabProperExtensionVersion logic
    
    Looks like this is still desynced with backend, however I will not touch
    it until new frontend/backend pair will go live with all things fixed at
    once

 sweettooth/static/js/extensionUtils.js  | 8 ++++++--
 sweettooth/static/js/test/extensions.js | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/sweettooth/static/js/extensionUtils.js b/sweettooth/static/js/extensionUtils.js
index 2e97dbb9..99a7757d 100644
--- a/sweettooth/static/js/extensionUtils.js
+++ b/sweettooth/static/js/extensionUtils.js
@@ -115,13 +115,17 @@ define([], function () {
                let point = parts[2];
 
                let mappedVersion = null;
-               if (major >= 40 || (major < 40 && minor % 2 === 0))
+               if (major >= 40)
                {
                        mappedVersion = map[`${major}.${minor}`]
                }
                else
                {
-                       mappedVersion = map[`${major}.${minor}.${point}`]
+                       mappedVersion = map[`${major}.${minor}.${point}`];
+                       if (minor % 2 === 0 && !mappedVersion)
+                       {
+                               mappedVersion = map[`${major}.${minor}`];
+                       }
                }
 
                if(mappedVersion) {
diff --git a/sweettooth/static/js/test/extensions.js b/sweettooth/static/js/test/extensions.js
index 35fb4e62..871cbc2a 100644
--- a/sweettooth/static/js/test/extensions.js
+++ b/sweettooth/static/js/test/extensions.js
@@ -14,7 +14,7 @@ require(['extensionUtils', 'jquery', 'test/qunit'], function(extensionUtils) {
         equal(grabProperExtensionVersion(map, "3.0.0").version, 1);
         equal(grabProperExtensionVersion(map, "3.0.1").version, 2);
         equal(grabProperExtensionVersion(map, "3.2.0").version, 4);
-        equal(grabProperExtensionVersion(map, "3.2.1").version, 4);
+        equal(grabProperExtensionVersion(map, "3.2.1").version, 3);
         equal(grabProperExtensionVersion(map, "3.3.0"), null, "stable release checking");
         equal(grabProperExtensionVersion(map, "3.3.1").version, 6);
         equal(grabProperExtensionVersion(map, "3.4.1.1").version, 7);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]