EnxDev commented on code in PR #42472:
URL: https://github.com/apache/superset/pull/42472#discussion_r3656967125
##########
superset/commands/chart/importers/v1/utils.py:
##########
@@ -202,11 +202,17 @@ def import_chart(
db.session.flush()
if user:
- from superset.subjects.utils import get_user_subject
+ from superset.subjects.utils import (
+ get_default_viewers_for_new_asset,
+ get_user_subject,
+ )
subj = get_user_subject(user.id)
if subj and subj not in chart.editors:
chart.editors.append(subj)
+ for viewer in get_default_viewers_for_new_asset(user.id):
+ if viewer not in chart.viewers:
+ chart.viewers.append(viewer)
Review Comment:
Fixed. The block is now guarded with if not existing and user:, matching the
dashboard importer — so overwrite and soft-delete-restore re-imports no longer
attach the importer's groups (or re-add the editor) to a pre-existing chart.
Added a regression test (test_chart_importer_skips_default_viewers_on_reimport)
asserting chart.viewers == [] on re-import.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]