0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 04:12:23 +01:00
Commit Graph

4 Commits

Author SHA1 Message Date
Paul D'Ambra
bb0872b7dd
fix: soft or hard delete insight after soft or hard dashboard deletion (#9998)
* delete insight to dashboard relation on soft delete of either

* refactor tests

* obey mypy

* don't allow hard delete of insights or dashboards

* soft deleted insights return 404 on get

* prove soft delete can be reversed

* no need to test permissions on delete that nobody can do

* no need to test permissions on delete that nobody can do
2022-05-27 09:15:53 +01:00
Marius Andra
1ddecf7800
feat(insights): dashboards insights many-to-many another attempt (#9416)
* dashboards and tiles, view mode, basic frontend typing

* update types, many-to-many relations

* update insight dashboards

* duplication works

* mypy

* fix migrations

* fix duplication bug

* add default filters

* fix caching

* deprecation nonsense

* remove things

* add nplus1 tests

* make nplus1 test need no explanation

* don't need to prefetch and select related

* move layouts API onto dashboard and store updates on DashboardTile

* apply dashboard filters to insights when loading dashboard

* don't need to update cached result in a cached function

* ugh, filter caching

* update basic serializer test

* add defaults when getting layout and colour from insights

* caching insights depends on filters hash changing when the insight is saved

* caching insights depends on filters hash changing when the insight is saved

* can't constantly resave insight filter hashes any more

* prettify the skip comment

* fix patch reference

* fix test assertion

* need to save dashboards to update insight filters_hash *until we fix filtering*

* add comment explaining why the test is failing - so I remember later

* blunt solution to not overwriting dashboard aware filter hash

* explode by 7 instead of 9 queries per insight added to dashboard

* mark some learning as a TODO

* only update dashboard layout when in edit mode

* insight logic no longer deals with saving layout

* skip the nplus1 test _for now_

* update the dashboard snapshots

* enrich insights with extra props when loaded in dashboard context

* update color via dashboard not insight

* create empty insight with a dashboards array, not a single dashboard

* remove empty TODO

* avoid initialising dashboardsmodel for dashboards logic tests

* no need to select and prefetch related

* order migration by last modified at

* remove insight layouts endpoint

* Add new from_dashboard parameter to API docs

* typo

* move deprecated fields on insight

* fix syntax error in migration file

* add permissions tests

* add help text to dashboards serializer field

* fix test with silent server errors

* down to 3 extra queries per insight on each dasboard

* down to 1 extra queries per insight on each dashboard

* set dashboard on context when retrieving an insight, so that filters are reported correctly

* explicitly fail to add insight to another team's dashboard

* update insight cache in correct context when refreshing

* add migration test

* satisfy the type checker

* Revert "satisfy the type checker"

This reverts commit 4d48a16cf4.

* satisfy the type checker

* really satisfy the type checker

* address two nits

* can ignore conflicts when inserting dashboard tiles

Co-authored-by: Paul D'Ambra <paul.dambra@gmail.com>
2022-04-22 09:03:22 +01:00
Alex Gyujin Kim
a9ad5a437d
fix: uniqueness constraint on Tagged Items (#8824) 2022-03-09 09:46:21 -08:00
Michael Matloka
db4111df8a
Finalize dashboard restrictions (#8527)
* Update test_insight.py

* Secure insight endpoint for dashboard restrictions

* Prohibit unauthorized deletion of restricted dashboard

* Update class name in snapshots

* Address feedback
2022-02-14 12:55:16 +00:00