0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 20:42:43 +00:00

Classify user brews as V3 if they use V3

Each theme in the theme chain, including user brews, must use the same renderer. When moving to V4 or future versions, it will be important to distinguish which themes are compatible with each other
This commit is contained in:
Trevor Buckner
2024-07-19 00:05:45 -04:00
parent d741878f78
commit 0448f15322
2 changed files with 6 additions and 5 deletions

View File

@@ -192,7 +192,7 @@ const MetadataEditor = createClass({
renderThemeDropdown : function(){
if(!global.enable_themes) return;
const mergedThemes = { ...Themes, ...this.props.userThemes };
const mergedThemes = _.merge(Themes, this.props.userThemes);
const listThemes = (renderer)=>{
return _.map(_.values(mergedThemes[renderer]), (theme)=>{
@@ -230,7 +230,6 @@ const MetadataEditor = createClass({
</div>
{/*listThemes('Legacy')*/}
{listThemes('V3')}
{listThemes('Brew')}
</Nav.dropdown>;
}

View File

@@ -55,16 +55,18 @@ const api = {
'thumbnail',
'textBin',
'text',
'authors'
'authors',
'renderer'
];
const userThemes = {};
const brews = await HomebrewModel.getByUser(username, true, fields, { tags: { $in: ['meta:theme', 'meta:Theme'] }, renderer: { $ne: 'Legacy' } });
const brews = await HomebrewModel.getByUser(username, true, fields, { tags: { $in: ['meta:theme', 'meta:Theme'] }});
if(brews) {
for (const brew of brews) {
userThemes[brew.shareId] = {
userThemes[brew.renderer] ??= {};
userThemes[brew.renderer][brew.shareId] = {
name : brew.title,
renderer : brew.renderer,
baseTheme : brew.theme,