forked from github/plane
chore: add issue option removed from subscribed issue page (#2088)
* chore: condition for subscribed page add issue option * chore: condition for subscribed page add issue option
This commit is contained in:
parent
9423472838
commit
71394d3316
@ -53,6 +53,7 @@ type Props = {
|
|||||||
handleOnDragEnd: (result: DropResult) => Promise<void>;
|
handleOnDragEnd: (result: DropResult) => Promise<void>;
|
||||||
openIssuesListModal: (() => void) | null;
|
openIssuesListModal: (() => void) | null;
|
||||||
removeIssue: ((bridgeId: string, issueId: string) => void) | null;
|
removeIssue: ((bridgeId: string, issueId: string) => void) | null;
|
||||||
|
disableAddIssueOption?: boolean;
|
||||||
trashBox: boolean;
|
trashBox: boolean;
|
||||||
setTrashBox: React.Dispatch<React.SetStateAction<boolean>>;
|
setTrashBox: React.Dispatch<React.SetStateAction<boolean>>;
|
||||||
viewProps: IIssueViewProps;
|
viewProps: IIssueViewProps;
|
||||||
@ -68,6 +69,7 @@ export const AllViews: React.FC<Props> = ({
|
|||||||
handleOnDragEnd,
|
handleOnDragEnd,
|
||||||
openIssuesListModal,
|
openIssuesListModal,
|
||||||
removeIssue,
|
removeIssue,
|
||||||
|
disableAddIssueOption = false,
|
||||||
trashBox,
|
trashBox,
|
||||||
setTrashBox,
|
setTrashBox,
|
||||||
viewProps,
|
viewProps,
|
||||||
@ -127,6 +129,7 @@ export const AllViews: React.FC<Props> = ({
|
|||||||
openIssuesListModal={cycleId || moduleId ? openIssuesListModal : null}
|
openIssuesListModal={cycleId || moduleId ? openIssuesListModal : null}
|
||||||
removeIssue={removeIssue}
|
removeIssue={removeIssue}
|
||||||
disableUserActions={disableUserActions}
|
disableUserActions={disableUserActions}
|
||||||
|
disableAddIssueOption={disableAddIssueOption}
|
||||||
user={user}
|
user={user}
|
||||||
userAuth={memberRole}
|
userAuth={memberRole}
|
||||||
viewProps={viewProps}
|
viewProps={viewProps}
|
||||||
@ -135,6 +138,7 @@ export const AllViews: React.FC<Props> = ({
|
|||||||
<AllBoards
|
<AllBoards
|
||||||
addIssueToGroup={addIssueToGroup}
|
addIssueToGroup={addIssueToGroup}
|
||||||
disableUserActions={disableUserActions}
|
disableUserActions={disableUserActions}
|
||||||
|
disableAddIssueOption={disableAddIssueOption}
|
||||||
dragDisabled={dragDisabled}
|
dragDisabled={dragDisabled}
|
||||||
handleIssueAction={handleIssueAction}
|
handleIssueAction={handleIssueAction}
|
||||||
handleTrashBox={handleTrashBox}
|
handleTrashBox={handleTrashBox}
|
||||||
|
@ -10,6 +10,7 @@ import { ICurrentUserResponse, IIssue, IIssueViewProps, IState, UserAuth } from
|
|||||||
type Props = {
|
type Props = {
|
||||||
addIssueToGroup: (groupTitle: string) => void;
|
addIssueToGroup: (groupTitle: string) => void;
|
||||||
disableUserActions: boolean;
|
disableUserActions: boolean;
|
||||||
|
disableAddIssueOption?: boolean;
|
||||||
dragDisabled: boolean;
|
dragDisabled: boolean;
|
||||||
handleIssueAction: (issue: IIssue, action: "copy" | "delete" | "edit") => void;
|
handleIssueAction: (issue: IIssue, action: "copy" | "delete" | "edit") => void;
|
||||||
handleTrashBox: (isDragging: boolean) => void;
|
handleTrashBox: (isDragging: boolean) => void;
|
||||||
@ -24,6 +25,7 @@ type Props = {
|
|||||||
export const AllBoards: React.FC<Props> = ({
|
export const AllBoards: React.FC<Props> = ({
|
||||||
addIssueToGroup,
|
addIssueToGroup,
|
||||||
disableUserActions,
|
disableUserActions,
|
||||||
|
disableAddIssueOption = false,
|
||||||
dragDisabled,
|
dragDisabled,
|
||||||
handleIssueAction,
|
handleIssueAction,
|
||||||
handleTrashBox,
|
handleTrashBox,
|
||||||
@ -52,6 +54,7 @@ export const AllBoards: React.FC<Props> = ({
|
|||||||
addIssueToGroup={() => addIssueToGroup(singleGroup)}
|
addIssueToGroup={() => addIssueToGroup(singleGroup)}
|
||||||
currentState={currentState}
|
currentState={currentState}
|
||||||
disableUserActions={disableUserActions}
|
disableUserActions={disableUserActions}
|
||||||
|
disableAddIssueOption={disableAddIssueOption}
|
||||||
dragDisabled={dragDisabled}
|
dragDisabled={dragDisabled}
|
||||||
groupTitle={singleGroup}
|
groupTitle={singleGroup}
|
||||||
handleIssueAction={handleIssueAction}
|
handleIssueAction={handleIssueAction}
|
||||||
|
@ -20,6 +20,7 @@ type Props = {
|
|||||||
addIssueToGroup: () => void;
|
addIssueToGroup: () => void;
|
||||||
currentState?: IState | null;
|
currentState?: IState | null;
|
||||||
disableUserActions: boolean;
|
disableUserActions: boolean;
|
||||||
|
disableAddIssueOption?: boolean;
|
||||||
dragDisabled: boolean;
|
dragDisabled: boolean;
|
||||||
groupTitle: string;
|
groupTitle: string;
|
||||||
handleIssueAction: (issue: IIssue, action: "copy" | "delete" | "edit") => void;
|
handleIssueAction: (issue: IIssue, action: "copy" | "delete" | "edit") => void;
|
||||||
@ -36,6 +37,7 @@ export const SingleBoard: React.FC<Props> = ({
|
|||||||
currentState,
|
currentState,
|
||||||
groupTitle,
|
groupTitle,
|
||||||
disableUserActions,
|
disableUserActions,
|
||||||
|
disableAddIssueOption = false,
|
||||||
dragDisabled,
|
dragDisabled,
|
||||||
handleIssueAction,
|
handleIssueAction,
|
||||||
handleTrashBox,
|
handleTrashBox,
|
||||||
@ -53,8 +55,6 @@ export const SingleBoard: React.FC<Props> = ({
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { cycleId, moduleId } = router.query;
|
const { cycleId, moduleId } = router.query;
|
||||||
|
|
||||||
const isSubscribedIssues = router.pathname.includes("subscribed");
|
|
||||||
|
|
||||||
const type = cycleId ? "cycle" : moduleId ? "module" : "issue";
|
const type = cycleId ? "cycle" : moduleId ? "module" : "issue";
|
||||||
|
|
||||||
// Check if it has at least 4 tickets since it is enough to accommodate the Calendar height
|
// Check if it has at least 4 tickets since it is enough to accommodate the Calendar height
|
||||||
@ -72,7 +72,7 @@ export const SingleBoard: React.FC<Props> = ({
|
|||||||
isCollapsed={isCollapsed}
|
isCollapsed={isCollapsed}
|
||||||
setIsCollapsed={setIsCollapsed}
|
setIsCollapsed={setIsCollapsed}
|
||||||
disableUserActions={disableUserActions}
|
disableUserActions={disableUserActions}
|
||||||
disableAddIssue={isSubscribedIssues}
|
disableAddIssue={disableAddIssueOption}
|
||||||
viewProps={viewProps}
|
viewProps={viewProps}
|
||||||
/>
|
/>
|
||||||
{isCollapsed && (
|
{isCollapsed && (
|
||||||
@ -154,7 +154,7 @@ export const SingleBoard: React.FC<Props> = ({
|
|||||||
{selectedGroup !== "created_by" && (
|
{selectedGroup !== "created_by" && (
|
||||||
<div>
|
<div>
|
||||||
{type === "issue"
|
{type === "issue"
|
||||||
? !isSubscribedIssues && (
|
? !disableAddIssueOption && (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="flex items-center gap-2 font-medium text-custom-primary outline-none p-1"
|
className="flex items-center gap-2 font-medium text-custom-primary outline-none p-1"
|
||||||
|
@ -11,6 +11,7 @@ type Props = {
|
|||||||
openIssuesListModal?: (() => void) | null;
|
openIssuesListModal?: (() => void) | null;
|
||||||
removeIssue: ((bridgeId: string, issueId: string) => void) | null;
|
removeIssue: ((bridgeId: string, issueId: string) => void) | null;
|
||||||
disableUserActions: boolean;
|
disableUserActions: boolean;
|
||||||
|
disableAddIssueOption?: boolean;
|
||||||
user: ICurrentUserResponse | undefined;
|
user: ICurrentUserResponse | undefined;
|
||||||
userAuth: UserAuth;
|
userAuth: UserAuth;
|
||||||
viewProps: IIssueViewProps;
|
viewProps: IIssueViewProps;
|
||||||
@ -20,6 +21,7 @@ export const AllLists: React.FC<Props> = ({
|
|||||||
addIssueToGroup,
|
addIssueToGroup,
|
||||||
handleIssueAction,
|
handleIssueAction,
|
||||||
disableUserActions,
|
disableUserActions,
|
||||||
|
disableAddIssueOption = false,
|
||||||
openIssuesListModal,
|
openIssuesListModal,
|
||||||
removeIssue,
|
removeIssue,
|
||||||
states,
|
states,
|
||||||
@ -49,6 +51,7 @@ export const AllLists: React.FC<Props> = ({
|
|||||||
openIssuesListModal={openIssuesListModal}
|
openIssuesListModal={openIssuesListModal}
|
||||||
removeIssue={removeIssue}
|
removeIssue={removeIssue}
|
||||||
disableUserActions={disableUserActions}
|
disableUserActions={disableUserActions}
|
||||||
|
disableAddIssueOption={disableAddIssueOption}
|
||||||
user={user}
|
user={user}
|
||||||
userAuth={userAuth}
|
userAuth={userAuth}
|
||||||
viewProps={viewProps}
|
viewProps={viewProps}
|
||||||
|
@ -39,6 +39,7 @@ type Props = {
|
|||||||
openIssuesListModal?: (() => void) | null;
|
openIssuesListModal?: (() => void) | null;
|
||||||
removeIssue: ((bridgeId: string, issueId: string) => void) | null;
|
removeIssue: ((bridgeId: string, issueId: string) => void) | null;
|
||||||
disableUserActions: boolean;
|
disableUserActions: boolean;
|
||||||
|
disableAddIssueOption?: boolean;
|
||||||
user: ICurrentUserResponse | undefined;
|
user: ICurrentUserResponse | undefined;
|
||||||
userAuth: UserAuth;
|
userAuth: UserAuth;
|
||||||
viewProps: IIssueViewProps;
|
viewProps: IIssueViewProps;
|
||||||
@ -52,6 +53,7 @@ export const SingleList: React.FC<Props> = ({
|
|||||||
openIssuesListModal,
|
openIssuesListModal,
|
||||||
removeIssue,
|
removeIssue,
|
||||||
disableUserActions,
|
disableUserActions,
|
||||||
|
disableAddIssueOption = false,
|
||||||
user,
|
user,
|
||||||
userAuth,
|
userAuth,
|
||||||
viewProps,
|
viewProps,
|
||||||
@ -60,7 +62,6 @@ export const SingleList: React.FC<Props> = ({
|
|||||||
const { workspaceSlug, projectId, cycleId, moduleId } = router.query;
|
const { workspaceSlug, projectId, cycleId, moduleId } = router.query;
|
||||||
|
|
||||||
const isArchivedIssues = router.pathname.includes("archived-issues");
|
const isArchivedIssues = router.pathname.includes("archived-issues");
|
||||||
const isSubscribedIssues = router.pathname.includes("subscribed");
|
|
||||||
|
|
||||||
const type = cycleId ? "cycle" : moduleId ? "module" : "issue";
|
const type = cycleId ? "cycle" : moduleId ? "module" : "issue";
|
||||||
|
|
||||||
@ -181,7 +182,7 @@ export const SingleList: React.FC<Props> = ({
|
|||||||
{isArchivedIssues ? (
|
{isArchivedIssues ? (
|
||||||
""
|
""
|
||||||
) : type === "issue" ? (
|
) : type === "issue" ? (
|
||||||
!isSubscribedIssues && (
|
!disableAddIssueOption && (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="p-1 text-custom-text-200 hover:bg-custom-background-80"
|
className="p-1 text-custom-text-200 hover:bg-custom-background-80"
|
||||||
|
@ -209,6 +209,15 @@ export const MyIssuesView: React.FC<Props> = ({
|
|||||||
Object.keys(filtersToDisplay).length > 0 &&
|
Object.keys(filtersToDisplay).length > 0 &&
|
||||||
nullFilters.length !== Object.keys(filtersToDisplay).length;
|
nullFilters.length !== Object.keys(filtersToDisplay).length;
|
||||||
|
|
||||||
|
const isSubscribedIssuesRoute = router.pathname.includes("subscribed");
|
||||||
|
const isMySubscribedIssues =
|
||||||
|
(filters.subscriber &&
|
||||||
|
filters.subscriber.length > 0 &&
|
||||||
|
router.pathname.includes("my-issues")) ??
|
||||||
|
false;
|
||||||
|
|
||||||
|
const disableAddIssueOption = isSubscribedIssuesRoute || isMySubscribedIssues;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<CreateUpdateIssueModal
|
<CreateUpdateIssueModal
|
||||||
@ -291,6 +300,7 @@ export const MyIssuesView: React.FC<Props> = ({
|
|||||||
handleIssueAction={handleIssueAction}
|
handleIssueAction={handleIssueAction}
|
||||||
openIssuesListModal={openIssuesListModal ? openIssuesListModal : null}
|
openIssuesListModal={openIssuesListModal ? openIssuesListModal : null}
|
||||||
removeIssue={null}
|
removeIssue={null}
|
||||||
|
disableAddIssueOption={disableAddIssueOption}
|
||||||
trashBox={trashBox}
|
trashBox={trashBox}
|
||||||
setTrashBox={setTrashBox}
|
setTrashBox={setTrashBox}
|
||||||
viewProps={{
|
viewProps={{
|
||||||
|
@ -223,6 +223,15 @@ export const ProfileIssuesView = () => {
|
|||||||
Object.keys(filtersToDisplay).length > 0 &&
|
Object.keys(filtersToDisplay).length > 0 &&
|
||||||
nullFilters.length !== Object.keys(filtersToDisplay).length;
|
nullFilters.length !== Object.keys(filtersToDisplay).length;
|
||||||
|
|
||||||
|
const isSubscribedIssuesRoute = router.pathname.includes("subscribed");
|
||||||
|
const isMySubscribedIssues =
|
||||||
|
(filters.subscriber &&
|
||||||
|
filters.subscriber.length > 0 &&
|
||||||
|
router.pathname.includes("my-issues")) ??
|
||||||
|
false;
|
||||||
|
|
||||||
|
const disableAddIssueOption = isSubscribedIssuesRoute || isMySubscribedIssues;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<CreateUpdateIssueModal
|
<CreateUpdateIssueModal
|
||||||
@ -292,6 +301,7 @@ export const ProfileIssuesView = () => {
|
|||||||
handleIssueAction={handleIssueAction}
|
handleIssueAction={handleIssueAction}
|
||||||
openIssuesListModal={null}
|
openIssuesListModal={null}
|
||||||
removeIssue={null}
|
removeIssue={null}
|
||||||
|
disableAddIssueOption={disableAddIssueOption}
|
||||||
trashBox={trashBox}
|
trashBox={trashBox}
|
||||||
setTrashBox={setTrashBox}
|
setTrashBox={setTrashBox}
|
||||||
viewProps={{
|
viewProps={{
|
||||||
|
Loading…
Reference in New Issue
Block a user