Merge branch 'dev-console' into 'develop'
Developers: become a developer through the console See merge request soapbox-pub/soapbox-fe!845
This commit is contained in:
commit
0990bbb6cf
2 changed files with 24 additions and 0 deletions
|
@ -25,6 +25,7 @@ import { getSoapboxConfig } from 'soapbox/actions/soapbox';
|
||||||
import { generateThemeCss } from 'soapbox/utils/theme';
|
import { generateThemeCss } from 'soapbox/utils/theme';
|
||||||
import messages from 'soapbox/locales/messages';
|
import messages from 'soapbox/locales/messages';
|
||||||
import { FE_SUBDIRECTORY } from 'soapbox/build_config';
|
import { FE_SUBDIRECTORY } from 'soapbox/build_config';
|
||||||
|
import { createGlobals } from 'soapbox/globals';
|
||||||
|
|
||||||
const validLocale = locale => Object.keys(messages).includes(locale);
|
const validLocale = locale => Object.keys(messages).includes(locale);
|
||||||
|
|
||||||
|
@ -33,6 +34,9 @@ const previewVideoState = 'previewVideoModal';
|
||||||
|
|
||||||
export const store = configureStore();
|
export const store = configureStore();
|
||||||
|
|
||||||
|
// Configure global functions for developers
|
||||||
|
createGlobals(store);
|
||||||
|
|
||||||
store.dispatch(preload());
|
store.dispatch(preload());
|
||||||
|
|
||||||
store.dispatch(fetchMe())
|
store.dispatch(fetchMe())
|
||||||
|
|
20
app/soapbox/globals.js
Normal file
20
app/soapbox/globals.js
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
/**
|
||||||
|
* globals: do things through the console.
|
||||||
|
* This feature is for developers.
|
||||||
|
*/
|
||||||
|
import { changeSetting } from 'soapbox/actions/settings';
|
||||||
|
|
||||||
|
export const createGlobals = store => {
|
||||||
|
const Soapbox = {
|
||||||
|
// Become a developer with `Soapbox.isDeveloper()`
|
||||||
|
isDeveloper: (bool = true) => {
|
||||||
|
if (![true, false].includes(bool)) {
|
||||||
|
throw `Invalid option ${bool}. Must be true or false.`;
|
||||||
|
}
|
||||||
|
store.dispatch(changeSetting(['isDeveloper'], bool));
|
||||||
|
return bool;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
window.Soapbox = Soapbox;
|
||||||
|
};
|
Loading…
Reference in a new issue