Skip to content
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
5 changes: 5 additions & 0 deletions apps/meteor/app/lib/server/startup/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ settingsRegistry.add('uniqueID', process.env.DEPLOYMENT_ID || Random.id(), {
public: true,
});

settingsRegistry.add('Initial_Channel_Created', false, {
type: 'boolean',
hidden: true,
});

// When you define a setting and want to add a description, you don't need to automatically define the i18nDescription
// if you add a node to the i18n.json with the same setting name but with `_Description` it will automatically work.

Expand Down
13 changes: 9 additions & 4 deletions apps/meteor/server/startup/initialData.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@ import { Settings } from '../../app/models/server/raw';
import { validateEmail } from '../../lib/emailValidator';

Meteor.startup(async function () {
if (settings.get('Show_Setup_Wizard') === 'pending' && !Rooms.findOneById('GENERAL')) {
Rooms.createWithIdTypeAndName('GENERAL', 'c', 'general', {
default: true,
});
if (!settings.get('Initial_Channel_Created')) {
const exists = Rooms.findOneById('GENERAL', { fields: { _id: 1 } });
if (!exists) {
Rooms.createWithIdTypeAndName('GENERAL', 'c', 'general', {
default: true,
});
}

Settings.updateValueById('Initial_Channel_Created', true);
}

if (!Users.findOneById('rocket.cat')) {
Expand Down
1 change: 1 addition & 0 deletions apps/meteor/server/startup/migrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,5 @@ import './v260';
import './v261';
import './v262';
import './v263';
import './v264';
import './xrun';
16 changes: 16 additions & 0 deletions apps/meteor/server/startup/migrations/v264.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { addMigration } from '../../lib/migrations';
import { Settings } from '../../../app/models/server/raw';

addMigration({
version: 264,
async up() {
// in case server is being updated, we check setup wizard status to determine if should still create the initial channel
const setupWizard = await Settings.getValueById('Show_Setup_Wizard');
if (setupWizard === 'pending') {
// if still pending for some reason, we need to create the initial channel, so keep the setting as false
return;
}
// if the setup wizard is not pending anymore, we assume initial channel was already created once
await Settings.updateValueById('Initial_Channel_Created', true);
},
});