mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-04 14:42:40 +00:00
Remove id parameter from getUsersBrewThemes
Filtering out the current brew can be done later as needed; certain situations may call for retrieving the whole list.
This commit is contained in:
@@ -47,7 +47,7 @@ const api = {
|
|||||||
return { id, googleId };
|
return { id, googleId };
|
||||||
},
|
},
|
||||||
//Get array of any of this user's brews tagged with `meta:theme`
|
//Get array of any of this user's brews tagged with `meta:theme`
|
||||||
getUsersBrewThemes : async (username, id)=>{
|
getUsersBrewThemes : async (username)=>{
|
||||||
const fields = [
|
const fields = [
|
||||||
'title',
|
'title',
|
||||||
'tags',
|
'tags',
|
||||||
@@ -60,7 +60,7 @@ const api = {
|
|||||||
|
|
||||||
const userThemes = {};
|
const userThemes = {};
|
||||||
|
|
||||||
const brews = await HomebrewModel.getByUser(username, true, fields, { tags: { $in: ['meta:theme', 'meta:Theme'] }, shareId: { $ne: id }, renderer: { $ne: 'Legacy' } });
|
const brews = await HomebrewModel.getByUser(username, true, fields, { tags: { $in: ['meta:theme', 'meta:Theme'] }, renderer: { $ne: 'Legacy' } });
|
||||||
|
|
||||||
if(brews) {
|
if(brews) {
|
||||||
for (const brew of brews) {
|
for (const brew of brews) {
|
||||||
@@ -139,7 +139,6 @@ const api = {
|
|||||||
const userID = req?.account?.username && (accessType === 'edit') ? req.account.username : mainAuthor;
|
const userID = req?.account?.username && (accessType === 'edit') ? req.account.username : mainAuthor;
|
||||||
|
|
||||||
// Clean up brew: fill in missing fields with defaults / fix old invalid values
|
// Clean up brew: fill in missing fields with defaults / fix old invalid values
|
||||||
const userThemes = accessType != 'themes' ? await api.getUsersBrewThemes(userID, id, req, res, next) : {};
|
|
||||||
if(stub) {
|
if(stub) {
|
||||||
stub.tags = stub.tags || undefined; // Clear empty strings
|
stub.tags = stub.tags || undefined; // Clear empty strings
|
||||||
stub.renderer = stub.renderer || undefined; // Clear empty strings
|
stub.renderer = stub.renderer || undefined; // Clear empty strings
|
||||||
@@ -384,7 +383,7 @@ const api = {
|
|||||||
brew.description = brew.description.trim() || '';
|
brew.description = brew.description.trim() || '';
|
||||||
brew.text = api.mergeBrewText(brew);
|
brew.text = api.mergeBrewText(brew);
|
||||||
const userID = req?.account?.username ? req.account.username : brew.authors.split(',')[0];
|
const userID = req?.account?.username ? req.account.username : brew.authors.split(',')[0];
|
||||||
brew.userThemes = await api.getUsersBrewThemes(userID, brew.editId, req, res, null);
|
brew.userThemes = await api.getUsersBrewThemes(userID, req, res, null);
|
||||||
|
|
||||||
|
|
||||||
if(brew.googleId && removeFromGoogle) {
|
if(brew.googleId && removeFromGoogle) {
|
||||||
|
|||||||
Reference in New Issue
Block a user