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

Merge pull request #1089 from metabase/database_activity_fix

activity feed fix for error when database is deleted
parents 6ae9b5d0 8791ae22
No related branches found
No related tags found
No related merge requests found
......@@ -137,8 +137,12 @@ export default class Activity extends Component {
description.bodyLink = Urls.card(item.details.dashcards[0].card_id);
break;
case "database-sync":
// NOTE: this is a relic from the very early days of the activity feed when we accidentally didn't
// capture the name/description/engine of a Database properly in the details and so it was
// possible for a database to be deleted and we'd lose any way of knowing what it's name was :(
const oldName = (item.database && 'name' in item.database) ? item.database.name : "Unknown";
description.subject = "received the latest data from";
description.subjectRefName = item.database.name;
description.subjectRefName = (item.details.name) ? item.details.name : oldName;
break;
case "install":
description.userName = "Hello World!";
......
......@@ -81,6 +81,7 @@
(defn- process-database-activity [topic object]
(let [database (db/sel :one Database :id (events/object->model-id topic object))
object (merge object (select-keys database [:name :description :engine]))
database-details-fn (fn [obj] (-> obj
(assoc :status "started")
(dissoc :database_id :custom_id)))
......
......@@ -192,14 +192,21 @@
:model_id (db-id)
:database_id (db-id)
:custom_id "abc"
:details {:status "started"}}
:details {:status "started"
:name (:name (db))
:description (:description (db))
:engine (name (:engine (db)))}}
{:topic :database-sync
:user_id nil
:model "database"
:model_id (db-id)
:database_id (db-id)
:custom_id "abc"
:details {:status "completed" :running_time 0}}]
:details {:status "completed"
:running_time 0
:name (:name (db))
:description (:description (db))
:engine (name (:engine (db)))}}]
(do
(k/delete Activity)
(let [_ (process-activity-event {:topic :database-sync-begin
......
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