Skip to content
Snippets Groups Projects
Commit 157ba811 authored by Allen Gilliland's avatar Allen Gilliland
Browse files

fixes #1855 - prevents broken links in the activity feed for entries regarding...

fixes #1855 - prevents broken links in the activity feed for entries regarding the addition/removal of cards on dashboards.
parent 077cb0cd
Branches
Tags v0.12.0
No related merge requests found
......@@ -206,12 +206,11 @@ export default class Activity extends Component {
description.body = item.details.name;
break;
case "dashboard-add-cards":
description.body = item.details.dashcards[0].name;
description.bodyLink = Urls.card(item.details.dashcards[0].card_id);
break;
case "dashboard-remove-cards":
description.body = item.details.dashcards[0].name;
description.bodyLink = Urls.card(item.details.dashcards[0].card_id);
if (item.details.dashcards[0].exists) {
description.bodyLink = Urls.card(item.details.dashcards[0].card_id);
}
break;
case "metric-create":
description.body = item.details.description;
......
......@@ -10,11 +10,19 @@
[user :refer [User]]
[view-log :refer [ViewLog]])))
(defn- dashcard-exists [{:keys [topic] :as activity}]
(if-not (contains? #{:dashboard-add-cards :dashboard-remove-cards} topic)
activity
(update-in activity [:details :dashcards] (fn [dashcards]
(for [dashcard dashcards]
(assoc dashcard :exists (db/exists? Card :id (:card_id dashcard))))))))
(defendpoint GET "/"
"Get recent activity."
[]
(-> (db/sel :many Activity (k/order :timestamp :DESC) (k/limit 40))
(hydrate :user :table :database :model_exists)))
(hydrate :user :table :database :model_exists)
(->> (mapv dashcard-exists))))
(defendpoint GET "/recent_views"
"Get the list of 15 things the current user has been viewing most recently."
......
......@@ -27,7 +27,7 @@
(case model
"card" (db/exists? Card, :id model_id)
"dashboard" (db/exists? Dashboard, :id model_id)
"metric" (db/exists? Metric, :id model_id)
"metric" (db/exists? Metric, :id model_id, :is_active true)
"pulse" (db/exists? Pulse, :id model_id)
"segment" (db/exists? Segment, :id model_id, :is_active true)
nil))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment