fix: missing permissions viewId args when ignoreViewQuery is true#1490
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the issue where the permissions viewId argument is not properly set when ignoreViewQuery is true.
- Introduces the ignoreViewQuery property into the query type.
- Computes a conditional viewId based on the ignoreViewQuery flag.
- Updates calls to permissions and prepareQuery to reflect the computed viewId.
| this.knex.queryBuilder(), | ||
| { | ||
| viewId, | ||
| viewId: query.viewId, |
There was a problem hiding this comment.
Since you've computed a conditional viewId on line 450 based on ignoreViewQuery, update the permissions configuration to use the computed viewId instead of query.viewId. Consider replacing this line with 'viewId,' to maintain consistent behavior.
| viewId: query.viewId, | |
| viewId: viewId, |
| const { dbTableName, queryBuilder, viewCte, filter, search, orderBy, groupBy, fieldMap } = | ||
| await this.prepareQuery(tableId, { | ||
| ...query, | ||
| viewId: query.ignoreViewQuery ? undefined : query.viewId, | ||
| }); | ||
| await this.prepareQuery(tableId, query); |
There was a problem hiding this comment.
The prepareQuery call now passes the original query object, so the computed viewId is not being used. Instead, pass the computed viewId (i.e. {...query, viewId}) so that ignoreViewQuery is correctly applied during query preparation.
Pull Request Test Coverage Report for Build 14723345725Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
🧹 Preview Environment Cleanup
|
…2802) Synced from teableio/teable-ee@6f23ef2 Co-authored-by: nichenqin <nichenqin@hotmail.com>
No description provided.