Skip to content
Snippets Groups Projects
Unverified Commit 77a02e6e authored by Noah Moss's avatar Noah Moss Committed by GitHub
Browse files

Use dashcard title instead of card name in dashboard subscriptions, if it is set (#18360)

parent bea54e1e
No related branches found
No related tags found
No related merge requests found
......@@ -11,7 +11,7 @@ const {
admin: { first_name, last_name },
} = USERS;
describe.skip("issue 18344", () => {
describe("issue 18344", () => {
beforeEach(() => {
restore();
cy.signInAsAdmin();
......
......@@ -464,7 +464,7 @@
icon-attachment (first (map make-message-attachment (icon-bundle icon-name)))
filters (when dashboard
(render-filters notification dashboard))
message-body (assoc message-context :pulse (html (vec (cons :div (map :content rendered-cards))))
message-body (assoc message-context :pulse (html (vec (cons :div (map :content rendered-cards))))
:filters filters
:iconCid (:content-id icon-attachment))
attachments (apply merge (map :attachments rendered-cards))]
......
......@@ -146,9 +146,10 @@
[card-results]
(let [{channel-id :id} (slack/files-channel)]
(->> (for [card-result card-results]
(let [{{card-id :id, card-name :name, :as card} :card, result :result} card-result]
(let [{{card-id :id, card-name :name, :as card} :card, dashcard :dashcard, result :result} card-result]
(if (and card result)
{:title card-name
{:title (or (-> dashcard :visualization_settings :card.title)
card-name)
:rendered-info (render/render-pulse-card :inline (defaulted-timezone card) card nil result)
:title_link (urls/card-url card-id)
:attachment-name "image.png"
......
......@@ -23,9 +23,11 @@
false)
(s/defn ^:private make-title-if-needed :- (s/maybe common/RenderedPulseCard)
[render-type card]
[render-type card dashcard]
(when *include-title*
(let [image-bundle (when *include-buttons*
(let [card-name (or (-> dashcard :visualization_settings :card.title)
(-> card :name))
image-bundle (when *include-buttons*
(image-bundle/external-link-image-bundle render-type))]
{:attachments (when image-bundle
(image-bundle/image-bundle->attachment image-bundle))
......@@ -37,7 +39,7 @@
[:td {:style (style/style {:padding :0
:margin :0})}
[:span {:style (style/style (style/header-style))}
(-> card :name h)]]
(h card-name)]]
[:td {:style (style/style {:text-align :right})}
(when *include-buttons*
[:img {:style (style/style {:width :16px})
......@@ -139,7 +141,7 @@
- render/text : raw text suitable for substituting on clients when text is preferable. (Currently slack uses this for
scalar results where text is preferable to an image of a div of a single result."
[render-type timezone-id :- (s/maybe s/Str) card dashcard results]
(let [{title :content, title-attachments :attachments} (make-title-if-needed render-type card)
(let [{title :content, title-attachments :attachments} (make-title-if-needed render-type card dashcard)
{description :content} (make-description-if-needed dashcard)
{pulse-body :content
body-attachments :attachments
......
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