FIX: Cap bookmark name at 100 chars and truncate existing names (#10189)

We have a couple of examples of enormous amounts of text being entered in the name column of bookmarks. This is not desirable...it is just meant to be a short note / reminder of why you bookmarked this.

This PR caps the column at 100 characters and truncates existing names in the database to 100 characters.
This commit is contained in:
Martin Brennan
2020-07-08 17:19:01 +10:00
committed by GitHub
parent bac25e6dd7
commit 6be7a66ba7
4 changed files with 22 additions and 2 deletions

View File

@ -75,6 +75,13 @@ RSpec.describe BookmarkManager do
end
end
context "when the bookmark name is too long" do
it "adds an error to the manager" do
subject.create(post_id: post.id, name: "test" * 100)
expect(subject.errors.full_messages).to include("Name is too long (maximum is 100 characters)")
end
end
context "when the reminder time is not provided when it needs to be" do
let(:reminder_at) { nil }
it "adds an error to the manager" do