Skip to content

Commit 7c4c80f

Browse files
authored
COMPASS-2189: Dont have intercom in community (#1267)
* COMPASS-2189: Dont have intercom in community * Fix main tests
1 parent 523dd44 commit 7c4c80f

File tree

5 files changed

+48
-18
lines changed

5 files changed

+48
-18
lines changed

src/app/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,11 @@ var Application = View.extend({
324324
prefs.lastKnownVersion = currentVersion;
325325
save = true;
326326
}
327+
if (DISTRIBUTION.name === COMMUNITY) {
328+
prefs.enableMaps = false;
329+
prefs.enableFeedbackPanel = false;
330+
save = true;
331+
}
327332
if (save) {
328333
prefs.save(null, {
329334
success: done.bind(null, null)

src/app/network-optin/index.jade

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,18 @@
77
p To enhance the user experience, Compass can integrate with 3rd party services, which requires external network requests. Please choose from the settings below:
88
form
99
ul
10-
li
11-
label
12-
input(type='checkbox', name='enableFeedbackPanel', data-hook='product-feedback-checkbox', data-test-id='product-feedback-checkbox')
13-
span Enable Product Feedback Tool
14-
p.option-description Enables a tool for sending feedback or talking to our Product and Development teams directly from Compass.
10+
if !isCommunity
11+
li
12+
label
13+
input(type='checkbox', name='enableFeedbackPanel', data-hook='product-feedback-checkbox', data-test-id='product-feedback-checkbox')
14+
span Enable Product Feedback Tool
15+
p.option-description Enables a tool for sending feedback or talking to our Product and Development teams directly from Compass.
1516

16-
li
17-
label
18-
input(type='checkbox', name='enableMaps', data-hook='enable-maps-checkbox', data-test-id='enable-maps-checkbox')
19-
span Enable Geographic Visualizations
20-
p.option-description Allow Compass to make requests to a 3rd party mapping service.
17+
li
18+
label
19+
input(type='checkbox', name='enableMaps', data-hook='enable-maps-checkbox', data-test-id='enable-maps-checkbox')
20+
span Enable Geographic Visualizations
21+
p.option-description Allow Compass to make requests to a 3rd party mapping service.
2122

2223
li
2324
label

src/app/network-optin/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ var debug = require('debug')('mongodb-compass:network-optin:index');
77

88
var indexTemplate = require('./index.jade');
99

10+
const pkg = require('../../../package.json');
11+
const COMMUNITY = 'mongodb-compass-community';
12+
const DISTRIBUTION = pkg.config.hadron.distributions[process.env.HADRON_DISTRIBUTION];
13+
1014
var NetworkOptInView = View.extend({
1115
template: indexTemplate,
1216
props: {
@@ -22,6 +26,11 @@ var NetworkOptInView = View.extend({
2226
type: 'string',
2327
required: true,
2428
default: 'Start using Compass'
29+
},
30+
isCommunity: {
31+
type: 'boolean',
32+
required: true,
33+
default: DISTRIBUTION.name === COMMUNITY
2534
}
2635
},
2736
events: {

src/internal-plugins/metrics/lib/setup.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const ICON_PATH = path.join(__dirname, '..', 'images', 'compass-dialog-icon.png'
1414

1515
const debug = require('debug')('mongodb-compass:metrics:setup');
1616

17+
const COMMUNITY = 'mongodb-compass-community';
18+
const DISTRIBUTION = pkg.config.hadron.distributions[process.env.HADRON_DISTRIBUTION];
1719

1820
const INTERCOM_KEY = 'p57suhg7';
1921
const BUGSNAG_KEY = '0d11ab5f4d97452cc83d3365c21b491c';
@@ -24,11 +26,6 @@ module.exports = function() {
2426
appId: 'compass-metrics-irinb',
2527
enabled: true
2628
},
27-
intercom: {
28-
appId: INTERCOM_KEY,
29-
enabled: app.preferences.trackUsageStatistics,
30-
panelEnabled: app.preferences.enableFeedbackPanel
31-
},
3229
bugsnag: {
3330
apiKey: BUGSNAG_KEY,
3431
metaData: {
@@ -41,6 +38,16 @@ module.exports = function() {
4138
}
4239
});
4340

41+
if (DISTRIBUTION.name !== COMMUNITY) {
42+
metrics.configure({
43+
intercom: {
44+
appId: INTERCOM_KEY,
45+
enabled: app.preferences.trackUsageStatistics,
46+
panelEnabled: app.preferences.enableFeedbackPanel
47+
}
48+
});
49+
}
50+
4451
// create an app resource with name and version
4552
const appResource = new resources.AppResource({
4653
appName: pkg.productName,
@@ -136,7 +143,9 @@ module.exports = function() {
136143
* such that when a link is clicked, the event is properly
137144
* passed off to `app.router` and a web page actually opens.
138145
*/
139-
intercom.configure();
146+
if (DISTRIBUTION.name !== COMMUNITY) {
147+
intercom.configure();
148+
}
140149

141150
app.metrics = metrics;
142151
};

src/main/menu.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@ var ipc = require('hadron-ipc');
66
var BrowserWindow = electron.BrowserWindow;
77
var Menu = electron.Menu;
88
var app = electron.app;
9+
var pkg = require('../../package.json');
910

1011
var State = require('ampersand-state');
1112
var _ = require('lodash');
1213
var debug = require('debug')('mongodb-compass:menu');
1314

1415
const COMPASS_HELP = 'https://docs.mongodb.com/compass/';
16+
const COMMUNITY = 'mongodb-compass-community';
17+
const DISTRIBUTION = pkg.config.hadron.distributions[process.env.HADRON_DISTRIBUTION];
1518

1619
// submenu related
1720
function separator() {
@@ -185,8 +188,11 @@ function helpSubMenu() {
185188
subMenu.push(networkOptInDialogItem());
186189
subMenu.push(securityItem());
187190

188-
subMenu.push(separator());
189-
subMenu.push(intercomItem());
191+
192+
if (!DISTRIBUTION || (DISTRIBUTION.name !== COMMUNITY)) {
193+
subMenu.push(separator());
194+
subMenu.push(intercomItem());
195+
}
190196

191197
if (process.platform !== 'darwin') {
192198
subMenu.push(separator());

0 commit comments

Comments
 (0)