Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Fix IconLoader to properly set title. No more duplicate icons (rambox…
Browse files Browse the repository at this point in the history
… bug).

Fixes #225 again.
  • Loading branch information
TheGoddessInari committed Jan 27, 2021
1 parent 9a61bef commit 3bad65c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions app/util/IconLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ Ext.define('Hamsket.util.IconLoader', {
this.loadServiceIconUrl = function (service, webview) {
switch (service.type) {
case 'slack':
setTimeout( () =>
webview.executeJavaScript(
setTimeout( () => {
const service_name = Ext.String.htmlEncode(service.record.get('name'));
webview.executeJavaScript(
`(() => {
let icon = document.querySelector('.c-team_icon');
if (!icon) {
Expand All @@ -39,12 +40,14 @@ Ext.define('Hamsket.util.IconLoader', {
return bg.slice(5, -2);
})();`).then(function (backgroundImage) {
if (backgroundImage) {
service.setTitle(`<img src="${backgroundImage}" width="" style="background-color: white;border-radius: 50%;position: absolute;left: 18px;top: 17px;width: 12px;">${Ext.String.htmlEncode(service.title)}`);
service.setTitle(`<img src="${backgroundImage}" width="" style="background-color: white;border-radius: 50%;position: absolute;left: 18px;top: 17px;width: 12px;">${service_name}`);
service.fireEvent('iconchange', service, backgroundImage, service.icon);
}
return true;
}
).finally({}), 1000);
).catch(err => {
console.error(`Slack IconLoader - ${service_name}: ${err}`);
});}, 1000);
break;
default:
break;
Expand Down

1 comment on commit 3bad65c

@flying-sheep
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please release this? Would be much appreciated!

Please sign in to comment.