Fix long report notes giving errors on creation

This commit is contained in:
Tusooa Zhu 2022-06-02 01:28:39 -04:00
parent 7466136ad3
commit b096fbba1a
No known key found for this signature in database
GPG Key ID: 7B467EDE43A08224
2 changed files with 39 additions and 0 deletions

View File

@ -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

View File

@ -13,4 +13,27 @@ test "create/3" do
assert {:ok, note} = ReportNote.create(user.id, report.id, "naughty boy") assert {:ok, note} = ReportNote.create(user.id, report.id, "naughty boy")
assert note.content == "naughty boy" assert note.content == "naughty boy"
end 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 end