Admin UI: disabling the birthday calendar for an address book returns 500 (FK violation on calendarchanges)

オープン 初心者向け
#331 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
mysql, php, symfony
領域
backend, database

調査の方向性

src/Services/BirthdayService.php の deleteBirthdayCalendar() 付近を読み、276–284 行にある CalendarController::calendarDelete のクリーンアップと比較してください。誕生日の項目があるアドレス帳で誕生日カレンダーを無効にして再現し、カレンダーを削除する前に、関連するカレンダーオブジェクトと変更がどのように削除されるかを確認してください。アドレス帳が正常に保存され、外部キーエラーなしで誕生日カレンダーが削除されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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
  1. 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 in calendarchanges
  2. Edit the same address book, set "Include in birthday calendar" to No, save
  3. → 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.

主要言語
PHP
スター
769
フォーク
45
平均マージ
2日 9時間
マージ済み PR(30日)
4

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

tchapi/davis のほかの issue

tchapi/davis の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。