Skip to content

Commit

Permalink
relocate some of wizard info to register (#14884)
Browse files Browse the repository at this point in the history
  • Loading branch information
geekgonecrazy authored and ggazzo committed Jul 19, 2019
1 parent 422669f commit 7db9982
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
26 changes: 21 additions & 5 deletions app/cloud/server/functions/startRegisterWorkspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { HTTP } from 'meteor/http';
import { retrieveRegistrationStatus } from './retrieveRegistrationStatus';
import { syncWorkspace } from './syncWorkspace';
import { settings } from '../../../settings';
import { Settings } from '../../../models';
import { Settings, Users } from '../../../models';
import { statistics } from '../../../statistics';


Expand All @@ -25,18 +25,34 @@ export function startRegisterWorkspace(resend = false) {
const stats = statistics.get();

const address = settings.get('Site_Url');
const siteName = settings.get('Site_Name');

// If we have it lets send it because likely an update
const workspaceId = settings.get('Cloud_Workspace_Id');

const firstUser = Users.getOldest({ name: 1, emails: 1 });
const contactName = firstUser && firstUser.name;
let contactEmail = firstUser && firstUser.emails && firstUser.emails[0].address;

if (settings.get('Organization_Email')) {
contactEmail = settings.get('Organization_Email');
}

const allowMarketing = settings.get('Allow_Marketing_Emails');

const accountName = settings.get('Organization_Name');
const website = settings.get('Website');

const regInfo = {
uniqueId: stats.uniqueId,
workspaceId,
address,
contactName: stats.wizard.contactName,
contactEmail: stats.wizard.contactEmail,
accountName: stats.wizard.organizationName,
siteName: stats.wizard.siteName,
contactName,
contactEmail,
allowMarketing,
accountName,
website,
siteName,
deploymentMethod: stats.deploy.method,
deploymentPlatform: stats.deploy.platform,
version: stats.version,
Expand Down
6 changes: 2 additions & 4 deletions app/cloud/server/functions/syncWorkspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ export function syncWorkspace(reconnectCheck = false) {
const stats = statistics.get();

const address = settings.get('Site_Url');
const siteName = settings.get('Site_Name');

const info = {
uniqueId: stats.uniqueId,
address,
contactName: stats.wizard.contactName,
contactEmail: stats.wizard.contactEmail,
accountName: stats.wizard.organizationName,
siteName: stats.wizard.siteName,
siteName,
deploymentMethod: stats.deploy.method,
deploymentPlatform: stats.deploy.platform,
version: stats.version,
Expand Down
12 changes: 0 additions & 12 deletions app/statistics/server/functions/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@ import { getStatistics as federationGetStatistics } from '../../../federation/se

const wizardFields = [
'Organization_Type',
'Organization_Name',
'Industry',
'Size',
'Country',
'Website',
'Site_Name',
'Language',
'Server_Type',
'Allow_Marketing_Emails',
'Register_Server',
];

Expand All @@ -47,14 +43,6 @@ statistics.get = function _getStatistics() {
}
});

const firstUser = Users.getOldest({ name: 1, emails: 1 });
statistics.wizard.contactName = firstUser && firstUser.name;
statistics.wizard.contactEmail = firstUser && firstUser.emails && firstUser.emails[0].address;

if (settings.get('Organization_Email')) {
statistics.wizard.contactEmail = settings.get('Organization_Email');
}

// Version
statistics.uniqueId = settings.get('uniqueID');
if (Settings.findOne('uniqueID')) {
Expand Down

0 comments on commit 7db9982

Please sign in to comment.