Skip to content

Commit

Permalink
fix(sqlview): When current user in SQL view, do not cache
Browse files Browse the repository at this point in the history
  • Loading branch information
benguaraldi committed Aug 21, 2024
1 parent 5f5b8f9 commit afd0905
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/config/field-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,29 @@ export default new Map([
elseValue: false,
}],
},
{
field: 'cacheStrategy',
when: [{
field: 'sqlQuery',
operator: 'HAS_VALUE',
}],
operations: [{
type: 'CHANGE_VALUE',
setValue: (model, fieldConfig) => {
try {
if (model.dataValues.sqlQuery.includes('${_current_user_id}') ||

Check warning on line 928 in src/config/field-rules.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected template string expression
model.dataValues.sqlQuery.includes('${_current_username}')) {

Check warning on line 929 in src/config/field-rules.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected template string expression
fieldConfig.value = model[fieldConfig.name] = 'NO_CACHE';
fieldConfig.props.disabled = true;
} else {
fieldConfig.props.disabled = false;
}
} catch (e) {
return;
}
}
}]
},
]],
['relationshipType', [
{
Expand Down

0 comments on commit afd0905

Please sign in to comment.