[MM-50042] Detect Boards using the BuildBoards flag in the client config (#2535)

This commit is contained in:
Devin Binnie
2023-02-02 11:31:11 -05:00
committed by GitHub
parent db5a2e055d
commit 61a0b41d47
4 changed files with 10 additions and 2 deletions

View File

@@ -23,6 +23,9 @@ jest.mock('electron', () => ({
if (event === 'data') {
responseCallback(url === badDataURL ? '98&H09986t&(*6BV789RhN^t97rb6Ev^*e5v89 re5bg^&' : JSON.stringify(testData));
}
if (event === 'end') {
responseCallback();
}
}),
statusCode: (url === validURL || url === badDataURL) ? 200 : 404,
});

View File

@@ -38,9 +38,12 @@ export async function getServerAPI<T>(url: URL, isAuthenticated: boolean, onSucc
req.on('response', (response: Electron.IncomingMessage) => {
log.silly('getServerAPI.response', response);
if (response.statusCode === 200) {
let raw = '';
response.on('data', (chunk: Buffer) => {
log.silly('getServerAPI.response.data', `${chunk}`);
const raw = `${chunk}`;
raw += `${chunk}`;
});
response.on('end', () => {
try {
const data = JSON.parse(raw) as T;
onSuccess(data);

View File

@@ -44,12 +44,13 @@ export class ServerInfo {
onGetConfig = (data: ClientConfig) => {
this.remoteInfo.serverVersion = data.Version;
this.remoteInfo.siteURL = data.SiteURL;
this.remoteInfo.hasFocalboard = this.remoteInfo.hasFocalboard || data.BuildBoards === 'true';
this.trySendRemoteInfo();
}
onGetPlugins = (data: Array<{id: string; version: string}>) => {
this.remoteInfo.hasFocalboard = data.some((plugin) => plugin.id === 'focalboard');
this.remoteInfo.hasFocalboard = this.remoteInfo.hasFocalboard || data.some((plugin) => plugin.id === 'focalboard');
this.remoteInfo.hasPlaybooks = data.some((plugin) => plugin.id === 'playbooks');
this.trySendRemoteInfo();

View File

@@ -12,4 +12,5 @@ export type RemoteInfo = {
export type ClientConfig = {
Version: string;
SiteURL: string;
BuildBoards: string;
}