menu: Open help page of current active server.

* menu: Open help page of the currently active server.

Fixes: #758.
This commit is contained in:
Akash Nimare
2019-06-21 01:02:48 +05:30
committed by GitHub
parent db4e8e5129
commit 02c8a27567
2 changed files with 16 additions and 4 deletions

View File

@@ -195,8 +195,10 @@ class AppMenu {
},
{
label: `Help Center`,
click() {
shell.openExternal('https://zulipchat.com/help/');
click(focusedWindow) {
if (focusedWindow) {
AppMenu.sendAction('open-help');
}
}
}, {
label: 'Report an Issue',

View File

@@ -1,6 +1,6 @@
'use strict';
const { ipcRenderer, remote, clipboard } = require('electron');
const { ipcRenderer, remote, clipboard, shell } = require('electron');
const isDev = require('electron-is-dev');
const { session, app, Menu, dialog } = remote;
@@ -269,6 +269,10 @@ class ServerManagerView {
return currentIndex;
}
getCurrentActiveServer() {
return this.tabs[this.activeTabIndex].webview.props.url;
}
displayInitialCharLogo($img, index) {
/*
index parameter needed because webview[data-tab-id] can increment
@@ -623,6 +627,12 @@ class ServerManagerView {
ipcRenderer.on('open-about', this.openAbout.bind(this));
ipcRenderer.on('open-help', () => {
// Open help page of current active server
const helpPage = this.getCurrentActiveServer() + '/help';
shell.openExternal(helpPage);
});
ipcRenderer.on('reload-viewer', this.reloadView.bind(this, this.tabs[this.activeTabIndex].props.index));
ipcRenderer.on('reload-current-viewer', this.reloadCurrentView.bind(this));
@@ -786,7 +796,7 @@ class ServerManagerView {
});
ipcRenderer.on('copy-zulip-url', () => {
clipboard.writeText(DomainUtil.getDomain(this.activeTabIndex).url);
clipboard.writeText(this.getCurrentActiveServer());
});
ipcRenderer.on('new-server', () => {