Admin UI: disabling the birthday calendar for an address book returns 500 (FK violation on calendarchanges)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
Hướng nghiên cứu
Đọc src/Services/BirthdayService.php quanh deleteBirthdayCalendar() và so sánh cách dọn dẹp với CalendarController::calendarDelete ở dòng 276–284. Tái hiện bằng cách tắt lịch sinh nhật cho một sổ địa chỉ có mục sinh nhật, sau đó kiểm tra cách các đối tượng lịch liên quan và các thay đổi được xóa trước khi xóa lịch. Hoàn thành khi sổ địa chỉ được lưu thành công và lịch sinh nhật được xóa mà không có lỗi khóa ngoại.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Davis version
v5.6.3
Installation method
Docker – standalone (with Caddy)
Database
MariaDB
Reverse proxy
Traefik
Authentication method
Internal (ADMIN_LOGIN / ADMIN_PASSWORD)
Affected protocol(s)
- Admin dashboard
Client(s) exhibiting the issue
Admin dashboard in the browser
Relevant environment variables
APP_ENV=prod
CALDAV_ENABLED=true
CARDDAV_ENABLED=true
WEBDAV_ENABLED=false
PUBLIC_CALENDARS_ENABLED=false
APP_KEYS_ENABLED=true
DATABASE_DRIVER=mysql
BIRTHDAY_REMINDER_OFFSET=PT8H30M
AUTH_METHOD unset
Steps to reproduce
- Set "Include in birthday calendar" to Yes on a user's address book that contains a card with a
BDAY, so the birthday calendar is created and gets at least one row incalendarchanges - Edit the same address book, set "Include in birthday calendar" to No, save
- → 500
Expected behaviour
The address book is saved and the birthday calendar is removed, since no address book of the user is included anymore.
Actual behaviour
500 Internal Server Error. The address book change itself is saved (it is flushed before the sync), but the birthday calendar stays, and every later save of that address book returns 500 again.
Logs
request.INFO: Matched route "addressbook_edit". {"route":"addressbook_edit", ... "request_uri":"https://<host>/addressbooks/1/edit/1","method":"POST"}
request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException: "An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`davis`.`calendarchanges`, CONSTRAINT `FK_737547E2B8CB7204` FOREIGN KEY (`calendarid`) REFERENCES `calendars` (`id`))" at ExceptionConverter.php line 58
Additional context
After the save, AddressBookController::addressbookCreate calls BirthdayService::syncUser(). When no address book is included anymore, syncPrincipal() calls deleteBirthdayCalendar() (BirthdayService.php#L130-L145), which removes the instance and the calendar but not the calendar's rows in calendarchanges (or calendarobjects), so the FK rejects the delete. main has the same code.
CalendarController::calendarDelete already removes objects and changes before the calendar (CalendarController.php#L276-L284), so doing the same in deleteBirthdayCalendar() should fix it.
Possibly related to #328 (enabling the birthday calendar returns 500), but the cause here is a different one.
- Ngôn ngữ chính
- PHP
- Star
- 769
- Fork
- 45
- Merge trung bình
- 2 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của tchapi/davis
-
Run Doctrine migrations automatically on container startCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởfeature request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
-
Public birthday calendarsĐang mởfeature request
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
-
native installationĐang mởfeature request
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
-
feature request
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Issue tương tự
-
enhancement priority: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
magicsunday/webtrees-statistics#664 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Перевод устарел
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Feature: Financial follow-up UI
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày