Skip to content

Commit 8c2d9b0

Browse files
committed
[OP-19546] Migrate lodash sortBy in module frontends
The linked-plugin frontends share the global `_` but were outside the frontend/src sweep. Switches `sortBy` in the GitLab and GitHub modules to the `lodash-es` named import (`_.flatten` here is handled in #23732).
1 parent 9e50487 commit 8c2d9b0

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

modules/github_integration/frontend/module/tab-prs/tab-prs.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
// See COPYRIGHT and LICENSE files for more details.
2727
//++
2828

29+
import { sortBy } from 'lodash-es';
2930
import { ChangeDetectionStrategy, Component, HostBinding, Input, OnInit, inject } from '@angular/core';
3031
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
3132
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
@@ -63,7 +64,7 @@ export class TabPrsComponent implements OnInit {
6364
.githubPullRequests
6465
.ofWorkPackage(this.workPackage)
6566
.pipe(
66-
map((elements) => _.sortBy(elements, 'updatedAt')),
67+
map((elements) => sortBy(elements, 'updatedAt')),
6768
shareReplay(1),
6869
);
6970
}

modules/gitlab_integration/frontend/module/tab-issue/wp-gitlab-issue.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
// See docs/COPYRIGHT.rdoc for more details.
2828
//++
2929

30+
import { sortBy } from 'lodash-es';
3031
import { WorkPackageResource } from "core-app/features/hal/resources/work-package-resource";
3132
import { HalResource } from "core-app/features/hal/resources/hal-resource";
3233
import { Injectable, inject } from '@angular/core';
@@ -45,6 +46,6 @@ export class WorkPackagesGitlabIssueService extends WorkPackageLinkedResourceCac
4546
}
4647

4748
protected sortList(gitlabIssue:HalResource[], attr = 'createdAt'):HalResource[] {
48-
return _.sortBy(_.flatten(gitlabIssue), attr);
49+
return sortBy(_.flatten(gitlabIssue), attr);
4950
}
5051
}

modules/gitlab_integration/frontend/module/tab-mrs/wp-gitlab-mrs.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
// See docs/COPYRIGHT.rdoc for more details.
2828
//++
2929

30+
import { sortBy } from 'lodash-es';
3031
import { WorkPackageResource } from "core-app/features/hal/resources/work-package-resource";
3132
import { HalResource } from "core-app/features/hal/resources/hal-resource";
3233
import { Injectable, inject } from '@angular/core';
@@ -45,6 +46,6 @@ export class WorkPackagesGitlabMrsService extends WorkPackageLinkedResourceCache
4546
}
4647

4748
protected sortList(mergeRequests:HalResource[], attr = 'createdAt'):HalResource[] {
48-
return _.sortBy(_.flatten(mergeRequests), attr);
49+
return sortBy(_.flatten(mergeRequests), attr);
4950
}
5051
}

0 commit comments

Comments
 (0)