Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve: relocate some of wizard info to register #14884

Merged
merged 3 commits into from
Jul 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -21,15 +21,11 @@ import { statistics } from '../statisticsNamespace';

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

Expand All @@ -46,14 +42,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