mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: Handled inbox issue sorting locally in inbox store (#4169)
This commit is contained in:
parent
5250c64be5
commit
9e3fedd0df
@ -1,7 +1,6 @@
|
|||||||
import isEmpty from "lodash/isEmpty";
|
import isEmpty from "lodash/isEmpty";
|
||||||
import omit from "lodash/omit";
|
import omit from "lodash/omit";
|
||||||
import orderBy from "lodash/orderBy";
|
import orderBy from "lodash/orderBy";
|
||||||
import reverse from "lodash/reverse";
|
|
||||||
import set from "lodash/set";
|
import set from "lodash/set";
|
||||||
import { action, computed, makeObservable, observable, runInAction } from "mobx";
|
import { action, computed, makeObservable, observable, runInAction } from "mobx";
|
||||||
import { computedFn } from "mobx-utils";
|
import { computedFn } from "mobx-utils";
|
||||||
@ -138,21 +137,21 @@ export class ProjectInboxStore implements IProjectInboxStore {
|
|||||||
|
|
||||||
// helpers
|
// helpers
|
||||||
inboxIssueSorting = (issues: IInboxIssueStore[]) => {
|
inboxIssueSorting = (issues: IInboxIssueStore[]) => {
|
||||||
console.log("issues", issues);
|
let inboxIssues: IInboxIssueStore[] = issues;
|
||||||
let inboxIssues: IInboxIssueStore[] = [];
|
inboxIssues = orderBy(inboxIssues, "issue.sequence_id", "desc");
|
||||||
if (this.inboxSorting?.order_by && this.inboxSorting?.sort_by) {
|
if (this.inboxSorting?.order_by && this.inboxSorting?.sort_by) {
|
||||||
switch (this.inboxSorting.order_by) {
|
switch (this.inboxSorting.order_by) {
|
||||||
case "issue__created_at":
|
case "issue__created_at":
|
||||||
if (this.inboxSorting.sort_by === "desc") inboxIssues = orderBy(issues, ["issue", "created_at"]);
|
if (this.inboxSorting.sort_by === "desc") inboxIssues = orderBy(inboxIssues, "issue.created_at", "desc");
|
||||||
else inboxIssues = reverse(orderBy(issues, ["issue", "created_at"]));
|
else inboxIssues = orderBy(inboxIssues, "issue.created_at", "asc");
|
||||||
case "issue__updated_at":
|
case "issue__updated_at":
|
||||||
if (this.inboxSorting.sort_by === "desc") inboxIssues = orderBy(issues, ["issue", "updated_at"]);
|
if (this.inboxSorting.sort_by === "desc") inboxIssues = orderBy(inboxIssues, "issue.updated_at", "desc");
|
||||||
else inboxIssues = reverse(orderBy(issues, ["issue", "updated_at"]));
|
else inboxIssues = orderBy(inboxIssues, "issue.updated_at", "asc");
|
||||||
case "issue__sequence_id":
|
case "issue__sequence_id":
|
||||||
if (this.inboxSorting.sort_by === "desc") inboxIssues = orderBy(issues, ["issue", "sequence_id"]);
|
if (this.inboxSorting.sort_by === "desc") inboxIssues = orderBy(inboxIssues, "issue.sequence_id", "desc");
|
||||||
else inboxIssues = reverse(orderBy(issues, ["issue", "sequence_id"]));
|
else inboxIssues = orderBy(inboxIssues, "issue.sequence_id", "asc");
|
||||||
default:
|
default:
|
||||||
inboxIssues = orderBy(issues, ["issue", "created_at"]);
|
inboxIssues = inboxIssues;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return inboxIssues;
|
return inboxIssues;
|
||||||
|
Loading…
Reference in New Issue
Block a user