The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
handle users with no first or last names in document comments (#66468)
Nick Fitzpatrickceb7f93db969
diff --git a/e2e/support/helpers/e2e-comment-helpers.ts b/e2e/support/helpers/e2e-comment-helpers.tsindex 1478af9d74a..c57ca6bffc2 100644--- a/e2e/support/helpers/e2e-comment-helpers.ts+++ b/e2e/support/helpers/e2e-comment-helpers.ts@@ -7,6 +7,8 @@ export const Comments = {getCommentInput,getCommentInputs,getCommentByText,+ getAllComments,+ getMentionDialog,getPlaceholder,getEmojiPicker,resolveCommentByText,@@ -63,6 +65,10 @@ function getCommentByText(text: string | RegExp) {return cy.findByText(text).closest("[data-testid='discussion-comment']");}+function getAllComments() {+ return cy.findAllByTestId("discussion-comment");+}+function openAllComments() {cy.findByRole("link", { name: "Show all comments" }).click();getSidebar().should("contain.text", "All comments");@@ -115,3 +121,7 @@ function getSidebar() {function closeSidebar() {cy.icon("close").click();}++function getMentionDialog() {+ return cy.findByRole("dialog", { name: "Mention Dialog" });+}diff --git a/e2e/test/scenarios/documents/comments.cy.spec.ts b/e2e/test/scenarios/documents/comments.cy.spec.tsindex 09f84e82525..74014cc9e80 100644--- a/e2e/test/scenarios/documents/comments.cy.spec.ts+++ b/e2e/test/scenarios/documents/comments.cy.spec.ts@@ -1574,6 +1574,21 @@ describe("document comments", () => {});});});++ it("handles commenting with users without first and last names", () => {+ cy.request("post", "/api/user", { email: "[email protected]" });+ startNewCommentIn1ParagraphDocument();+ Comments.getNewThreadInput().type("@No");+ Comments.getMentionDialog().findByText("[email protected]").click();+ Comments.getNewThreadInput().type("needs to see this");+ cy.realPress([META_KEY, "Enter"]);++ // assert that the comment was created+ Comments.getAllComments().should("have.length", 1);+ // mention is it's own span, so we need to search for the pieces individually+ Comments.getCommentByText("@[email protected]").should("exist");+ Comments.getCommentByText("needs to see this").should("exist");+ });});function selectCharactersLeft(count: number) {diff --git a/enterprise/backend/src/metabase_enterprise/comments/api.clj b/enterprise/backend/src/metabase_enterprise/comments/api.cljindex 1bbbd8b65ef..25229d7d038 100644--- a/enterprise/backend/src/metabase_enterprise/comments/api.clj+++ b/enterprise/backend/src/metabase_enterprise/comments/api.clj@@ -270,7 +270,7 @@:offset (request/offset)})];; returns nothing while we're trying to figure out how do we deal with sandboxes and tenants etc;; do not forget to uncomment tests (both api and e2e)- {:data (->> (t2/select [:model/User :id :first_name :last_name]+ {:data (->> (t2/select [:model/User :id :first_name :last_name :email](-> clauses(sql.helpers/order-by [:%lower.first_name :asc][:%lower.last_name :asc]