Add user object to all evaluatePrefilter variables
This commit is contained in:
@@ -70,7 +70,7 @@
|
||||
<code>${record.values.fieldName}</code>
|
||||
<code>${recordID}</code>
|
||||
<code>${ownerID}</code>
|
||||
<code>${userID}</code>
|
||||
<code>${userID}, ${user.name}</code>
|
||||
</i18next>
|
||||
</b-form-group>
|
||||
</b-col>
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
<code>${record.values.fieldName}</code>
|
||||
<code>${recordID}</code>
|
||||
<code>${ownerID}</code>
|
||||
<code>${userID}</code>
|
||||
<code>${userID}, ${user.name}</code>
|
||||
</i18next>
|
||||
</b-form-group>
|
||||
</template>
|
||||
|
||||
@@ -377,6 +377,7 @@ export default {
|
||||
if (this.field.options.prefilter) {
|
||||
const pf = evaluatePrefilter(this.field.options.prefilter, {
|
||||
record: this.record,
|
||||
user: this.$auth.user || {},
|
||||
recordID: (this.record || {}).recordID || NoID,
|
||||
ownerID: (this.record || {}).ownedBy || NoID,
|
||||
userID: (this.$auth.user || {}).userID || NoID,
|
||||
|
||||
@@ -324,6 +324,7 @@ export default {
|
||||
if (ff.options.prefilter) {
|
||||
ff.options.prefilter = evaluatePrefilter(ff.options.prefilter, {
|
||||
record: this.record,
|
||||
user: this.$auth.user || {},
|
||||
recordID: (this.record || {}).recordID || NoID,
|
||||
ownerID: (this.record || {}).ownedBy || NoID,
|
||||
userID: (this.$auth.user || {}).userID || NoID,
|
||||
|
||||
@@ -104,6 +104,7 @@ export default {
|
||||
|
||||
filter = evaluatePrefilter(filter, {
|
||||
record: this.record,
|
||||
user: this.$auth.user || {},
|
||||
recordID: (this.record || {}).recordID || NoID,
|
||||
ownerID: (this.record || {}).ownedBy || NoID,
|
||||
userID: (this.$auth.user || {}).userID || NoID,
|
||||
|
||||
@@ -340,6 +340,7 @@ export default {
|
||||
if (this.options.filter) {
|
||||
return evaluatePrefilter(this.options.filter, {
|
||||
record: this.record,
|
||||
user: this.$auth.user || {},
|
||||
recordID: (this.record || {}).recordID || NoID,
|
||||
ownerID: (this.record || {}).ownedBy || NoID,
|
||||
userID: (this.$auth.user || {}).userID || NoID,
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
<code>${record.values.fieldName}</code>
|
||||
<code>${recordID}</code>
|
||||
<code>${ownerID}</code>
|
||||
<code>${userID}</code>
|
||||
<code>${userID}, ${user.name}</code>
|
||||
</i18next>
|
||||
</b-form-group>
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
<code>${record.values.fieldName}</code>
|
||||
<code>${recordID}</code>
|
||||
<code>${ownerID}</code>
|
||||
<code>${userID}</code>
|
||||
<code>${userID}, ${user.name}</code>
|
||||
</i18next>
|
||||
</b-form-group>
|
||||
</b-col>
|
||||
@@ -81,7 +81,7 @@
|
||||
<code>${record.values.fieldName}</code>
|
||||
<code>${recordID}</code>
|
||||
<code>${ownerID}</code>
|
||||
<code>${userID}</code>
|
||||
<code>${userID}, ${user.name}</code>
|
||||
</i18next>
|
||||
</b-form-group>
|
||||
</b-col>
|
||||
|
||||
@@ -27,6 +27,7 @@ export default {
|
||||
|
||||
return evaluatePrefilter(body, {
|
||||
record: this.record,
|
||||
user: this.$auth.user || {},
|
||||
recordID: (this.record || {}).recordID || NoID,
|
||||
ownerID: (this.record || {}).ownedBy || NoID,
|
||||
userID: (this.$auth.user || {}).userID || NoID,
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<code>${record.values.fieldName}</code>
|
||||
<code>${recordID}</code>
|
||||
<code>${ownerID}</code>
|
||||
<code>${userID}</code>
|
||||
<code>${userID}, ${user.name}</code>
|
||||
</i18next>
|
||||
</b-form-group>
|
||||
</b-tab>
|
||||
|
||||
@@ -178,6 +178,7 @@ export default {
|
||||
if (feed.options.prefilter) {
|
||||
feed.options.prefilter = evaluatePrefilter(feed.options.prefilter, {
|
||||
record: this.record,
|
||||
user: this.$auth.user || {},
|
||||
recordID: (this.record || {}).recordID || NoID,
|
||||
ownerID: (this.record || {}).ownedBy || NoID,
|
||||
userID: (this.$auth.user || {}).userID || NoID,
|
||||
|
||||
@@ -34,6 +34,7 @@ export default {
|
||||
|
||||
const interpolatedURL = evaluatePrefilter(url, {
|
||||
record: this.record,
|
||||
user: this.$auth.user || {},
|
||||
recordID: (this.record || {}).recordID || NoID,
|
||||
ownerID: (this.record || {}).ownedBy || NoID,
|
||||
userID: (this.$auth.user || {}).userID || NoID,
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<code>${record.values.fieldName}</code>
|
||||
<code>${recordID}</code>
|
||||
<code>${ownerID}</code>
|
||||
<code>${userID}</code>
|
||||
<code>${userID}, ${user.name}</code>
|
||||
</i18next>
|
||||
</b-form-group>
|
||||
</b-tab>
|
||||
|
||||
@@ -157,6 +157,7 @@ export default {
|
||||
if (auxM.filter) {
|
||||
auxM.filter = evaluatePrefilter(auxM.filter, {
|
||||
record: this.record,
|
||||
user: this.$auth.user || {},
|
||||
recordID: (this.record || {}).recordID || NoID,
|
||||
ownerID: (this.record || {}).ownedBy || NoID,
|
||||
userID: (this.$auth.user || {}).userID || NoID,
|
||||
@@ -166,6 +167,7 @@ export default {
|
||||
if (auxM.transformFx) {
|
||||
auxM.transformFx = evaluatePrefilter(auxM.transformFx, {
|
||||
record: this.record,
|
||||
user: this.$auth.user || {},
|
||||
recordID: (this.record || {}).recordID || NoID,
|
||||
ownerID: (this.record || {}).ownedBy || NoID,
|
||||
userID: (this.$auth.user || {}).userID || NoID,
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
<code>${record.values.fieldName}</code>
|
||||
<code>${recordID}</code>
|
||||
<code>${ownerID}</code>
|
||||
<code>${userID}</code>
|
||||
<code>${userID}, ${user.name}</code>
|
||||
</i18next>
|
||||
</b-form-group>
|
||||
</fieldset>
|
||||
@@ -218,7 +218,7 @@
|
||||
<code>${record.values.fieldName}</code>
|
||||
<code>${recordID}</code>
|
||||
<code>${ownerID}</code>
|
||||
<code>${userID}</code>
|
||||
<code>${userID}, ${user.name}</code>
|
||||
</i18next>
|
||||
</b-form-group>
|
||||
|
||||
|
||||
@@ -99,6 +99,7 @@ export default {
|
||||
value: {
|
||||
filter: evaluatePrefilter(this.options.value.filter, {
|
||||
record: this.record,
|
||||
user: this.$auth.user || {},
|
||||
recordID: (this.record || {}).recordID || NoID,
|
||||
ownerID: (this.record || {}).ownedBy || NoID,
|
||||
userID: (this.$auth.user || {}).userID || NoID,
|
||||
@@ -107,6 +108,7 @@ export default {
|
||||
minValue: {
|
||||
filter: evaluatePrefilter(this.options.minValue.filter, {
|
||||
record: this.record,
|
||||
user: this.$auth.user || {},
|
||||
recordID: (this.record || {}).recordID || NoID,
|
||||
ownerID: (this.record || {}).ownedBy || NoID,
|
||||
userID: (this.$auth.user || {}).userID || NoID,
|
||||
@@ -115,6 +117,7 @@ export default {
|
||||
maxValue: {
|
||||
filter: evaluatePrefilter(this.options.maxValue.filter, {
|
||||
record: this.record,
|
||||
user: this.$auth.user || {},
|
||||
recordID: (this.record || {}).recordID || NoID,
|
||||
ownerID: (this.record || {}).ownedBy || NoID,
|
||||
userID: (this.$auth.user || {}).userID || NoID,
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
<code>${record.values.fieldName}</code>
|
||||
<code>${recordID}</code>
|
||||
<code>${ownerID}</code>
|
||||
<code>${userID}</code>
|
||||
<code>${userID}, ${user.name}</code>
|
||||
</i18next>
|
||||
</b-form-group>
|
||||
</b-col>
|
||||
@@ -176,7 +176,7 @@
|
||||
<code>${record.values.fieldName}</code>
|
||||
<code>${recordID}</code>
|
||||
<code>${ownerID}</code>
|
||||
<code>${userID}</code>
|
||||
<code>${userID}, ${user.name}</code>
|
||||
</i18next>
|
||||
</b-form-group>
|
||||
</b-col>
|
||||
@@ -287,7 +287,7 @@
|
||||
<code>${record.values.fieldName}</code>
|
||||
<code>${recordID}</code>
|
||||
<code>${ownerID}</code>
|
||||
<code>${userID}</code>
|
||||
<code>${userID}, ${user.name}</code>
|
||||
</i18next>
|
||||
</b-form-group>
|
||||
</b-col>
|
||||
|
||||
@@ -1366,6 +1366,7 @@ export default {
|
||||
if (prefilter) {
|
||||
const pf = evaluatePrefilter(prefilter, {
|
||||
record: this.record,
|
||||
user: this.$auth.user || {},
|
||||
recordID: (this.record || {}).recordID || NoID,
|
||||
ownerID: (this.record || {}).ownedBy || NoID,
|
||||
userID: (this.$auth.user || {}).userID || NoID,
|
||||
|
||||
@@ -271,7 +271,7 @@
|
||||
<code>${record.values.fieldName}</code>
|
||||
<code>${recordID}</code>
|
||||
<code>${ownerID}</code>
|
||||
<code>${userID}</code>
|
||||
<code>${userID}, ${user.name}</code>
|
||||
</i18next>
|
||||
</b-form-group>
|
||||
</b-col>
|
||||
|
||||
@@ -374,6 +374,7 @@ export default {
|
||||
// hence the /hanging/ record, recordID, ownerID and userID variables
|
||||
filter.push(`(${evaluatePrefilter(this.options.filter, {
|
||||
record: this.record,
|
||||
user: this.$auth.user || {},
|
||||
recordID: (this.record || {}).recordID || NoID,
|
||||
ownerID: (this.record || {}).ownedBy || NoID,
|
||||
userID: (this.$auth.user || {}).userID || NoID,
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
<code>${record.values.fieldName}</code>
|
||||
<code>${recordID}</code>
|
||||
<code>${ownerID}</code>
|
||||
<code>${userID}</code>
|
||||
<code>${userID}, ${user.name}</code>
|
||||
</i18next>
|
||||
</b-form-group>
|
||||
|
||||
|
||||
@@ -186,6 +186,7 @@ export default {
|
||||
buttonLabel (label = '') {
|
||||
return evaluatePrefilter(label, {
|
||||
record: this.record,
|
||||
user: this.$auth.user || {},
|
||||
recordID: (this.record || {}).recordID || NoID,
|
||||
ownerID: (this.record || {}).ownedBy || NoID,
|
||||
userID: (this.$auth.user || {}).userID || NoID,
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<code>${record.values.fieldName}</code>
|
||||
<code>${recordID}</code>
|
||||
<code>${ownerID}</code>
|
||||
<code>${userID}</code>
|
||||
<code>${userID}, ${user.name}</code>
|
||||
</i18next>
|
||||
</b-form-group>
|
||||
|
||||
|
||||
@@ -239,6 +239,7 @@ export default {
|
||||
const { title: blockTitle, kind } = block
|
||||
const interpolatedTitle = evaluatePrefilter(blockTitle, {
|
||||
record: this.record,
|
||||
user: this.$auth.user || {},
|
||||
recordID: (this.record || {}).recordID || NoID,
|
||||
ownerID: (this.record || {}).ownedBy || NoID,
|
||||
userID: (this.$auth.user || {}).userID || NoID,
|
||||
@@ -246,6 +247,7 @@ export default {
|
||||
|
||||
title = evaluatePrefilter(title, {
|
||||
record: this.record,
|
||||
user: this.$auth.user || {},
|
||||
recordID: (this.record || {}).recordID || NoID,
|
||||
ownerID: (this.record || {}).ownedBy || NoID,
|
||||
userID: (this.$auth.user || {}).userID || NoID,
|
||||
|
||||
@@ -90,6 +90,7 @@ export default {
|
||||
blockTitle () {
|
||||
return evaluatePrefilter(this.block.title, {
|
||||
record: this.$attrs.record,
|
||||
user: this.$auth.user || {},
|
||||
recordID: (this.$attrs.record || {}).recordID || NoID,
|
||||
ownerID: (this.$attrs.record || {}).ownedBy || NoID,
|
||||
userID: (this.$auth.user || {}).userID || NoID,
|
||||
@@ -99,6 +100,7 @@ export default {
|
||||
blockDescription () {
|
||||
return evaluatePrefilter(this.block.description, {
|
||||
record: this.$attrs.record,
|
||||
user: this.$auth.user || {},
|
||||
recordID: (this.$attrs.record || {}).recordID || NoID,
|
||||
ownerID: (this.$attrs.record || {}).ownedBy || NoID,
|
||||
userID: (this.$auth.user || {}).userID || NoID,
|
||||
|
||||
@@ -194,7 +194,7 @@ export function queryToFilter (searchQuery = '', prefilter = '', fields = [], re
|
||||
|
||||
// Evaluates the given prefilter. Allows JS template literal expressions
|
||||
// such as id = ${recordID}
|
||||
export function evaluatePrefilter (prefilter, { record, recordID, ownerID, userID }) {
|
||||
export function evaluatePrefilter (prefilter, { record, user, recordID, ownerID, userID }) {
|
||||
return (function (prefilter) {
|
||||
/* eslint-disable no-eval */
|
||||
return eval('`' + prefilter + '`')
|
||||
|
||||
@@ -747,6 +747,7 @@ export default {
|
||||
if (nr.filter) {
|
||||
nr.filter = evaluatePrefilter(nr.filter, {
|
||||
record: this.record,
|
||||
user: this.$auth.user || {},
|
||||
recordID: (this.record || {}).recordID || NoID,
|
||||
ownerID: (this.record || {}).ownedBy || NoID,
|
||||
userID: (this.$auth.user || {}).userID || NoID,
|
||||
|
||||
@@ -466,7 +466,7 @@
|
||||
<code>${record.values.fieldName}</code>
|
||||
<code>${recordID}</code>
|
||||
<code>${ownerID}</code>
|
||||
<code>${userID}</code>
|
||||
<code>${userID}, ${user.name}</code>
|
||||
</i18next>
|
||||
</b-form-group>
|
||||
|
||||
|
||||
@@ -277,6 +277,7 @@ export default {
|
||||
try {
|
||||
return evaluatePrefilter(meta.title, {
|
||||
record: this.record,
|
||||
user: this.$auth.user || {},
|
||||
recordID: (this.record || {}).recordID || NoID,
|
||||
ownerID: (this.record || {}).ownedBy || NoID,
|
||||
userID: (this.$auth.user || {}).userID || NoID,
|
||||
|
||||
Reference in New Issue
Block a user