Fixed slot fill test in library prop edit
This commit is contained in:
@@ -153,6 +153,7 @@
|
||||
class="ma-4"
|
||||
>
|
||||
<v-btn
|
||||
v-if="!dummySlot"
|
||||
text
|
||||
color="accent"
|
||||
:disabled="!model"
|
||||
@@ -358,7 +359,7 @@ export default {
|
||||
meteor: {
|
||||
$subscribe: {
|
||||
'slotFillers'() {
|
||||
return [this.slotId, this.searchValue || undefined]
|
||||
return [this.slotId || this.dummySlot?._id, this.searchValue || undefined, !!this.dummySlot]
|
||||
},
|
||||
},
|
||||
searchLoading() {
|
||||
|
||||
@@ -79,17 +79,22 @@
|
||||
cols="12"
|
||||
md="6"
|
||||
>
|
||||
<v-layout justify-center>
|
||||
<outlined-input
|
||||
name="Test"
|
||||
data-id="test-slot-button"
|
||||
>
|
||||
<v-btn
|
||||
v-if="context.isLibraryForm"
|
||||
color="accent"
|
||||
class="ma-2 mb-4"
|
||||
data-id="test-slot-button"
|
||||
text
|
||||
class="ma-0"
|
||||
height="54"
|
||||
width="100%"
|
||||
style="justify-content: start;"
|
||||
@click="testSlot"
|
||||
>
|
||||
Test Slot
|
||||
</v-btn>
|
||||
</v-layout>
|
||||
</outlined-input>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<inline-computation-field
|
||||
@@ -148,11 +153,13 @@ import propertyFormMixin from '/imports/client/ui/properties/forms/shared/proper
|
||||
import FormSection from '/imports/client/ui/properties/forms/shared/FormSection.vue';
|
||||
import PROPERTIES from '/imports/constants/PROPERTIES.js';
|
||||
import TagTargeting from '/imports/client/ui/properties/forms/shared/TagTargeting.vue';
|
||||
import OutlinedInput from '/imports/client/ui/properties/viewers/shared/OutlinedInput.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
FormSection,
|
||||
TagTargeting,
|
||||
OutlinedInput,
|
||||
},
|
||||
mixins: [propertyFormMixin],
|
||||
inject: {
|
||||
|
||||
@@ -7,7 +7,7 @@ import getCreatureLibraryIds from '/imports/api/library/getCreatureLibraryIds.js
|
||||
import { LIBRARY_NODE_TREE_FIELDS } from '/imports/server/publications/library.js';
|
||||
import escapeRegex from '/imports/api/utility/escapeRegex.js';
|
||||
|
||||
Meteor.publish('slotFillers', function (slotId, searchTerm) {
|
||||
Meteor.publish('slotFillers', function (slotId, searchTerm, isDummySlot) {
|
||||
if (searchTerm) check(searchTerm, String);
|
||||
|
||||
let self = this;
|
||||
@@ -16,12 +16,17 @@ Meteor.publish('slotFillers', function (slotId, searchTerm) {
|
||||
if (!userId) {
|
||||
return [];
|
||||
}
|
||||
// Get the slot
|
||||
let slot = CreatureProperties.findOne(slotId);
|
||||
if (!slot) {
|
||||
return [];
|
||||
|
||||
// Get the slot from the right collection
|
||||
let slot;
|
||||
if (isDummySlot) {
|
||||
slot = LibraryNodes.findOne(slotId);
|
||||
} else {
|
||||
slot = CreatureProperties.findOne(slotId);
|
||||
}
|
||||
|
||||
if (!slot) return [];
|
||||
|
||||
// Get all the ids of libraries the user can access
|
||||
const creatureId = slot.ancestors[0].id;
|
||||
const libraryIds = getCreatureLibraryIds(creatureId, userId);
|
||||
|
||||
Reference in New Issue
Block a user