From 380316e9ade52b3e3e036d039171f6248046c4ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Sun, 9 Jul 2023 16:34:08 +0200 Subject: [PATCH 1/2] Revert "Bump version to 0.11.0" This reverts commit 6596b480431f63f412fb9c1518a00c4d03888d70. --- .gitignore | 2 -- package-lock.json | 4 ++-- package.json | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- src/index.html | 2 +- src/manifest.json | 2 +- src/manifest.webapp | 2 +- 9 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 9ac9597..2bc2a02 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,3 @@ build/ # IntelliJ / WebStorm .idea/ - -src-tauri/target diff --git a/package-lock.json b/package-lock.json index eaf068e..a27f8e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "glowing-bear", - "version": "0.11.0", + "version": "0.10.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "glowing-bear", - "version": "0.11.0", + "version": "0.10.0", "license": "GPLv3", "dependencies": { "angular": "^1.8.3", diff --git a/package.json b/package.json index 1a8332c..83b3bed 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "glowing-bear", "private": true, - "version": "0.11.0", + "version": "0.10.0", "description": "A web client for Weechat", "repository": "https://github.com/glowing-bear/glowing-bear", "license": "GPLv3", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 491fd04..f680289 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -991,7 +991,7 @@ dependencies = [ [[package]] name = "glowing-bear" -version = "0.11.0" +version = "0.10.0" dependencies = [ "serde", "serde_json", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 1626b0e..8873878 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "glowing-bear" -version = "0.11.0" #sync to ../package.json +version = "0.10.0" #sync to ../package.json description = "A web client for WeeChat" authors = ["glowing-bear-contributors"] license = "GPL-3.0" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 57a4ff6..559702c 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "glowing-bear", - "version": "0.11.0" + "version": "0.10.0" }, "tauri": { "allowlist": { diff --git a/src/index.html b/src/index.html index 2bfa14a..1ba8437 100644 --- a/src/index.html +++ b/src/index.html @@ -432,7 +432,7 @@ chown -R username:username ~username diff --git a/src/manifest.json b/src/manifest.json index f651645..c7dc41e 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,7 +1,7 @@ { "name": "Glowing Bear", "description": "WeeChat Web frontend", - "version": "0.11.0", + "version": "0.10.0", "manifest_version": 2, "icons": { "32": "assets/img/favicon.png", diff --git a/src/manifest.webapp b/src/manifest.webapp index 5d26c1e..246406a 100644 --- a/src/manifest.webapp +++ b/src/manifest.webapp @@ -25,5 +25,5 @@ "desktop-notification":{} }, "default_locale": "en", - "version": "0.11.0" + "version": "0.10.0" } From b6ca906192f7e135bb70a18d80ab490f0ad4a117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Sun, 9 Jul 2023 16:31:32 +0200 Subject: [PATCH 2/2] Follow-up to #1244: underscore cleanup --- src/js/glowingbear.js | 5 +---- src/js/inputbar.js | 2 +- src/js/irc-utils.js | 15 +-------------- src/js/misc.js | 5 +++++ src/js/models.js | 17 +++++++---------- 5 files changed, 15 insertions(+), 29 deletions(-) create mode 100644 src/js/misc.js diff --git a/src/js/glowingbear.js b/src/js/glowingbear.js index f9eaf9e..3af6701 100644 --- a/src/js/glowingbear.js +++ b/src/js/glowingbear.js @@ -4,6 +4,7 @@ import * as Favico from "favico.js"; import { connectionFactory } from './connection'; +import { sortBy } from './misc'; /* debounce helper so we dont have to use underscore.js */ const debounce = function (func, wait, immediate) { @@ -19,10 +20,6 @@ const debounce = function (func, wait, immediate) { }; }; -const sortBy = (key) => { - return (a, b) => (a[key] > b[key]) ? 1 : ((b[key] > a[key]) ? -1 : 0); -}; - var weechat = angular.module('weechat', ['ngRoute', 'localStorage', 'weechatModels', 'bufferResume', 'plugins', 'IrcUtils', 'ngSanitize', 'ngWebsockets', 'ngTouch'], ['$compileProvider', function($compileProvider) { // hacky way to be able to find out if we're in debug mode weechat.compileProvider = $compileProvider; diff --git a/src/js/inputbar.js b/src/js/inputbar.js index 29f43d4..f6ba2b4 100644 --- a/src/js/inputbar.js +++ b/src/js/inputbar.js @@ -104,7 +104,7 @@ weechat.directive('inputBar', function() { var completion_suffix = models.wconfig['weechat.completion.nick_completer']; var add_space = models.wconfig['weechat.completion.nick_add_space']; var nickComp = IrcUtils.completeNick(input, caretPos, $scope.iterCandidate, - activeBuffer.getNicklistByTime(), + activeBuffer.getNicklistByTime().reverse(), completion_suffix, add_space); // remember iteration candidate diff --git a/src/js/irc-utils.js b/src/js/irc-utils.js index d3e0ae6..9199b9e 100644 --- a/src/js/irc-utils.js +++ b/src/js/irc-utils.js @@ -16,19 +16,6 @@ IrcUtils.service('IrcUtils', [function() { return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); }; - /** - * Get a new version of a nick list - * - * @param nickList Original nick list - * @return list of nick names - */ - var _ciNickList = function(nickList) { - - let newList = nickList.map((el) => el.name); - - return newList; - }; - /** * Completes a single nick. * @@ -118,7 +105,7 @@ IrcUtils.service('IrcUtils', [function() { var addSpaceChar = (addSpace === undefined || addSpace === 'on') ? ' ' : ''; // new nick list to search in - var searchNickList = _ciNickList(nickList); + var searchNickList = nickList.map((el) => el.name); // text before and after caret var beforeCaret = text.substring(0, caretPos); diff --git a/src/js/misc.js b/src/js/misc.js new file mode 100644 index 0000000..9894874 --- /dev/null +++ b/src/js/misc.js @@ -0,0 +1,5 @@ +'use strict'; + +export const sortBy = (key) => { + return (a, b) => (a[key] > b[key]) ? 1 : ((b[key] > a[key]) ? -1 : 0); +} diff --git a/src/js/models.js b/src/js/models.js index 49b2e5e..c099616 100644 --- a/src/js/models.js +++ b/src/js/models.js @@ -7,6 +7,7 @@ import * as weeChat from './weechat'; +import { sortBy } from './misc'; var models = angular.module('weechatModels', []); @@ -219,9 +220,10 @@ models.service('models', ['$rootScope', '$filter', 'bufferResume', function($roo } for (let groupIdx in nicklist) { let nicks = nicklist[groupIdx].nicks; - for (let nickIdx in nicks) { - if (nicks[nickIdx].name === nick) { - nicks[nickIdx].spokeAt = Date.now(); + for (let curr_nick of nicks) { + if (curr_nick.name === nick) { + curr_nick.spokeAt = Date.now(); + return; } } } @@ -235,15 +237,10 @@ models.service('models', ['$rootScope', '$filter', 'bufferResume', function($roo var getNicklistByTime = function() { var newlist = []; for (let groupIdx in nicklist) { - let nicks = nicklist[groupIdx].nicks; - for (let nickIdx in nicks) { - newlist.push(nicks[nickIdx]); - } + newlist = newlist.concat(nicklist[groupIdx].nicks); } - newlist.sort(function(a, b) { - return a.spokeAt < b.spokeAt; - }); + newlist.sort(sortBy('spokeAt')); return newlist; };