Skip to content
Snippets Groups Projects
Unverified Commit 20ec1869 authored by Alexander Lesnenko's avatar Alexander Lesnenko Committed by GitHub
Browse files

Do not change display on drill to questions (#18008)

* Do not change display on drill down to questions

* unskip repro

* include displayIsLocked explicitly otherwise it breaks almost the entire app
parent 64bbf8e7
No related branches found
No related tags found
No related merge requests found
......@@ -824,16 +824,22 @@ export default class Question {
originalQuestion,
clean = true,
query,
includeDisplayIsLocked,
}: {
originalQuestion?: Question,
clean?: boolean,
query?: { [string]: any },
includeDisplayIsLocked?: boolean,
} = {}): string {
if (
!this.id() ||
(originalQuestion && this.isDirtyComparedTo(originalQuestion))
) {
return Urls.question(null, this._serializeForUrl({ clean }), query);
return Urls.question(
null,
this._serializeForUrl({ clean, includeDisplayIsLocked }),
query,
);
} else {
return Urls.question(this.card(), "", query);
}
......@@ -1045,7 +1051,11 @@ export default class Question {
}
// Internal methods
_serializeForUrl({ includeOriginalCardId = true, clean = true } = {}) {
_serializeForUrl({
includeOriginalCardId = true,
clean = true,
includeDisplayIsLocked = false,
} = {}) {
const query = clean ? this.query().clean() : this.query();
const cardCopy = {
......@@ -1061,6 +1071,11 @@ export default class Question {
...(includeOriginalCardId
? { original_card_id: this._card.original_card_id }
: {}),
...(includeDisplayIsLocked
? {
displayIsLocked: this._card.displayIsLocked,
}
: {}),
};
return Card_DEPRECATED.utf8_to_b64url(JSON.stringify(sortObject(cardCopy)));
......@@ -1081,11 +1096,13 @@ export default class Question {
}
getUrlWithParameters() {
const question = this.query().isEditable()
? this.convertParametersToFilters()
: this.markDirty(); // forces use of serialized question url
const question = this.convertParametersToFilters().markDirty();
const query = this.isNative() ? this._parameterValues : undefined;
return question.getUrl({ originalQuestion: this, query });
return question.getUrl({
originalQuestion: this,
query,
includeDisplayIsLocked: true,
});
}
getModerationReviews() {
......
......@@ -72,7 +72,7 @@ export default ({ question, clicked }: ClickActionProps): ClickAction[] => {
extraData.questions[targetId],
question.metadata(),
getQueryParams(parameterMapping, { data, extraData, clickBehavior }),
);
).lockDisplay();
if (targetQuestion.isStructured()) {
targetQuestion = targetQuestion.setParameters(
......
......@@ -100,7 +100,7 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => {
});
});
it.skip("should not change the visualization type in a targetted question with mapped filter (metabase#16334)", () => {
it("should not change the visualization type in a targetted question with mapped filter (metabase#16334)", () => {
// Question 2, that we're adding to the dashboard
const questionDetails = {
query: {
......
......@@ -210,7 +210,7 @@ describe("scenarios > dashboard > dashboard drill", () => {
cy.findByText("num: 111").click();
// show filtered question
cy.findByText("Orders");
cy.findAllByText("Orders");
cy.findByText("User ID is 111");
cy.findByText("Category is Widget");
cy.findByText("Showing 5 rows");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment