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 authored and Birkbjo committed Sep 30, 2024
1 parent 7526be7 commit 95d7b2b
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;
}
}
}]
},
]],
['analyticsTableHook', [
{
Expand Down

0 comments on commit 95d7b2b

Please sign in to comment.