Skip to content

Commit

Permalink
[WEB-1671] fix: expired snooze issues fixed (makeplane#5270)
Browse files Browse the repository at this point in the history
* fix: expired snooze issues fixed

* fix: refactored
  • Loading branch information
gakshita authored Jul 31, 2024
1 parent f75df83 commit 569b592
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion web/core/components/inbox/inbox-issue-status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ export const InboxIssueStatus: React.FC<Props> = observer((props) => {
const { inboxIssue, iconSize = 16, showDescription = false } = props;
// derived values
const inboxIssueStatusDetail = INBOX_STATUS.find((s) => s.status === inboxIssue.status);
if (!inboxIssueStatusDetail) return <></>;

const isSnoozedDatePassed = inboxIssue.status === 0 && new Date(inboxIssue.snoozed_till ?? "") < new Date();
if (!inboxIssueStatusDetail || isSnoozedDatePassed) return <></>;

const description = inboxIssueStatusDetail.description(new Date(inboxIssue.snoozed_till ?? ""));

Expand Down
21 changes: 19 additions & 2 deletions web/core/store/inbox/project-inbox.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,24 @@ export class ProjectInboxStore implements IProjectInboxStore {
? [EInboxIssueStatus.PENDING, EInboxIssueStatus.SNOOZED]
: [EInboxIssueStatus.ACCEPTED, EInboxIssueStatus.DECLINED, EInboxIssueStatus.DUPLICATE];
appliedFilters = appliedFilters.filter((filter) => this.inboxFilters?.status?.includes(filter));
const currentTime = new Date().getTime();

return this.inboxIssueIds.filter((id) => appliedFilters.includes(this.inboxIssues[id].status));
return this.currentTab === EInboxIssueCurrentTab.OPEN
? this.inboxIssueIds.filter((id) => {
if (appliedFilters.length == 2) return true;
if (appliedFilters[0] === EInboxIssueStatus.SNOOZED)
return (
this.inboxIssues[id].status === EInboxIssueStatus.SNOOZED &&
currentTime < new Date(this.inboxIssues[id].snoozed_till!).getTime()
);
if (appliedFilters[0] === EInboxIssueStatus.PENDING)
return (
appliedFilters.includes(this.inboxIssues[id].status) ||
(this.inboxIssues[id].status === EInboxIssueStatus.SNOOZED &&
currentTime > new Date(this.inboxIssues[id].snoozed_till!).getTime())
);
})
: this.inboxIssueIds.filter((id) => appliedFilters.includes(this.inboxIssues[id].status));
}

getIssueInboxByIssueId = computedFn((issueId: string) => this.inboxIssues?.[issueId]);
Expand Down Expand Up @@ -320,8 +336,9 @@ export class ProjectInboxStore implements IProjectInboxStore {
else this.loader = "mutation-loading";
if (loadingType) this.loader = loadingType;

const status = this.inboxFilters.status && uniq([...this.inboxFilters.status, EInboxIssueStatus.SNOOZED]);
const queryParams = this.inboxIssueQueryParams(
this.inboxFilters,
{ ...this.inboxFilters, status },
this.inboxSorting,
this.PER_PAGE_COUNT,
`${this.PER_PAGE_COUNT}:0:0`
Expand Down

0 comments on commit 569b592

Please sign in to comment.