Copilot commented on code in PR #42404:
URL: https://github.com/apache/superset/pull/42404#discussion_r3826415850


##########
superset/migrations/versions/2026-07-24_00-00_f7e8d9c0b1a2_add_theme_editors_table.py:
##########
@@ -0,0 +1,142 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""add theme_editors table
+
+Revision ID: f7e8d9c0b1a2
+Revises: e5f6a7b8c9d0
+Create Date: 2026-07-24 00:00:00.000000

Review Comment:
   Migration header comment lists a different “Revises” value than the actual 
`down_revision` used by Alembic. This is confusing when auditing migration 
chains and should match `down_revision`.



##########
superset-frontend/src/features/themes/ThemeModal.tsx:
##########
@@ -139,13 +160,41 @@ const ThemeModal: FunctionComponent<ThemeModalProps> = ({
   const supersetTheme = useTheme();
   const { setTemporaryTheme } = useThemeContext();
   const [disableSave, setDisableSave] = useState<boolean>(true);
-  const [currentTheme, setCurrentTheme] = useState<ThemeObject | null>(null);
-  const [initialTheme, setInitialTheme] = useState<ThemeObject | null>(null);
+  const [currentTheme, setCurrentTheme] = useState<ThemeModalObject | null>(
+    null,
+  );
+  const [initialTheme, setInitialTheme] = useState<ThemeModalObject | null>(
+    null,
+  );
   const [isHidden, setIsHidden] = useState<boolean>(true);
   const [showConfirmAlert, setShowConfirmAlert] = useState<boolean>(false);
   const isEditMode = theme !== null;
   const isSystemTheme = currentTheme?.is_system === true;
-  const isReadOnly = isSystemTheme;
+
+  const currentUser = useSelector<any, UserWithPermissionsAndRoles>(
+    state => state.user,
+  );

Review Comment:
   Avoid `useSelector<any, ...>` here—this throws away Redux state typing and 
makes editor/admin checks easier to get wrong. Prefer a typed selector (or the 
project’s typed hooks) so the selector stays type-safe.
   
   This issue also appears in the following locations of the same file:
   - line 216
   - line 376



##########
UPDATING.md:
##########
@@ -24,6 +24,35 @@ assists people when migrating to a new version.
 
 ## Next
 
+### Themes support per-theme editors
+
+Themes now carry a list of **editors** (users, roles, or groups). A new
+`theme_editors` junction table is created by the migration
+`f7e8d9c0b1a2_add_theme_editors_table`. On upgrade, each existing non-system
+theme's creator is backfilled as an editor so authors keep edit access (an
+empty editors list means admin-only). System themes are left with no editors

Review Comment:
   The UPDATING entry says the migration backfills each existing non-system 
theme’s creator into `theme_editors`, but the PR description states “no data 
backfill”. The migration code also includes a backfill step, so the written 
documentation and PR description are currently inconsistent—please align them 
so operators understand what the upgrade actually does.



##########
superset-frontend/src/pages/ThemeList/index.tsx:
##########
@@ -113,6 +117,9 @@ function ThemesList({
     refreshData,
     toggleBulkSelect,
   } = useListViewResource<ThemeObject>('theme', t('Themes'), addDangerToast);
+  const currentUser = useSelector<any, UserWithPermissionsAndRoles>(
+    state => state.user,
+  );

Review Comment:
   Avoid `useSelector<any, ...>` here—this discards the app’s Redux typing. 
Using a typed selector (or the project’s typed hooks) keeps permission logic 
type-safe.



-- 
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]

Reply via email to