diff --git a/app/imports/client/ui/creature/CreatureForm.vue b/app/imports/client/ui/creature/CreatureForm.vue
index ee199b90..bd5426ea 100644
--- a/app/imports/client/ui/creature/CreatureForm.vue
+++ b/app/imports/client/ui/creature/CreatureForm.vue
@@ -2,18 +2,21 @@
$emit('change', {path: ['name'], value, ack})"
/>
$emit('change', {path: ['alignment'], value, ack})"
/>
$emit('change', {path: ['gender'], value, ack})"
@@ -21,6 +24,7 @@
$emit('change', {path: ['picture'], value, ack})"
@@ -28,6 +32,7 @@
$emit('change', {path: ['avatarPicture'], value, ack})"
@@ -36,21 +41,25 @@
$emit('change', {path: ['settings','hideUnusedStats'], value: !!value})"
/>
$emit('change', {path: ['settings','hideRestButtons'], value: !!value})"
/>
@@ -62,6 +71,7 @@
min="0"
max="1"
step="0.1"
+ :disabled="!editPermission"
:value="model.settings.hitDiceResetMultiplier"
@change="(value, ack) => $emit('change', {path: ['settings','hitDiceResetMultiplier'], value, ack})"
/>
@@ -69,6 +79,7 @@
label="Discord Webhook URL"
hint="This creature's logs will be posted to the discord channel"
placeholder="https://discordapp.com/api/webhooks//"
+ :disabled="!editPermission"
:value="model.settings.discordWebhook"
@change="(value, ack) => $emit('change', {path: ['settings','discordWebhook'], value, ack})"
/>
@@ -96,12 +107,13 @@
@@ -40,6 +40,35 @@
+
+
+
+ mdi-account
+
+
+
+
+ {{ ownerName }}
+
+
+ Sheet owner
+
+
+
+
+
+
+ mdi-cancel
+ Unshare with me
+
+
@@ -47,37 +76,31 @@
Print
-
-
-
-
- mdi-delete
- Delete
-
-
-
-
-
- mdi-pencil
- Edit details
-
-
-
-
-
- mdi-share-variant
- Sharing
-
-
-
+
+
+
+ mdi-pencil
+ Edit details
+
+
+
+
+ mdi-share-variant
+ Sharing
+
+
+
mdi-delete
- Unshare with me
+ Delete
@@ -266,6 +289,15 @@ export default {
return false;
}
},
+ isOwner() {
+ if (!this.creature) return;
+ return Meteor.userId() === this.creature.owner;
+ },
+ ownerName() {
+ if (!this.creature) return;
+ const username = Meteor.users.findOne(this.creature.owner)?.username;
+ return username;
+ },
},
}
diff --git a/app/imports/client/ui/library/LibraryCollectionEditDialog.vue b/app/imports/client/ui/library/LibraryCollectionEditDialog.vue
index 11977d30..90649d86 100644
--- a/app/imports/client/ui/library/LibraryCollectionEditDialog.vue
+++ b/app/imports/client/ui/library/LibraryCollectionEditDialog.vue
@@ -8,6 +8,7 @@
mdi-share-variant
@@ -15,12 +16,32 @@
mdi-delete
+
+
+
+ mdi-account
+
+
+
+
+ {{ ownerName || '?' }}
+
+
+ Collection owner
+
+
+
updateLibraryCollection({showInMarket}, ack)"
/>
@@ -121,6 +143,9 @@ export default {
meteor: {
'$subscribe': {
libraries: [],
+ libraryCollection() {
+ return [this._id]
+ },
},
model() {
return LibraryCollections.findOne(this._id);
@@ -144,6 +169,15 @@ export default {
};
});
},
+ isOwner() {
+ if (!this.model) return;
+ return Meteor.userId() === this.model.owner;
+ },
+ ownerName() {
+ if (!this.model) return;
+ const username = Meteor.users.findOne(this.model.owner)?.username;
+ return username;
+ },
}
}
diff --git a/app/imports/client/ui/library/LibraryEditDialog.vue b/app/imports/client/ui/library/LibraryEditDialog.vue
index 29bd535c..772d9625 100644
--- a/app/imports/client/ui/library/LibraryEditDialog.vue
+++ b/app/imports/client/ui/library/LibraryEditDialog.vue
@@ -8,6 +8,7 @@
mdi-share-variant
@@ -15,12 +16,32 @@
mdi-delete
+
+
+
+ mdi-account
+
+
+
+
+ {{ ownerName }}
+
+
+ Library owner
+
+
+
@@ -170,7 +192,16 @@ export default {
}, {
sort: { order: 1 },
});
- }
+ },
+ isOwner() {
+ if (!this.model) return;
+ return Meteor.userId() === this.model.owner;
+ },
+ ownerName() {
+ if (!this.model) return;
+ const username = Meteor.users.findOne(this.model.owner)?.username;
+ return username;
+ },
}
}
diff --git a/app/imports/server/publications/library.js b/app/imports/server/publications/library.js
index cae264a9..5499f246 100644
--- a/app/imports/server/publications/library.js
+++ b/app/imports/server/publications/library.js
@@ -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 } }
+ ),
+ ];
});
});
diff --git a/app/imports/server/publications/singleCharacter.js b/app/imports/server/publications/singleCharacter.js
index 28d2da6f..b41c9dcd 100644
--- a/app/imports/server/publications/singleCharacter.js
+++ b/app/imports/server/publications/singleCharacter.js
@@ -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,
+ },
}),
];
});