diff options
author | 2021-08-31 16:25:57 +0530 | |
---|---|---|
committer | 2021-08-31 16:25:57 +0530 | |
commit | dfae2d231e39c81827d08fd8834d736c5b3005b1 (patch) | |
tree | 5037b401e7de837fdd6046a3c61ac76aed240e6e /recipes/wire | |
parent | New recipe: odoo (diff) | |
download | ferdium-recipes-dfae2d231e39c81827d08fd8834d736c5b3005b1.tar.gz ferdium-recipes-dfae2d231e39c81827d08fd8834d736c5b3005b1.tar.zst ferdium-recipes-dfae2d231e39c81827d08fd8834d736c5b3005b1.zip |
refactor: Use Ferdi.safeParseInt to ensure that parsing is done consistently in all recipes.
Diffstat (limited to 'recipes/wire')
-rw-r--r-- | recipes/wire/package.json | 2 | ||||
-rw-r--r-- | recipes/wire/webview.js | 9 |
2 files changed, 4 insertions, 7 deletions
diff --git a/recipes/wire/package.json b/recipes/wire/package.json index fdd8616..4a85ade 100644 --- a/recipes/wire/package.json +++ b/recipes/wire/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "wire", | 2 | "id": "wire", |
3 | "name": "Wire", | 3 | "name": "Wire", |
4 | "version": "1.0.2", | 4 | "version": "1.0.3", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://app.wire.com/", | 7 | "serviceURL": "https://app.wire.com/", |
diff --git a/recipes/wire/webview.js b/recipes/wire/webview.js index efd37f3..b099eee 100644 --- a/recipes/wire/webview.js +++ b/recipes/wire/webview.js | |||
@@ -7,10 +7,7 @@ module.exports = (Ferdi) => { | |||
7 | const conversationElems = document.querySelectorAll('[data-uie-name="conversation-folder-badge"]'); | 7 | const conversationElems = document.querySelectorAll('[data-uie-name="conversation-folder-badge"]'); |
8 | if (conversationElems) { | 8 | if (conversationElems) { |
9 | for (const conversationElem of conversationElems) { | 9 | for (const conversationElem of conversationElems) { |
10 | const count = parseInt(conversationElem.innerText); | 10 | direct += Ferdi.safeParseInt(conversationElem.innerText); |
11 | if (count) { | ||
12 | direct += count; | ||
13 | } | ||
14 | } | 11 | } |
15 | } | 12 | } |
16 | 13 | ||
@@ -18,8 +15,8 @@ module.exports = (Ferdi) => { | |||
18 | const pendingElem = document.querySelector('[data-uie-name="item-pending-requests"]'); | 15 | const pendingElem = document.querySelector('[data-uie-name="item-pending-requests"]'); |
19 | if (pendingElem) { | 16 | if (pendingElem) { |
20 | const matches = pendingElem.innerText.match(/^([1-9][0-9]*)/); | 17 | const matches = pendingElem.innerText.match(/^([1-9][0-9]*)/); |
21 | if (matches && matches.length > 0) { | 18 | if (matches && matches.length > 1) { |
22 | indirect += parseInt(matches[1]); | 19 | indirect += Ferdi.safeParseInt(matches[1]); |
23 | } | 20 | } |
24 | } | 21 | } |
25 | 22 | ||