include Remotable
include EmojiHelper
+ MAX_NOTE_LENGTH = 500
+
enum protocol: [:ostatus, :activitypub]
# Local users
note_without_metadata = note[(idx + YAML_END.length) .. -1]
end
end
- if note_without_metadata.mb_chars.grapheme_length > 500
+ if note_without_metadata.mb_chars.grapheme_length > MAX_NOTE_LENGTH
errors.add(:note, "can't be longer than 500 graphemes")
end
end
describe 'with invalid data' do
before do
- patch :update, params: { note: 'This is too long. ' * 10 }
+ note = 'This is too long. '
+ note = note + 'a' * (Account::MAX_NOTE_LENGTH - note.length + 1)
+ patch :update, params: { note: note }
end
it 'returns http unprocessable entity' do