Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

replace lodash's .remove by ECMAScript's .filter

ulfertscaacbf9363d0
diff --git a/frontend/src/app/features/work-packages/components/filters/abstract-filter-date-time-value/abstract-filter-date-time-value.controller.ts b/frontend/src/app/features/work-packages/components/filters/abstract-filter-date-time-value/abstract-filter-date-time-value.controller.ts
index 61d5d41415f..6b16d361750 100644
--- a/frontend/src/app/features/work-packages/components/filters/abstract-filter-date-time-value/abstract-filter-date-time-value.controller.ts
+++ b/frontend/src/app/features/work-packages/components/filters/abstract-filter-date-time-value/abstract-filter-date-time-value.controller.ts
@@ -45,7 +45,7 @@ export abstract class AbstractDateTimeValueController extends UntilDestroyedMixi
}
ngOnInit() {
- _.remove(this.filter.values as string[], (value) => !(value === '' || this.timezoneService.isValidISODateTime(value)));
+ this.filter.values = (this.filter.values as string[]).filter((value) => (value === '' || this.timezoneService.isValidISODateTime(value)));
}
public abstract get lowerBoundary():Moment|null;
@@ -79,17 +79,23 @@ export abstract class AbstractDateTimeValueController extends UntilDestroyedMixi
public get timeZoneText() {
if (this.lowerBoundary && this.upperBoundary) {
- return this.I18n.t('js.filter.time_zone_converted.two_values',
+ return this.I18n.t(
+ 'js.filter.time_zone_converted.two_values',
{
from: this.lowerBoundary.format('YYYY-MM-DD HH:mm'),
to: this.upperBoundary.format('YYYY-MM-DD HH:mm'),
- });
+ },
+);
} if (this.upperBoundary) {
- return this.I18n.t('js.filter.time_zone_converted.only_end',
- { to: this.upperBoundary.format('YYYY-MM-DD HH:mm') });
+ return this.I18n.t(
+ 'js.filter.time_zone_converted.only_end',
+ { to: this.upperBoundary.format('YYYY-MM-DD HH:mm') },
+);
} if (this.lowerBoundary) {
- return this.I18n.t('js.filter.time_zone_converted.only_start',
- { from: this.lowerBoundary.format('YYYY-MM-DD HH:mm') });
+ return this.I18n.t(
+'js.filter.time_zone_converted.only_start',
+ { from: this.lowerBoundary.format('YYYY-MM-DD HH:mm') },
+);
}
return '';
diff --git a/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.ts b/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.ts
index 960dd38115f..37f1ac824df 100644
--- a/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.ts
+++ b/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.ts
@@ -70,7 +70,7 @@ export class QueryFiltersComponent extends UntilDestroyedMixin implements OnInit
500,
);
- public remainingFilters:any[] = [];
+ public remainingFilters:QueryFilterResource[] = [];
public focusElementIndex = 0;
@@ -141,7 +141,7 @@ export class QueryFiltersComponent extends UntilDestroyedMixin implements OnInit
public deactivateFilter(removedFilter:QueryFilterInstanceResource) {
const index = this.filters.indexOf(removedFilter);
- _.remove(this.filters, (f) => f.id === removedFilter.id);
+ this.filters.splice(index, 1);
this.filtersChanged.emit(this.filters);
diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/watchers-tab/watchers-tab.component.ts b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/watchers-tab/watchers-tab.component.ts
index 14738a4b1cf..ca111c6169f 100644
--- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/watchers-tab/watchers-tab.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/watchers-tab/watchers-tab.component.ts
@@ -163,7 +163,7 @@ export class WorkPackageWatchersTabComponent extends UntilDestroyedMixin impleme
public removeWatcher(watcher:any) {
this.workPackage.removeWatcher.$link.$prepare({ user_id: watcher.id })()
.then(() => {
- _.remove(this.watching, (other:HalResource) => other.href === watcher.href);
+ this.watching = this.watching.filter((other:HalResource) => other.href !== watcher.href);
// Forcefully reload the resource to update the watch/unwatch links
// should the current user have been removed
diff --git a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-order.service.ts b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-order.service.ts
index d74f09e3a05..96777b637d1 100644
--- a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-order.service.ts
+++ b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-order.service.ts
@@ -47,12 +47,14 @@ import { firstValueFrom } from 'rxjs';
@Injectable()
export class WorkPackageViewOrderService extends WorkPackageQueryStateService<QueryOrder> {
- constructor(protected readonly querySpace:IsolatedQuerySpace,
+ constructor(
+ protected readonly querySpace:IsolatedQuerySpace,
protected readonly apiV3Service:ApiV3Service,
protected readonly states:States,
protected readonly causedUpdates:CausedUpdatesService,
protected readonly wpTableSortBy:WorkPackageViewSortByService,
- protected readonly pathHelper:PathHelperService) {
+ protected readonly pathHelper:PathHelperService,
+) {
super(querySpace);
}
@@ -88,7 +90,7 @@ export class WorkPackageViewOrderService extends WorkPackageQueryStateService<Qu
* Pull an item from the rendered list
*/
public remove(order:string[], wpId:string):string[] {
- _.remove(order, (id) => id === wpId);
+ order = order.filter((id) => id !== wpId);
this.update({ [wpId]: -1 });
return order;
}
diff --git a/frontend/src/app/shared/components/toaster/toast.service.ts b/frontend/src/app/shared/components/toaster/toast.service.ts
index 33be8b4cc30..5b1fff5448e 100644
--- a/frontend/src/app/shared/components/toaster/toast.service.ts
+++ b/frontend/src/app/shared/components/toaster/toast.service.ts
@@ -80,8 +80,7 @@ export class ToastService {
this.stack.doModify((current) => {
const nextValue = [toast].concat(current);
- _.remove(nextValue, (n, i) => i > 0 && this.removeOnAdd(n));
- return nextValue;
+ return [nextValue[0]].concat(nextValue.slice(1).filter((n, i) => !this.removeOnAdd(n)));
});
// auto-hide if success
@@ -168,8 +167,7 @@ export class ToastService {
public remove(toast:IToast):void {
this.stack.doModify((current) => {
- _.remove(current, (n) => n === toast);
- return current;
+ return current.filter((n) => n !== toast);
});
}
diff --git a/frontend/src/app/shared/helpers/drag-and-drop/drag-and-drop.service.ts b/frontend/src/app/shared/helpers/drag-and-drop/drag-and-drop.service.ts
index 5b0de00f25e..867407e22cd 100644
--- a/frontend/src/app/shared/helpers/drag-and-drop/drag-and-drop.service.ts
+++ b/frontend/src/app/shared/helpers/drag-and-drop/drag-and-drop.service.ts
@@ -63,8 +63,8 @@ export class DragAndDropService implements OnDestroy {
public remove(container:HTMLElement) {
if (this.initialized) {
- _.remove(this.drake!.containers, (el) => el === container);
- _.remove(this.members, (el) => el.dragContainer === container);
+ this.drake!.containers = this.drake!.containers.filter((el) => el !== container);
+ this.members = this.members.filter((el) => el.dragContainer !== container);
}
}