diff --git a/.github/workflows/actions_ci.yml b/.github/workflows/actions_ci.yml index 64e69e51f..f8ba70c61 100644 --- a/.github/workflows/actions_ci.yml +++ b/.github/workflows/actions_ci.yml @@ -61,7 +61,7 @@ jobs: changesFound: ${{ steps.filter.outputs.changesFound }} steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - uses: AurorNZ/paths-filter@7c547bdd24124b0d69e07c96b62fd7fec5ced19a + - uses: AurorNZ/paths-filter@3b1f3abc3371cca888d8eb03dfa70bc8a9867629 id: filter with: filters: | diff --git a/.github/workflows/cli_ci.yml b/.github/workflows/cli_ci.yml index 9ea160754..714c7a0a1 100644 --- a/.github/workflows/cli_ci.yml +++ b/.github/workflows/cli_ci.yml @@ -51,7 +51,7 @@ jobs: changesFound: ${{ steps.filter.outputs.changesFound }} steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - uses: AurorNZ/paths-filter@7c547bdd24124b0d69e07c96b62fd7fec5ced19a + - uses: AurorNZ/paths-filter@3b1f3abc3371cca888d8eb03dfa70bc8a9867629 id: filter with: filters: | diff --git a/.github/workflows/integration_tests_app_ci.yml b/.github/workflows/integration_tests_app_ci.yml index 99a877dae..c95d99c45 100644 --- a/.github/workflows/integration_tests_app_ci.yml +++ b/.github/workflows/integration_tests_app_ci.yml @@ -44,7 +44,7 @@ jobs: changesFound: ${{ steps.filter.outputs.changesFound }} steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - uses: AurorNZ/paths-filter@7c547bdd24124b0d69e07c96b62fd7fec5ced19a + - uses: AurorNZ/paths-filter@3b1f3abc3371cca888d8eb03dfa70bc8a9867629 id: filter with: filters: | diff --git a/.github/workflows/safe_app_ci.yml b/.github/workflows/safe_app_ci.yml index 95657c4ec..db2ff959c 100644 --- a/.github/workflows/safe_app_ci.yml +++ b/.github/workflows/safe_app_ci.yml @@ -65,7 +65,7 @@ jobs: changesFound: ${{ steps.filter.outputs.changesFound }} steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - uses: AurorNZ/paths-filter@7c547bdd24124b0d69e07c96b62fd7fec5ced19a + - uses: AurorNZ/paths-filter@3b1f3abc3371cca888d8eb03dfa70bc8a9867629 id: filter with: filters: | diff --git a/.github/workflows/safe_website_ci.yml b/.github/workflows/safe_website_ci.yml index 6e1d93dbd..8699b10da 100644 --- a/.github/workflows/safe_website_ci.yml +++ b/.github/workflows/safe_website_ci.yml @@ -65,7 +65,7 @@ jobs: changesFound: ${{ steps.filter.outputs.changesFound }} steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - uses: AurorNZ/paths-filter@7c547bdd24124b0d69e07c96b62fd7fec5ced19a + - uses: AurorNZ/paths-filter@3b1f3abc3371cca888d8eb03dfa70bc8a9867629 id: filter with: filters: | diff --git a/.github/workflows/unsafe_app_ci.yml b/.github/workflows/unsafe_app_ci.yml index 826d72439..d6ce5d70c 100644 --- a/.github/workflows/unsafe_app_ci.yml +++ b/.github/workflows/unsafe_app_ci.yml @@ -62,7 +62,7 @@ jobs: pull-requests: write steps: - name: Remove "safe to test" label, if PR is from a fork - uses: SharezoneApp/remove-safe-to-test-label@228977e0ec39c61eef543d130927065940d56907 + uses: SharezoneApp/remove-safe-to-test-label@91b378205db41bb08dde8e4c4f2685847eb3d168 # We can't use the official "paths" filter because it has no support for merge # groups and we would need some kind of fallback CI when a check is required @@ -83,7 +83,7 @@ jobs: # Because we are using the "pull_request_target" event, we need to # checkout the PR head commit instead of the merge commit. ref: ${{ github.event.pull_request.head.sha }} - - uses: AurorNZ/paths-filter@7c547bdd24124b0d69e07c96b62fd7fec5ced19a + - uses: AurorNZ/paths-filter@3b1f3abc3371cca888d8eb03dfa70bc8a9867629 id: filter with: filters: | diff --git a/.github/workflows/unsafe_website_ci.yml b/.github/workflows/unsafe_website_ci.yml index bd6af7683..b222365ee 100644 --- a/.github/workflows/unsafe_website_ci.yml +++ b/.github/workflows/unsafe_website_ci.yml @@ -62,7 +62,7 @@ jobs: pull-requests: write steps: - name: Remove "safe to test" label, if PR is from a fork - uses: SharezoneApp/remove-safe-to-test-label@228977e0ec39c61eef543d130927065940d56907 + uses: SharezoneApp/remove-safe-to-test-label@91b378205db41bb08dde8e4c4f2685847eb3d168 # We can't use the official "paths" filter because it has no support for merge # groups and we would need some kind of fallback CI when a check is required @@ -83,7 +83,7 @@ jobs: # Because we are using the "pull_request_target" event, we need to # checkout the PR head commit instead of the merge commit. ref: ${{ github.event.pull_request.head.sha }} - - uses: AurorNZ/paths-filter@7c547bdd24124b0d69e07c96b62fd7fec5ced19a + - uses: AurorNZ/paths-filter@3b1f3abc3371cca888d8eb03dfa70bc8a9867629 id: filter with: filters: | diff --git a/app/lib/homework/homework_dialog/homework_dialog.dart b/app/lib/homework/homework_dialog/homework_dialog.dart index a83362fb6..b31c98ba1 100644 --- a/app/lib/homework/homework_dialog/homework_dialog.dart +++ b/app/lib/homework/homework_dialog/homework_dialog.dart @@ -1190,7 +1190,10 @@ class _SubmissionsSwitchBase extends StatelessWidget { }, trailing: Padding( padding: const EdgeInsets.only(right: 8), - child: Text(time.toString()), + child: Text( + time.toString(), + style: const TextStyle(fontSize: 14), + ), ), ) : Container(), diff --git a/app/lib/timetable/src/bloc/timetable_selection_bloc.dart b/app/lib/timetable/src/bloc/timetable_selection_bloc.dart index c3a811cad..decdd2874 100644 --- a/app/lib/timetable/src/bloc/timetable_selection_bloc.dart +++ b/app/lib/timetable/src/bloc/timetable_selection_bloc.dart @@ -60,6 +60,9 @@ class TimetableSelectionBloc extends BlocBase { Course course, ) { final lesson = Lesson( + // The 'createdOn' field will be added in the gateway because we use + // serverTimestamp(). + createdOn: null, weekday: emptyPeriodSelection.date.weekDayEnum, weektype: emptyPeriodSelection.weekType, startTime: emptyPeriodSelection.period.startTime, diff --git a/app/lib/timetable/src/models/lesson.dart b/app/lib/timetable/src/models/lesson.dart index e4b0f5944..aea669c6d 100644 --- a/app/lib/timetable/src/models/lesson.dart +++ b/app/lib/timetable/src/models/lesson.dart @@ -6,6 +6,7 @@ // // SPDX-License-Identifier: EUPL-1.2 +import 'package:cloud_firestore_helper/cloud_firestore_helper.dart'; import 'package:date/date.dart'; import 'package:date/weekday.dart'; import 'package:date/weektype.dart'; @@ -14,6 +15,13 @@ import 'package:sharezone/timetable/src/models/lesson_length/lesson_length.dart' import 'package:time/time.dart'; class Lesson { + /// The date and time when the event was created. + /// + /// Clients with a lower version than 1.7.9 will not have this field. + /// Therefore, we will always have events without a [createdOn] field in the + /// database. + final DateTime? createdOn; + final String? lessonID; final String groupID; final GroupType groupType; @@ -26,6 +34,7 @@ class Lesson { LessonLength get length => calculateLessonLength(startTime, endTime); Lesson({ + required this.createdOn, required this.lessonID, required this.groupID, required this.groupType, @@ -42,6 +51,7 @@ class Lesson { factory Lesson.fromData(Map data, {required String id}) { return Lesson( + createdOn: dateTimeFromTimestampOrNull(data['createdOn']), lessonID: id, groupID: data['groupID'] as String, groupType: GroupType.values.byName(data['groupType'] as String), @@ -74,6 +84,7 @@ class Lesson { } Lesson copyWith({ + DateTime? createdOn, String? lessonID, String? groupID, GroupType? groupType, @@ -88,6 +99,7 @@ class Lesson { String? place, }) { return Lesson( + createdOn: createdOn ?? this.createdOn, groupType: groupType ?? this.groupType, lessonID: lessonID ?? this.lessonID, groupID: groupID ?? this.groupID, diff --git a/app/lib/timetable/timetable_add/bloc/timetable_add_bloc.dart b/app/lib/timetable/timetable_add/bloc/timetable_add_bloc.dart index 31c6d4d4e..8763ffaf0 100644 --- a/app/lib/timetable/timetable_add/bloc/timetable_add_bloc.dart +++ b/app/lib/timetable/timetable_add/bloc/timetable_add_bloc.dart @@ -127,6 +127,9 @@ class TimetableAddBloc extends BlocBase { log("isValid: true; ${course.toString()}; $startTime; $endTime; $room $weekDay $period"); final lesson = Lesson( + // The 'createdOn' field will be added in the gateway because we use + // serverTimestamp(). + createdOn: null, groupID: course.id, groupType: GroupType.course, startDate: null, diff --git a/app/lib/util/api/timetable_gateway.dart b/app/lib/util/api/timetable_gateway.dart index 4f8e33c50..71bf3d9e1 100644 --- a/app/lib/util/api/timetable_gateway.dart +++ b/app/lib/util/api/timetable_gateway.dart @@ -22,6 +22,7 @@ class TimetableGateway { String lessonID = references.lessons.doc().id; Map data = lesson.copyWith(lessonID: lessonID).toJson(); data['users'] = [memberID]; + data['createdOn'] = FieldValue.serverTimestamp(); return references.lessons .doc(lessonID) .set(data, SetOptions(merge: true)) diff --git a/app/test/dashboard/current_lesson_index_test.dart b/app/test/dashboard/current_lesson_index_test.dart index e0f60e069..697dc89b6 100644 --- a/app/test/dashboard/current_lesson_index_test.dart +++ b/app/test/dashboard/current_lesson_index_test.dart @@ -25,6 +25,7 @@ void main() { abbreviation: "D", design: Design.standard(), lesson: Lesson( + createdOn: DateTime(2024, 1, 1), lessonID: "1", groupID: "1", groupType: GroupType.course, diff --git a/app/test/timetable/timetable_bloc_test.dart b/app/test/timetable/timetable_bloc_test.dart index 2d3e5f699..e24c8e881 100644 --- a/app/test/timetable/timetable_bloc_test.dart +++ b/app/test/timetable/timetable_bloc_test.dart @@ -45,6 +45,7 @@ void main() { Lesson createLesson(String groupId) { return Lesson( + createdOn: DateTime(2024, 1, 1), startTime: Time(hour: 9, minute: 0), endTime: Time(hour: 10, minute: 0), groupID: groupId, diff --git a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_dark.iphone11.png b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_dark.iphone11.png index 485bf077f..1829bde29 100644 Binary files a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_dark.iphone11.png and b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_dark.iphone11.png differ diff --git a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_dark.phone.png b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_dark.phone.png index e0c7a0a1c..c4397ed1c 100644 Binary files a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_dark.phone.png and b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_dark.phone.png differ diff --git a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_dark.tablet_landscape.png b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_dark.tablet_landscape.png index 6e1aa0210..74f77235d 100644 Binary files a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_dark.tablet_landscape.png and b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_dark.tablet_landscape.png differ diff --git a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_dark.tablet_portrait.png b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_dark.tablet_portrait.png index 9d189482d..5c4172520 100644 Binary files a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_dark.tablet_portrait.png and b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_dark.tablet_portrait.png differ diff --git a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_light.iphone11.png b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_light.iphone11.png index 06d0d1b97..926584774 100644 Binary files a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_light.iphone11.png and b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_light.iphone11.png differ diff --git a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_light.phone.png b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_light.phone.png index 82414d1fe..701d1ab27 100644 Binary files a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_light.phone.png and b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_light.phone.png differ diff --git a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_light.tablet_landscape.png b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_light.tablet_landscape.png index 10d82e4f2..b506766e2 100644 Binary files a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_light.tablet_landscape.png and b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_light.tablet_landscape.png differ diff --git a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_light.tablet_portrait.png b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_light.tablet_portrait.png index a7e97fa17..b13e33843 100644 Binary files a/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_light.tablet_portrait.png and b/app/test_goldens/homework/homework_dialog/goldens/homework_dialog_edit_filled_1_light.tablet_portrait.png differ