Skip to content

Commit 142c56e

Browse files
authored
Merge pull request #2110 from makeplane/sync/ce-ee
Sync: Community Changes
2 parents a8c2128 + ea73f20 commit 142c56e

File tree

17 files changed

+137
-88
lines changed

17 files changed

+137
-88
lines changed

packages/types/src/search.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,5 @@ export type TSearchEntityRequestPayload = {
7474
query_type: TSearchEntities[];
7575
query: string;
7676
team_id?: string;
77+
issue_id?: string;
7778
};

web/core/components/command-palette/actions/issue-actions/change-assignee.tsx

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -33,31 +33,34 @@ export const ChangeIssueAssignee: React.FC<Props> = observer((props) => {
3333
} = useMember();
3434

3535
const options =
36-
projectMemberIds?.map((userId) => {
37-
const memberDetails = getProjectMemberDetails(userId);
36+
projectMemberIds
37+
?.map((userId) => {
38+
if (!projectId) return;
39+
const memberDetails = getProjectMemberDetails(userId, projectId.toString());
3840

39-
return {
40-
value: `${memberDetails?.member?.id}`,
41-
query: `${memberDetails?.member?.display_name}`,
42-
content: (
43-
<>
44-
<div className="flex items-center gap-2">
45-
<Avatar
46-
name={memberDetails?.member?.display_name}
47-
src={getFileURL(memberDetails?.member?.avatar_url ?? "")}
48-
showTooltip={false}
49-
/>
50-
{memberDetails?.member?.display_name}
51-
</div>
52-
{issue.assignee_ids.includes(memberDetails?.member?.id ?? "") && (
53-
<div>
54-
<Check className="h-3 w-3" />
41+
return {
42+
value: `${memberDetails?.member?.id}`,
43+
query: `${memberDetails?.member?.display_name}`,
44+
content: (
45+
<>
46+
<div className="flex items-center gap-2">
47+
<Avatar
48+
name={memberDetails?.member?.display_name}
49+
src={getFileURL(memberDetails?.member?.avatar_url ?? "")}
50+
showTooltip={false}
51+
/>
52+
{memberDetails?.member?.display_name}
5553
</div>
56-
)}
57-
</>
58-
),
59-
};
60-
}) ?? [];
54+
{issue.assignee_ids.includes(memberDetails?.member?.id ?? "") && (
55+
<div>
56+
<Check className="h-3 w-3" />
57+
</div>
58+
)}
59+
</>
60+
),
61+
};
62+
})
63+
.filter((o) => o !== undefined) ?? [];
6164

6265
const handleUpdateIssue = async (formData: Partial<TIssue>) => {
6366
if (!workspaceSlug || !projectId || !issue) return;
@@ -80,15 +83,18 @@ export const ChangeIssueAssignee: React.FC<Props> = observer((props) => {
8083

8184
return (
8285
<>
83-
{options.map((option) => (
84-
<Command.Item
85-
key={option.value}
86-
onSelect={() => handleIssueAssignees(option.value)}
87-
className="focus:outline-none"
88-
>
89-
{option.content}
90-
</Command.Item>
91-
))}
86+
{options.map(
87+
(option) =>
88+
option && (
89+
<Command.Item
90+
key={option.value}
91+
onSelect={() => handleIssueAssignees(option.value)}
92+
className="focus:outline-none"
93+
>
94+
{option.content}
95+
</Command.Item>
96+
)
97+
)}
9298
</>
9399
);
94100
});

web/core/components/dropdowns/member/member-options.tsx

Lines changed: 46 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { getFileURL } from "@/helpers/file.helper";
1717
// hooks
1818
import { useUser, useMember } from "@/hooks/store";
1919
import { usePlatformOS } from "@/hooks/use-platform-os";
20+
import { EUserPermissions } from "@/plane-web/constants";
2021

2122
interface Props {
2223
className?: string;
@@ -39,7 +40,7 @@ export const MemberOptions: React.FC<Props> = observer((props: Props) => {
3940
const { workspaceSlug } = useParams();
4041
const {
4142
getUserDetails,
42-
project: { getProjectMemberIds, fetchProjectMembers },
43+
project: { getProjectMemberIds, fetchProjectMembers, getProjectMemberDetails },
4344
workspace: { workspaceMemberIds },
4445
} = useMember();
4546
const { data: currentUser } = useUser();
@@ -78,23 +79,32 @@ export const MemberOptions: React.FC<Props> = observer((props: Props) => {
7879
}
7980
};
8081

81-
const options = memberIds?.map((userId) => {
82-
const userDetails = getUserDetails(userId);
82+
const options = memberIds
83+
?.map((userId) => {
84+
const userDetails = getUserDetails(userId);
85+
if (projectId) {
86+
const role = getProjectMemberDetails(userId, projectId)?.role;
87+
const isGuest = role === EUserPermissions.GUEST;
88+
if (isGuest) return;
89+
}
8390

84-
return {
85-
value: userId,
86-
query: `${userDetails?.display_name} ${userDetails?.first_name} ${userDetails?.last_name}`,
87-
content: (
88-
<div className="flex items-center gap-2">
89-
<Avatar name={userDetails?.display_name} src={getFileURL(userDetails?.avatar_url ?? "")} />
90-
<span className="flex-grow truncate">{currentUser?.id === userId ? t("you") : userDetails?.display_name}</span>
91-
</div>
92-
),
93-
};
94-
});
91+
return {
92+
value: userId,
93+
query: `${userDetails?.display_name} ${userDetails?.first_name} ${userDetails?.last_name}`,
94+
content: (
95+
<div className="flex items-center gap-2">
96+
<Avatar name={userDetails?.display_name} src={getFileURL(userDetails?.avatar_url ?? "")} />
97+
<span className="flex-grow truncate">
98+
{currentUser?.id === userId ? t("you") : userDetails?.display_name}
99+
</span>
100+
</div>
101+
),
102+
};
103+
})
104+
.filter((o) => !!o);
95105

96106
const filteredOptions =
97-
query === "" ? options : options?.filter((o) => o.query.toLowerCase().includes(query.toLowerCase()));
107+
query === "" ? options : options?.filter((o) => o?.query.toLowerCase().includes(query.toLowerCase()));
98108

99109
return createPortal(
100110
<Combobox.Options data-prevent-outside-click static>
@@ -125,24 +135,27 @@ export const MemberOptions: React.FC<Props> = observer((props: Props) => {
125135
<div className="mt-2 max-h-48 space-y-1 overflow-y-scroll">
126136
{filteredOptions ? (
127137
filteredOptions.length > 0 ? (
128-
filteredOptions.map((option) => (
129-
<Combobox.Option
130-
key={option.value}
131-
value={option.value}
132-
className={({ active, selected }) =>
133-
`flex w-full cursor-pointer select-none items-center justify-between gap-2 truncate rounded px-1 py-1.5 ${
134-
active ? "bg-custom-background-80" : ""
135-
} ${selected ? "text-custom-text-100" : "text-custom-text-200"}`
136-
}
137-
>
138-
{({ selected }) => (
139-
<>
140-
<span className="flex-grow truncate">{option.content}</span>
141-
{selected && <Check className="h-3.5 w-3.5 flex-shrink-0" />}
142-
</>
143-
)}
144-
</Combobox.Option>
145-
))
138+
filteredOptions.map(
139+
(option) =>
140+
option && (
141+
<Combobox.Option
142+
key={option.value}
143+
value={option.value}
144+
className={({ active, selected }) =>
145+
`flex w-full cursor-pointer select-none items-center justify-between gap-2 truncate rounded px-1 py-1.5 ${
146+
active ? "bg-custom-background-80" : ""
147+
} ${selected ? "text-custom-text-100" : "text-custom-text-200"}`
148+
}
149+
>
150+
{({ selected }) => (
151+
<>
152+
<span className="flex-grow truncate">{option.content}</span>
153+
{selected && <Check className="h-3.5 w-3.5 flex-shrink-0" />}
154+
</>
155+
)}
156+
</Combobox.Option>
157+
)
158+
)
146159
) : (
147160
<p className="px-1.5 py-1 italic text-custom-text-400">{t("no_matching_results")}</p>
148161
)

web/core/components/editor/embeds/mentions/user.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ type Props = {
1919

2020
export const EditorUserMention: React.FC<Props> = observer((props) => {
2121
const { id } = props;
22+
// router
23+
const { projectId } = useParams();
2224
// states
2325
const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);
2426
const [referenceElement, setReferenceElement] = useState<HTMLAnchorElement | null>(null);
@@ -44,7 +46,7 @@ export const EditorUserMention: React.FC<Props> = observer((props) => {
4446
});
4547
// derived values
4648
const userDetails = getUserDetails(id);
47-
const roleDetails = getProjectMemberDetails(id)?.role;
49+
const roleDetails = projectId ? getProjectMemberDetails(id, projectId.toString())?.role : null;
4850
const profileLink = `/${workspaceSlug}/profile/${id}`;
4951

5052
if (!userDetails) {

web/core/components/editor/lite-text-editor/lite-text-editor.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ interface LiteTextEditorWrapperProps
3131
showToolbarInitially?: boolean;
3232
showToolbar?: boolean;
3333
uploadFile: (file: File) => Promise<string>;
34+
issue_id?: string;
3435
parentClassName?: string;
3536
}
3637

@@ -40,6 +41,7 @@ export const LiteTextEditor = React.forwardRef<EditorRefApi, LiteTextEditorWrapp
4041
workspaceSlug,
4142
workspaceId,
4243
projectId,
44+
issue_id,
4345
accessSpecifier,
4446
handleAccessChange,
4547
showAccessSpecifier = false,
@@ -62,6 +64,7 @@ export const LiteTextEditor = React.forwardRef<EditorRefApi, LiteTextEditorWrapp
6264
await workspaceService.searchEntity(workspaceSlug?.toString() ?? "", {
6365
...payload,
6466
project_id: projectId?.toString() ?? "",
67+
issue_id: issue_id,
6568
}),
6669
});
6770
// file size

web/core/components/issues/description-input.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ export const IssueDescriptionInput: FC<IssueDescriptionInputProps> = observer((p
125125
await workspaceService.searchEntity(workspaceSlug?.toString() ?? "", {
126126
...payload,
127127
project_id: projectId?.toString() ?? "",
128+
issue_id: issueId?.toString(),
128129
})
129130
}
130131
containerClassName={containerClassName}

web/core/components/issues/issue-detail/issue-activity/activity-comment-root.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export const IssueActivityCommentRoot: FC<TIssueActivityCommentRoot> = observer(
4444
activityComment.activity_type === "COMMENT" ? (
4545
<IssueCommentCard
4646
projectId={projectId}
47+
issueId={issueId}
4748
key={activityComment.id}
4849
workspaceSlug={workspaceSlug}
4950
commentId={activityComment.id}

web/core/components/issues/issue-detail/issue-activity/comments/comment-card.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { IssueCommentBlock } from "./comment-block";
2222

2323
type TIssueCommentCard = {
2424
projectId: string;
25+
issueId: string;
2526
workspaceSlug: string;
2627
commentId: string;
2728
activityOperations: TActivityOperations;
@@ -34,6 +35,7 @@ export const IssueCommentCard: FC<TIssueCommentCard> = observer((props) => {
3435
const {
3536
workspaceSlug,
3637
projectId,
38+
issueId,
3739
commentId,
3840
activityOperations,
3941
ends,
@@ -144,6 +146,7 @@ export const IssueCommentCard: FC<TIssueCommentCard> = observer((props) => {
144146
<LiteTextEditor
145147
workspaceId={workspaceId}
146148
projectId={projectId}
149+
issue_id={issueId}
147150
workspaceSlug={workspaceSlug}
148151
ref={editorRef}
149152
id={comment.id}

web/core/components/issues/issue-detail/issue-activity/comments/comment-create.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ export const IssueCommentCreate: FC<TIssueCommentCreate> = (props) => {
117117
value={"<p></p>"}
118118
projectId={projectId}
119119
workspaceSlug={workspaceSlug}
120+
issue_id={issueId}
120121
onEnterKeyPress={(e) => {
121122
if (!isEmpty && !isSubmitting) {
122123
handleSubmit(onSubmit)(e);

web/core/components/issues/issue-detail/issue-activity/comments/root.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export const IssueCommentRoot: FC<TIssueCommentRoot> = observer((props) => {
3636
commentIds.map((commentId, index) => (
3737
<IssueCommentCard
3838
projectId={projectId}
39+
issueId={issueId}
3940
key={commentId}
4041
workspaceSlug={workspaceSlug}
4142
commentId={commentId}

0 commit comments

Comments
 (0)