From b096fbba1a79d7ba6e429de2dfae2683d2d31001 Mon Sep 17 00:00:00 2001 From: Tusooa Zhu Date: Thu, 2 Jun 2022 01:28:39 -0400 Subject: [PATCH] Fix long report notes giving errors on creation --- ...33_change_report_notes_content_to_text.exs | 16 +++++++++++++ test/pleroma/report_note_test.exs | 23 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 priv/repo/migrations/20220602052233_change_report_notes_content_to_text.exs diff --git a/priv/repo/migrations/20220602052233_change_report_notes_content_to_text.exs b/priv/repo/migrations/20220602052233_change_report_notes_content_to_text.exs new file mode 100644 index 000000000..9343373fc --- /dev/null +++ b/priv/repo/migrations/20220602052233_change_report_notes_content_to_text.exs @@ -0,0 +1,16 @@ +defmodule Pleroma.Repo.Migrations.ChangeReportNotesContentToText do + use Ecto.Migration + + def up do + alter table(:report_notes) do + modify(:content, :text) + end + end + + # 20191203043610_create_report_notes.exs + def down do + alter table(:report_notes) do + modify(:content, :string) + end + end +end diff --git a/test/pleroma/report_note_test.exs b/test/pleroma/report_note_test.exs index 136ad9a40..e2028a3ba 100644 --- a/test/pleroma/report_note_test.exs +++ b/test/pleroma/report_note_test.exs @@ -13,4 +13,27 @@ defmodule Pleroma.ReportNoteTest do assert {:ok, note} = ReportNote.create(user.id, report.id, "naughty boy") assert note.content == "naughty boy" end + + test "create/3 with very long content" do + user = insert(:user) + report = insert(:report_activity) + + very_long_content = """ + ] pwgen 25 15 + eJ9eeceiquoolei2queeLeimi aiN9ie2iokie8chush7aiph5N ulaNgaighoPiequaipuzoog8F + Ohphei0hee6hoo0wah4Aasah9 ziel3Yo3eew4neiy3ekiesh8u ue9ShahTh7oongoPheeneijah + ohGheeCh6aloque0Neviopou3 ush2oobohxeec4aequeich3Oo Ze3eighoowiojadohch8iCa1n + Yu4yieBie9eengoich8fae4th chohqu6exooSiibogh3iefeez peephahtaik9quie5mohD9nee + eeQuur3rie5mei8ieng6iesie wei1meinguv0Heidoov8Ibaed deemo2Poh6ohc3eiBeez1uox2 + ] pwgen 25 15 + eJ9eeceiquoolei2queeLeimi aiN9ie2iokie8chush7aiph5N ulaNgaighoPiequaipuzoog8F + Ohphei0hee6hoo0wah4Aasah9 ziel3Yo3eew4neiy3ekiesh8u ue9ShahTh7oongoPheeneijah + ohGheeCh6aloque0Neviopou3 ush2oobohxeec4aequeich3Oo Ze3eighoowiojadohch8iCa1n + Yu4yieBie9eengoich8fae4th chohqu6exooSiibogh3iefeez peephahtaik9quie5mohD9nee + eeQuur3rie5mei8ieng6iesie wei1meinguv0Heidoov8Ibaed deemo2Poh6ohc3eiBeez1uox2 + """ + + assert {:ok, note} = ReportNote.create(user.id, report.id, very_long_content) + assert note.content == very_long_content + end end