Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide explore results button for no-data users #20065

Merged
merged 1 commit into from
Jan 31, 2022
Merged

Hide explore results button for no-data users #20065

merged 1 commit into from
Jan 31, 2022

Conversation

daltojohnso
Copy link
Contributor

Fixes #20044

Throwing an additional condition into the hasExploreResultsLink check -- that the question's query is not read-only via:

!question.query().readOnly();

The page blanks out due to a scripting error because there's code in the query builder that assumes there is query metadata--obviously, not the case for a user without permissions. Not doing anything about that since the we shouldn't let users get into this state.

Testing

  1. Log into a user without self-serve data permissions
  2. Navigate to a saved native question
  3. You should not see the "Explore Results" button in the header
  4. Log into a user with data permissions
  5. Go to the same saved questions
  6. You should see the "Explore Results" button in the header

@daltojohnso daltojohnso added the backport Automatically create PR on current release branch on merge label Jan 31, 2022
@daltojohnso daltojohnso requested review from a team and kulyk January 31, 2022 17:06
@daltojohnso
Copy link
Contributor Author

Adding @kulyk to this review directly because you might know a better method to use than question.query().readOnly()

Copy link
Member

@kulyk kulyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK query.readOnly() is the best way out there

@codecov
Copy link

codecov bot commented Jan 31, 2022

Codecov Report

Merging #20065 (1cf0008) into master (385fa88) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #20065   +/-   ##
=======================================
  Coverage   64.79%   64.80%           
=======================================
  Files        2078     2078           
  Lines       73760    73761    +1     
  Branches     8818     8818           
=======================================
+ Hits        47796    47801    +5     
+ Misses      22204    22200    -4     
  Partials     3760     3760           
Flag Coverage Δ
front-end 44.20% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...abase/query_builder/components/view/ViewHeader.jsx 69.62% <100.00%> (+0.38%) ⬆️
...nd/src/metabase-lib/lib/queries/StructuredQuery.ts 70.78% <0.00%> (+0.22%) ⬆️
...ontend/src/metabase-lib/lib/queries/NativeQuery.ts 75.48% <0.00%> (+1.29%) ⬆️
frontend/src/metabase/lib/greeting.js 76.92% <0.00%> (+7.69%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 385fa88...1cf0008. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Automatically create PR on current release branch on merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Explore results" shown for no-data users resulting in blank screen when clicked
2 participants