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

Linting

Oliver Günther19844f2b96c6
diff --git a/db/migrate/20210928133538_add_reminder_workdays.rb b/db/migrate/20210928133538_add_reminder_workdays.rb
index 395d8321576..820013804f3 100644
--- a/db/migrate/20210928133538_add_reminder_workdays.rb
+++ b/db/migrate/20210928133538_add_reminder_workdays.rb
@@ -14,4 +14,3 @@ class AddReminderWorkdays < ActiveRecord::Migration[6.1]
remove_index_if_exists :user_preferences, :index_user_prefs_settings_workdays
end
end
-
diff --git a/frontend/src/app/features/user-preferences/reminder-settings/page/reminder-settings-page.component.ts b/frontend/src/app/features/user-preferences/reminder-settings/page/reminder-settings-page.component.ts
index 8bddc5c6daa..08944710a6d 100644
--- a/frontend/src/app/features/user-preferences/reminder-settings/page/reminder-settings-page.component.ts
+++ b/frontend/src/app/features/user-preferences/reminder-settings/page/reminder-settings-page.component.ts
@@ -35,6 +35,7 @@ interface IReminderSettingsFormValue {
immediateReminders:ImmediateRemindersSettings,
dailyReminders:DailyRemindersSettings,
emailAlerts:Record<EmailAlertType, boolean>;
+ workdays:boolean[];
}
@Component({
@@ -158,7 +159,7 @@ export class ReminderSettingsPageComponent extends UntilDestroyedMixin implement
const globalNotifications = prefs.notifications.filter((notification) => !notification._links.project.href);
const projectNotifications = prefs.notifications.filter((notification) => !!notification._links.project.href);
const reminderSettings = (this.form.value as IReminderSettingsFormValue);
- const workdays = ReminderSettingsPageComponent.buildWorkdays(this.form.value.workdays as boolean[]);
+ const workdays = ReminderSettingsPageComponent.buildWorkdays(reminderSettings.workdays);
this.storeService.update(this.userId, {
...prefs,
diff --git a/frontend/src/app/features/user-preferences/reminder-settings/workdays/workdays-settings.component.ts b/frontend/src/app/features/user-preferences/reminder-settings/workdays/workdays-settings.component.ts
index efa808f71fa..646013d23ec 100644
--- a/frontend/src/app/features/user-preferences/reminder-settings/workdays/workdays-settings.component.ts
+++ b/frontend/src/app/features/user-preferences/reminder-settings/workdays/workdays-settings.component.ts
@@ -14,7 +14,7 @@ import * as moment from 'moment';
selector: 'op-workdays-settings',
templateUrl: './workdays-settings.component.html',
styleUrls: ['./workdays-settings.component.sass'],
- changeDetection: ChangeDetectionStrategy.OnPush
+ changeDetection: ChangeDetectionStrategy.OnPush,
})
export class WorkdaysSettingsComponent implements OnInit {
control:FormArray;
@@ -32,7 +32,7 @@ export class WorkdaysSettingsComponent implements OnInit {
* Working with the FormArray however, we use 0=Monday, 6=Sunday and add one before saving
* @private
*/
- private isoWorkdays:string[] = this.buildISOWeekdays();
+ private isoWorkdays:string[] = WorkdaysSettingsComponent.buildISOWeekdays();
constructor(
readonly formGroup:FormGroupDirective,
@@ -53,7 +53,7 @@ export class WorkdaysSettingsComponent implements OnInit {
}
/** Workdays from moment.js are in non-ISO order, that means Sunday=0, Saturday=6 */
- private buildISOWeekdays():string[] {
+ static buildISOWeekdays():string[] {
const days = moment.weekdays(false);
days.push(days.shift() as string);
diff --git a/frontend/src/app/features/user-preferences/state/user-preferences.store.ts b/frontend/src/app/features/user-preferences/state/user-preferences.store.ts
index 96f2a67f8f8..ee462b514a5 100644
--- a/frontend/src/app/features/user-preferences/state/user-preferences.store.ts
+++ b/frontend/src/app/features/user-preferences/state/user-preferences.store.ts
@@ -27,7 +27,10 @@
//++
import { Injectable } from '@angular/core';
-import { Store, StoreConfig } from '@datorama/akita';
+import {
+ Store,
+ StoreConfig,
+} from '@datorama/akita';
import { UserPreferencesModel } from 'core-app/features/user-preferences/state/user-preferences.model';
function createInitialState():UserPreferencesModel {
@@ -42,7 +45,7 @@ function createInitialState():UserPreferencesModel {
enabled: true,
times: ['08:00'],
},
- workdays: [1,2,3,4,5],
+ workdays: [1, 2, 3, 4, 5],
immediateReminders: {
mentioned: false,
},
diff --git a/spec/features/notifications/settings/reminder_mail_spec_settings.rb b/spec/features/notifications/settings/reminder_email_settings_spec.rb
similarity index 100%
rename from spec/features/notifications/settings/reminder_mail_spec_settings.rb
rename to spec/features/notifications/settings/reminder_email_settings_spec.rb
diff --git a/spec/models/users/scopes/having_reminder_mail_to_send_spec.rb b/spec/models/users/scopes/having_reminder_mail_to_send_spec.rb
index 71402a204e1..5a4c6d24357 100644
--- a/spec/models/users/scopes/having_reminder_mail_to_send_spec.rb
+++ b/spec/models/users/scopes/having_reminder_mail_to_send_spec.rb
@@ -137,7 +137,6 @@ describe User, '.having_reminder_mail_to_send', type: :model do
end
end
-
context 'for a user whose local time is on the next workday' do
# 12:00 thursday UTC = 03:00 friday @ Samoa
let(:current_time) { "2021-09-30T12:05:59Z".to_datetime }