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
Remove the POST /api/product-feedback endpoint (#83931)
Nicolò Pretto0866f0d4e432
diff --git a/.clj-kondo/config/modules/config.edn b/.clj-kondo/config/modules/config.ednindex 77590d7d155..77d56c24e24 100644--- a/.clj-kondo/config/modules/config.edn+++ b/.clj-kondo/config/modules/config.edn@@ -2000,10 +2000,8 @@product-feedback{:team "UX West"- :api #{metabase.product-feedback.api- metabase.product-feedback.init}+ :api #{metabase.product-feedback.init}:uses #{analytics- apiapp-dbchannelpremium-featuresdiff --git a/resources/openapi/openapi.json b/resources/openapi/openapi.jsonindex 1b983c5911f..6c054d2c68c 100644--- a/resources/openapi/openapi.json+++ b/resources/openapi/openapi.json@@ -39467,58 +39467,6 @@"tags" : [ "/api/preview_embed" ]}},- "/api/product-feedback" : {- "post" : {- "description" : "Endpoint to provide feedback from the product",- "operationId" : "post-api-product-feedback",- "parameters" : [ ],- "requestBody" : {- "content" : {- "application/json" : {- "schema" : {- "properties" : {- "comments" : {- "oneOf" : [ {- "minLength" : 1,- "type" : "string"- }, {- "type" : "null"- } ]- },- "email" : {- "oneOf" : [ {- "minLength" : 1,- "type" : "string"- }, {- "type" : "null"- } ]- },- "source" : {- "minLength" : 1,- "type" : "string"- }- },- "required" : [ "source" ],- "type" : "object"- }- }- }- },- "responses" : {- "2XX" : {- "description" : "Successful response"- },- "4XX" : {- "description" : "Client error response"- },- "5XX" : {- "description" : "Server error response"- }- },- "summary" : "POST /api/product-feedback",- "tags" : [ "/api/product-feedback" ]- }- },"/api/public/action/{uuid}" : {"get" : {"description" : "Fetch a publicly-accessible Action. Does not require auth credentials. Public sharing must be enabled.",diff --git a/src/metabase/api_routes/routes.clj b/src/metabase/api_routes/routes.cljindex 2c11c0fe7be..24804e59e2c 100644--- a/src/metabase/api_routes/routes.clj+++ b/src/metabase/api_routes/routes.clj@@ -50,7 +50,6 @@[metabase.osi.ai-context.api][metabase.permissions-rest.api][metabase.premium-features.rest.api]- [metabase.product-feedback.api][metabase.public-sharing-rest.api][metabase.pulse.api][metabase.queries-rest.api]@@ -116,7 +115,6 @@metabase.model-persistence.api/keep-memetabase.native-query-snippets.api/keep-memetabase.permissions-rest.api/keep-me- metabase.product-feedback.api/keep-memetabase.public-sharing-rest.api/keep-memetabase.query-processor.api/keep-memetabase.revisions.api/keep-me@@ -258,7 +256,6 @@"/persist" (+auth 'metabase.model-persistence.api)"/premium-features" (+auth metabase.premium-features.rest.api/routes)"/preview_embed" (+auth metabase.embedding-rest.api/preview-embedding-routes)- "/product-feedback" 'metabase.product-feedback.api"/public" (+public-exceptions metabase.public-sharing-rest.api/routes)"/pulse" metabase.pulse.api/pulse-routes"/revision" (+auth 'metabase.revisions.api)diff --git a/src/metabase/product_feedback/api.clj b/src/metabase/product_feedback/api.cljdeleted file mode 100644index 907d44c75b5..00000000000--- a/src/metabase/product_feedback/api.clj+++ /dev/null@@ -1,47 +0,0 @@-(ns metabase.product-feedback.api- (:require- [clj-http.client :as http]- [metabase.api.common :as api]- [metabase.api.macros :as api.macros]- [metabase.product-feedback.settings :as product-feedback.settings]- [metabase.util.json :as json]- [metabase.util.log :as log]- [metabase.util.malli :as mu]- [metabase.util.malli.schema :as ms]))--(mu/defn send-feedback!- "Sends the feedback to the api endpoint"- [comments :- [:maybe ms/NonBlankString]- source :- ms/NonBlankString- email :- [:maybe ms/NonBlankString]]- (try- (http/post (or product-feedback.settings/product-feedback-url- ;; this error should mostly be dev-facing- (throw (ex-info "metabase.product-feedback.settings/product-feedback-url (MB_PRODUCT_FEEDBACK_URL) is not set"- {})))- {:content-type :json- :body (json/encode {:comments comments- :source source- :email email})})- (catch Exception e- (log/warn (ex-message e))- (throw e))))--;; TODO (Cam 2025-11-25) please add a response schema to this API endpoint, it makes it easier for our customers to-;; use our API + we will need it when we make auto-TypeScript-signature generation happen-;;-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-has-response-schema]}-(api.macros/defendpoint :post "/"- "Endpoint to provide feedback from the product"- [_route-params- _query-params- {:keys [comments source email]} :- [:map {:closed true}- [:comments {:optional true} [:maybe ms/NonBlankString]]- [:source ms/NonBlankString]- [:email {:optional true} [:maybe ms/NonBlankString]]]]- (future (send-feedback! comments source email))- api/generic-204-no-content)--;;; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-;;; !! Endpoints in this namespace do not currently require auth! Keep this in mind when adding new ones. !!-;;; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!diff --git a/src/metabase/product_feedback/settings.clj b/src/metabase/product_feedback/settings.cljindex c5d73abe1b3..fb0931ada59 100644--- a/src/metabase/product_feedback/settings.clj+++ b/src/metabase/product_feedback/settings.clj@@ -1,15 +1,7 @@(ns metabase.product-feedback.settings(:require- [metabase.config.core :as config][metabase.settings.core :refer [defsetting]]))-(def ^String product-feedback-url- "Product feedback url. When not prod, reads `MB_PRODUCT_FEEDBACK_URL` from the environment to prevent development- feedback from hitting the endpoint."- (if config/is-prod?- "https://prod-feedback.metabase.com/api/v1/crm/product-feedback"- (config/config-str :mb-product-feedback-url)))-(defsetting follow-up-email-sent;; No need to i18n this as it's not user facing"Have we sent a follow up email to the instance admin?"diff --git a/test/metabase/product_feedback/api_test.clj b/test/metabase/product_feedback/api_test.cljdeleted file mode 100644index 95ad24ffafb..00000000000--- a/test/metabase/product_feedback/api_test.clj+++ /dev/null@@ -1,29 +0,0 @@-(ns metabase.product-feedback.api-test- (:require- [clojure.string :as str]- [clojure.test :refer :all]- [metabase.product-feedback.api :as product-feedback.api]- [metabase.test :as mt]))--(deftest ^:parallel product-feedback-test- (testing "requires non-blank source"- (let [payload {:comments "foo"- :email "foo"}- response (mt/user-http-request :crowberto :post 400 "product-feedback/" payload)]- (testing (str "without " :source)- (is (= {:errors {:source "value must be a non-blank string."},- :specific-errors {:source ["missing required key, received: nil"]}}- response))))))--(deftest product-feedback-test-2- (testing "fires the proxy in background"- (let [sent? (promise)]- (mt/with-dynamic-fn-redefs [product-feedback.api/send-feedback! (fn [comments source email]- (doseq [prop [comments source email]]- (is (not (str/blank? prop)) "got a blank property to send-feedback!"))- (deliver sent? true))]- (mt/user-http-request :crowberto :post 204 "product-feedback/"- {:comments "I like Metabase"- :email "[email protected]"- :source "Analytics Inc"})- (is (true? (deref sent? 2000 ::timedout)))))))