Made owner of sheets and libraries more visible

This commit is contained in:
Stefan Zermatten
2023-06-21 13:00:07 +02:00
parent 77ae2d9de8
commit b42a873a5f
6 changed files with 185 additions and 40 deletions

View File

@@ -82,7 +82,14 @@ Meteor.publish('libraryCollection', function (libraryCollectionId) {
}, {
sort: { name: 1 }
});
return [libraryCollectionCursor, libraryCursor];
return [
libraryCollectionCursor,
libraryCursor,
Meteor.users.find(
libraryCollection.owner,
{ fields: { username: 1 } }
),
];
});
});
})
@@ -148,13 +155,21 @@ Meteor.publish('browseLibraries', function () {
showInMarket: true,
public: true,
}, {
sort: { name: 1 }
sort: {
subscriberCount: 1,
name: 1,
},
limit: 500,
}),
LibraryCollections.find({
showInMarket: true,
public: true,
}, {
sort: { name: 1 }
sort: {
subscriberCount: 1,
name: 1
},
limit: 500,
}),
];
});
@@ -169,9 +184,15 @@ Meteor.publish('library', function (libraryId) {
catch (e) {
return this.error(e);
}
return Libraries.find({
_id: libraryId,
});
return [
Libraries.find({
_id: libraryId,
}),
Meteor.users.find(
library.owner,
{ fields: { username: 1 } }
),
];
});
});

View File

@@ -19,10 +19,10 @@ Meteor.publish('singleCharacter', function (creatureId) {
const self = this;
try {
schema.validate({ creatureId });
} catch (e){
} catch (e) {
this.error(e);
}
this.autorun(function (computation){
this.autorun(function (computation) {
let userId = this.userId;
let permissionCreature = Creatures.findOne({
_id: creatureId,
@@ -32,11 +32,11 @@ Meteor.publish('singleCharacter', function (creatureId) {
try { assertViewPermission(permissionCreature, userId) }
catch (e) { return [] }
loadCreature(creatureId, self);
if (permissionCreature.computeVersion !== VERSION && computation.firstRun){
if (permissionCreature.computeVersion !== VERSION && computation.firstRun) {
try {
computeCreature(creatureId)
}
catch(e){ console.error(e) }
catch (e) { console.error(e) }
}
return [
Creatures.find({
@@ -52,7 +52,13 @@ Meteor.publish('singleCharacter', function (creatureId) {
creatureId,
}, {
limit: 20,
sort: {date: -1},
sort: { date: -1 },
}),
// Also publish the owner's username
Meteor.users.find(permissionCreature.owner, {
fields: {
username: 1,
},
}),
];
});