codeant-ai-for-open-source[bot] commented on code in PR #45591:
URL: https://github.com/apache/superset/pull/45591#discussion_r4352710225
##########
superset-frontend/src/features/groups/utils.ts:
##########
@@ -19,9 +19,39 @@
import { t } from '@apache-superset/core/translation';
import { SupersetClient } from '@superset-ui/core';
import rison from 'rison';
+import {
+ SUBJECT_DETAIL_PROP,
+ SUBJECT_TEXT_LABEL_PROP,
+ SubjectSelectLabel,
+} from 'src/features/subjects/SubjectSelectLabel';
import { getUserDisplayLabel } from 'src/features/users/utils';
import { FormValues } from './types';
+type UserRecord = { id: number; email?: string } & Parameters<
+ typeof getUserDisplayLabel
+>[0];
+
+/**
+ * Build a select option for a user picker.
+ *
+ * The option shows the email under the display name, like the subject-based
+ * owner pickers do, so that a server-side match on email is visible to the
+ * person searching. Plain-text copies of both lines are attached under the
+ * subject filter props so AsyncSelect's client-side re-filter can match them
+ * (a React label is otherwise filtered as an empty string), and under `title`
+ * so ListView can serialize the chosen option's label into the URL.
+ */
+export const toUserSelectOption = (user: UserRecord) => {
+ const textLabel = getUserDisplayLabel(user);
+ return {
+ value: user.id,
+ label: SubjectSelectLabel({ label: textLabel, secondaryLabel: user.email
}),
+ title: textLabel,
+ [SUBJECT_TEXT_LABEL_PROP]: textLabel,
+ [SUBJECT_DETAIL_PROP]: user.email,
Review Comment:
✅ **CodeAnt verified this suggestion was addressed in subsequent commits and
marked this thread resolved** as of `9e33a4d`.
Added `username` to `USER_OPTION_FILTER_PROPS` and populated that property
on each user option, so client-side filtering includes username matches.
<sub>If that's not right, unresolve this thread and CodeAnt will leave it
open.</sub>
<!-- codeant-auto-resolve-reply -->
--
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]