aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar mhatvan <markus_hatvan@aon.at>2021-07-06 10:25:39 +0200
committerLibravatar Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com>2021-07-06 15:36:56 +0530
commit9e96fb2366d8638b16a80feb3ec665e899e0c448 (patch)
tree74260a17195346f27f60a334cf0c6e3c5ffe1c4a
parentMinify svg's using svgo (diff)
downloadferdium-recipes-9e96fb2366d8638b16a80feb3ec665e899e0c448.tar.gz
ferdium-recipes-9e96fb2366d8638b16a80feb3ec665e899e0c448.tar.zst
ferdium-recipes-9e96fb2366d8638b16a80feb3ec665e899e0c448.zip
fix: Rocket.Chat tab doesn't display notifications
- bump Rocket.Chat version to v1.0.10 - fix Rocket.Chat direct and indirect messages count
-rw-r--r--all.json2
-rw-r--r--recipes/rocketchat/package.json2
-rw-r--r--recipes/rocketchat/webview.js36
3 files changed, 25 insertions, 15 deletions
diff --git a/all.json b/all.json
index 0a1c9ee..7cc4ac7 100644
--- a/all.json
+++ b/all.json
@@ -1264,7 +1264,7 @@
1264 "featured": false, 1264 "featured": false,
1265 "id": "rocketchat", 1265 "id": "rocketchat",
1266 "name": "Rocket.Chat", 1266 "name": "Rocket.Chat",
1267 "version": "1.0.9", 1267 "version": "1.0.10",
1268 "icons": { 1268 "icons": {
1269 "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/rocketchat/icon.svg" 1269 "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/rocketchat/icon.svg"
1270 } 1270 }
diff --git a/recipes/rocketchat/package.json b/recipes/rocketchat/package.json
index 122a74e..1ac9e9b 100644
--- a/recipes/rocketchat/package.json
+++ b/recipes/rocketchat/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "rocketchat", 2 "id": "rocketchat",
3 "name": "Rocket.Chat", 3 "name": "Rocket.Chat",
4 "version": "1.0.9", 4 "version": "1.0.10",
5 "description": "Rocket.Chat", 5 "description": "Rocket.Chat",
6 "main": "index.js", 6 "main": "index.js",
7 "author": "Stefan Malzner <stefan@adlk.io>", 7 "author": "Stefan Malzner <stefan@adlk.io>",
diff --git a/recipes/rocketchat/webview.js b/recipes/rocketchat/webview.js
index 5ccd0d2..447b19b 100644
--- a/recipes/rocketchat/webview.js
+++ b/recipes/rocketchat/webview.js
@@ -1,11 +1,8 @@
1"use strict"; 1'use strict';
2 2
3const { 3const { ipcRenderer } = require('electron');
4 ipcRenderer
5} = require('electron');
6 4
7const getTeamIcon = function getTeamIcon() { 5const getTeamIcon = function getTeamIcon() {
8 console.log('getTeamIcon');
9 const manifestElement = document.querySelector('link[rel="manifest"]'); 6 const manifestElement = document.querySelector('link[rel="manifest"]');
10 7
11 if (manifestElement == null) { 8 if (manifestElement == null) {
@@ -13,7 +10,6 @@ const getTeamIcon = function getTeamIcon() {
13 } 10 }
14 11
15 const manifestUrl = manifestElement.getAttribute('href'); 12 const manifestUrl = manifestElement.getAttribute('href');
16 console.log(manifestUrl);
17 13
18 if (manifestUrl == null) { 14 if (manifestUrl == null) {
19 return; 15 return;
@@ -29,7 +25,10 @@ const getTeamIcon = function getTeamIcon() {
29 const response = JSON.parse(this.responseText); 25 const response = JSON.parse(this.responseText);
30 26
31 if (response.icons.length >= 1) { 27 if (response.icons.length >= 1) {
32 ipcRenderer.sendToHost('avatar', `${window.location.protocol}//${window.location.host}${response.icons[0].src}`); 28 ipcRenderer.sendToHost(
29 'avatar',
30 `${window.location.protocol}//${window.location.host}${response.icons[0].src}`
31 );
33 } 32 }
34 }; 33 };
35 34
@@ -37,15 +36,26 @@ const getTeamIcon = function getTeamIcon() {
37 xmlhttp.send(); 36 xmlhttp.send();
38}; 37};
39 38
40module.exports = Franz => { 39module.exports = Ferdi => {
41 const getMessages = function getMessages() { 40 const getMessages = function getMessages() {
42 const directMessages = Math.round(document.querySelectorAll('.unread.unread-mention, .badge--unread').length / 2); 41 const directMessages = document.querySelectorAll('.rcx-badge');
43 const indirectMessages = Math.round(document.querySelectorAll('.unread:not(.unread-mention), .sidebar-item--unread').length / 2); 42
44 Franz.setBadge(directMessages, indirectMessages); 43 let directMessagesCount = 0;
44
45 for (const directMessage of directMessages) {
46 directMessagesCount += parseInt(directMessage.textContent, 10);
47 }
48
49 const indirectMessagesCount = Math.round(
50 document.querySelectorAll('.rcx-sidebar-item--highlighted').length
51 );
52
53 Ferdi.setBadge(directMessagesCount, indirectMessagesCount);
45 }; 54 };
46 55
47 Franz.loop(getMessages); 56 Ferdi.loop(getMessages);
57
48 setTimeout(() => { 58 setTimeout(() => {
49 getTeamIcon(); 59 getTeamIcon();
50 }, 4000); 60 }, 4000);
51}; \ No newline at end of file 61};