[MM-40573] Stop asterisk detection on versions newer than 5.28, force space for the others (#1931)
* [MM-40573] Stop asking detection on versions newer than 5.29, force space for the others * PR feedback and test fixes
This commit is contained in:
parent
c28b219362
commit
bd470459c2
|
@ -310,7 +310,7 @@ describe('main/views/MattermostView', () => {
|
|||
});
|
||||
|
||||
describe('updateMentionsFromTitle', () => {
|
||||
const mattermostView = new MattermostView(tabView, {}, {}, {});
|
||||
const mattermostView = new MattermostView(tabView, {remoteInfo: {serverVersion: '5.28.0'}}, {}, {});
|
||||
|
||||
it('should parse mentions from title', () => {
|
||||
mattermostView.updateMentionsFromTitle('(7) Mattermost');
|
||||
|
@ -321,5 +321,10 @@ describe('main/views/MattermostView', () => {
|
|||
mattermostView.updateMentionsFromTitle('* Mattermost');
|
||||
expect(appState.updateMentions).toHaveBeenCalledWith(mattermostView.tab.name, 0, true);
|
||||
});
|
||||
|
||||
it('should not parse unreads when title is on a channel with an asterisk before it', () => {
|
||||
mattermostView.updateMentionsFromTitle('*testChannel - Mattermost');
|
||||
expect(appState.updateMentions).toHaveBeenCalledWith(mattermostView.tab.name, 0, false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -326,13 +326,17 @@ export class MattermostView extends EventEmitter {
|
|||
}
|
||||
}
|
||||
|
||||
titleParser = /(\((\d+)\) )?(\*)?/g
|
||||
titleParser = /(\((\d+)\) )?(\* )?/g
|
||||
|
||||
handleTitleUpdate = (e: Event, title: string) => {
|
||||
this.updateMentionsFromTitle(title);
|
||||
}
|
||||
|
||||
updateMentionsFromTitle = (title: string) => {
|
||||
if (this.serverInfo.remoteInfo.serverVersion && Util.isVersionGreaterThanOrEqualTo(this.serverInfo.remoteInfo.serverVersion, '5.29.0')) {
|
||||
return;
|
||||
}
|
||||
|
||||
//const title = this.view.webContents.getTitle();
|
||||
const resultsIterator = title.matchAll(this.titleParser);
|
||||
const results = resultsIterator.next(); // we are only interested in the first set
|
||||
|
|
Loading…
Reference in a new issue