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

Lint js and ruby

Benjamin Bädorf4518d10a850e
diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts
index 04672243624..8e88530ea67 100644
--- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts
+++ b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts
@@ -28,7 +28,7 @@
import { ChangeDetectorRef, Directive, OnInit } from '@angular/core';
import { Transition } from '@uirouter/core';
-import { combineLatest, Observable } from 'rxjs';
+import { combineLatest } from 'rxjs';
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
import { HalResource } from 'core-app/features/hal/resources/hal-resource';
import { ActivityEntryInfo } from 'core-app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-entry-info';
@@ -50,7 +50,7 @@ export class ActivityPanelBaseController extends UntilDestroyedMixin implements
// Visible activities
public visibleActivities:ActivityEntryInfo[] = [];
- public notifications: InAppNotification[] = [];
+ public notifications:InAppNotification[] = [];
public reverse:boolean;
@@ -92,8 +92,8 @@ export class ActivityPanelBaseController extends UntilDestroyedMixin implements
{
pageSize: NOTIFICATIONS_MAX_SIZE,
filters: [
- [ 'resourceId', '=', [ this.workPackageId ] ],
- [ 'resourceType', '=', [ 'WorkPackage' ] ],
+ ['resourceId', '=', [this.workPackageId]],
+ ['resourceType', '=', ['WorkPackage']],
],
},
),
@@ -138,7 +138,7 @@ export class ActivityPanelBaseController extends UntilDestroyedMixin implements
}
protected hasUnreadNotification(activityHref:string) {
- return !!this.notifications.find(notification => notification._links.activity?.href === activityHref);
+ return !!this.notifications.find((notification) => notification._links.activity?.href === activityHref);
}
public toggleComments() {
diff --git a/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-notifications-count.function.ts b/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-notifications-count.function.ts
index 7f38e0276e5..34bfd313a90 100644
--- a/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-notifications-count.function.ts
+++ b/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-notifications-count.function.ts
@@ -3,14 +3,14 @@ import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
import { APIV3Service } from 'core-app/core/apiv3/api-v3.service';
-import { InAppNotification, NOTIFICATIONS_MAX_SIZE } from 'core-app/features/in-app-notifications/store/in-app-notification.model';
+import { NOTIFICATIONS_MAX_SIZE } from 'core-app/features/in-app-notifications/store/in-app-notification.model';
export function workPackageNotificationsCount(
workPackage:WorkPackageResource,
injector:Injector,
):Observable<number> {
const apiV3Service = injector.get(APIV3Service);
- const wpId = workPackage.id!.toString();
+ const wpId = workPackage.id?.toString() || '';
return apiV3Service
.notifications
@@ -19,8 +19,8 @@ export function workPackageNotificationsCount(
{
pageSize: NOTIFICATIONS_MAX_SIZE,
filters: [
- [ 'resourceId', '=', [ wpId ] ],
- [ 'resourceType', '=', [ 'WorkPackage' ] ],
+ ['resourceId', '=', [wpId]],
+ ['resourceType', '=', ['WorkPackage']],
],
},
)
diff --git a/spec/features/work_packages/tabs/activity_notifications_spec.rb b/spec/features/work_packages/tabs/activity_notifications_spec.rb
index c3aeae39cfe..a7f8083bb1d 100644
--- a/spec/features/work_packages/tabs/activity_notifications_spec.rb
+++ b/spec/features/work_packages/tabs/activity_notifications_spec.rb
@@ -10,18 +10,12 @@ describe 'Activity tab notifications', js: true, selenium: true do
project: project,
created_at: 5.days.ago.to_date.to_s(:db))
- work_package.update({
- journal_notes: 'First comment on this wp.',
- updated_at: 5.days.ago.to_date.to_s
- })
- work_package.update({
- journal_notes: 'Second comment on this wp.',
- updated_at: 4.days.ago.to_date.to_s
- })
- work_package.update({
- journal_notes: 'Third comment on this wp.',
- updated_at: 3.days.ago.to_date.to_s
- })
+ work_package.update({ journal_notes: 'First comment on this wp.',
+ updated_at: 5.days.ago.to_date.to_s })
+ work_package.update({ journal_notes: 'Second comment on this wp.',
+ updated_at: 4.days.ago.to_date.to_s })
+ work_package.update({ journal_notes: 'Third comment on this wp.',
+ updated_at: 3.days.ago.to_date.to_s })
work_package
end
@@ -33,7 +27,7 @@ describe 'Activity tab notifications', js: true, selenium: true do
full_view.visit!
end
- context 'has notifications for the work package' do
+ context 'when there are notifications for the work package' do
shared_let(:notification) do
FactoryBot.create :notification,
recipient: admin,
@@ -52,7 +46,7 @@ describe 'Activity tab notifications', js: true, selenium: true do
end
end
- context 'does not have notifications for the work package' do
+ context 'when there are no notifications for the work package' do
it 'Shows no notification bubble' do
expect(page).not_to have_selector('[data-qa-selector="tab-counter-Activity"]')
end