Merge pull request #1266 from glowing-bear/lorenz/underscore-cleanup

Revert version number increase & clean up underscore cleanup
This commit is contained in:
Lorenz Hübschle 2023-07-12 22:52:21 +02:00 committed by GitHub
commit 6cd59b76d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 24 additions and 40 deletions

2
.gitignore vendored
View File

@ -6,5 +6,3 @@ build/
# IntelliJ / WebStorm # IntelliJ / WebStorm
.idea/ .idea/
src-tauri/target

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "glowing-bear", "name": "glowing-bear",
"version": "0.11.0", "version": "0.10.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "glowing-bear", "name": "glowing-bear",
"version": "0.11.0", "version": "0.10.0",
"license": "GPLv3", "license": "GPLv3",
"dependencies": { "dependencies": {
"angular": "^1.8.3", "angular": "^1.8.3",

View File

@ -1,7 +1,7 @@
{ {
"name": "glowing-bear", "name": "glowing-bear",
"private": true, "private": true,
"version": "0.11.0", "version": "0.10.0",
"description": "A web client for Weechat", "description": "A web client for Weechat",
"repository": "https://github.com/glowing-bear/glowing-bear", "repository": "https://github.com/glowing-bear/glowing-bear",
"license": "GPLv3", "license": "GPLv3",

2
src-tauri/Cargo.lock generated
View File

@ -991,7 +991,7 @@ dependencies = [
[[package]] [[package]]
name = "glowing-bear" name = "glowing-bear"
version = "0.11.0" version = "0.10.0"
dependencies = [ dependencies = [
"serde", "serde",
"serde_json", "serde_json",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "glowing-bear" 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" description = "A web client for WeeChat"
authors = ["glowing-bear-contributors"] authors = ["glowing-bear-contributors"]
license = "GPL-3.0" license = "GPL-3.0"

View File

@ -8,7 +8,7 @@
}, },
"package": { "package": {
"productName": "glowing-bear", "productName": "glowing-bear",
"version": "0.11.0" "version": "0.10.0"
}, },
"tauri": { "tauri": {
"allowlist": { "allowlist": {

View File

@ -432,7 +432,7 @@ chown -R <strong>username</strong>:<strong>username</strong> ~<strong>username</
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" ng-click="closeModal($event)" aria-hidden="true">&times;</button> <button type="button" class="close" ng-click="closeModal($event)" aria-hidden="true">&times;</button>
<span class="pull-right version">Glowing Bear version 0.11.0</span> <span class="pull-right version">Glowing Bear version 0.10.0</span>
<h4 class="modal-title">Settings</h4> <h4 class="modal-title">Settings</h4>
<p>Settings will be stored in your browser.</p> <p>Settings will be stored in your browser.</p>
</div> </div>

View File

@ -4,6 +4,7 @@ import * as Favico from "favico.js";
import { connectionFactory } from './connection'; import { connectionFactory } from './connection';
import { sortBy } from './misc';
/* debounce helper so we dont have to use underscore.js */ /* debounce helper so we dont have to use underscore.js */
const debounce = function (func, wait, immediate) { 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) { 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 // hacky way to be able to find out if we're in debug mode
weechat.compileProvider = $compileProvider; weechat.compileProvider = $compileProvider;

View File

@ -104,7 +104,7 @@ weechat.directive('inputBar', function() {
var completion_suffix = models.wconfig['weechat.completion.nick_completer']; var completion_suffix = models.wconfig['weechat.completion.nick_completer'];
var add_space = models.wconfig['weechat.completion.nick_add_space']; var add_space = models.wconfig['weechat.completion.nick_add_space'];
var nickComp = IrcUtils.completeNick(input, caretPos, $scope.iterCandidate, var nickComp = IrcUtils.completeNick(input, caretPos, $scope.iterCandidate,
activeBuffer.getNicklistByTime(), activeBuffer.getNicklistByTime().reverse(),
completion_suffix, add_space); completion_suffix, add_space);
// remember iteration candidate // remember iteration candidate

View File

@ -16,19 +16,6 @@ IrcUtils.service('IrcUtils', [function() {
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); 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. * Completes a single nick.
* *
@ -118,7 +105,7 @@ IrcUtils.service('IrcUtils', [function() {
var addSpaceChar = (addSpace === undefined || addSpace === 'on') ? ' ' : ''; var addSpaceChar = (addSpace === undefined || addSpace === 'on') ? ' ' : '';
// new nick list to search in // new nick list to search in
var searchNickList = _ciNickList(nickList); var searchNickList = nickList.map((el) => el.name);
// text before and after caret // text before and after caret
var beforeCaret = text.substring(0, caretPos); var beforeCaret = text.substring(0, caretPos);

5
src/js/misc.js Normal file
View File

@ -0,0 +1,5 @@
'use strict';
export const sortBy = (key) => {
return (a, b) => (a[key] > b[key]) ? 1 : ((b[key] > a[key]) ? -1 : 0);
}

View File

@ -7,6 +7,7 @@
import * as weeChat from './weechat'; import * as weeChat from './weechat';
import { sortBy } from './misc';
var models = angular.module('weechatModels', []); var models = angular.module('weechatModels', []);
@ -219,9 +220,10 @@ models.service('models', ['$rootScope', '$filter', 'bufferResume', function($roo
} }
for (let groupIdx in nicklist) { for (let groupIdx in nicklist) {
let nicks = nicklist[groupIdx].nicks; let nicks = nicklist[groupIdx].nicks;
for (let nickIdx in nicks) { for (let curr_nick of nicks) {
if (nicks[nickIdx].name === nick) { if (curr_nick.name === nick) {
nicks[nickIdx].spokeAt = Date.now(); curr_nick.spokeAt = Date.now();
return;
} }
} }
} }
@ -235,15 +237,10 @@ models.service('models', ['$rootScope', '$filter', 'bufferResume', function($roo
var getNicklistByTime = function() { var getNicklistByTime = function() {
var newlist = []; var newlist = [];
for (let groupIdx in nicklist) { for (let groupIdx in nicklist) {
let nicks = nicklist[groupIdx].nicks; newlist = newlist.concat(nicklist[groupIdx].nicks);
for (let nickIdx in nicks) {
newlist.push(nicks[nickIdx]);
}
} }
newlist.sort(function(a, b) { newlist.sort(sortBy('spokeAt'));
return a.spokeAt < b.spokeAt;
});
return newlist; return newlist;
}; };

View File

@ -1,7 +1,7 @@
{ {
"name": "Glowing Bear", "name": "Glowing Bear",
"description": "WeeChat Web frontend", "description": "WeeChat Web frontend",
"version": "0.11.0", "version": "0.10.0",
"manifest_version": 2, "manifest_version": 2,
"icons": { "icons": {
"32": "assets/img/favicon.png", "32": "assets/img/favicon.png",

View File

@ -25,5 +25,5 @@
"desktop-notification":{} "desktop-notification":{}
}, },
"default_locale": "en", "default_locale": "en",
"version": "0.11.0" "version": "0.10.0"
} }