Skip to content
Extraits de code Groupes Projets
Valider 887cd94e rédigé par Eugen Rochko's avatar Eugen Rochko Validation de GitHub
Parcourir les fichiers

Increase attachment descriptions to 420 characters (#5139)

Blaze it
parent d2f56d1c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -79,7 +79,7 @@ export default class Upload extends ImmutablePureComponent { ...@@ -79,7 +79,7 @@ export default class Upload extends ImmutablePureComponent {
placeholder={intl.formatMessage(messages.description)} placeholder={intl.formatMessage(messages.description)}
type='text' type='text'
value={description} value={description}
maxLength={140} maxLength={420}
onFocus={this.handleInputFocus} onFocus={this.handleInputFocus}
onChange={this.handleInputChange} onChange={this.handleInputChange}
onBlur={this.handleInputBlur} onBlur={this.handleInputBlur}
......
...@@ -59,7 +59,7 @@ class MediaAttachment < ApplicationRecord ...@@ -59,7 +59,7 @@ class MediaAttachment < ApplicationRecord
validates_attachment_size :file, less_than: 8.megabytes validates_attachment_size :file, less_than: 8.megabytes
validates :account, presence: true validates :account, presence: true
validates :description, length: { maximum: 140 }, if: :local? validates :description, length: { maximum: 420 }, if: :local?
scope :attached, -> { where.not(status_id: nil) } scope :attached, -> { where.not(status_id: nil) }
scope :unattached, -> { where(status_id: nil) } scope :unattached, -> { where(status_id: nil) }
...@@ -140,7 +140,7 @@ class MediaAttachment < ApplicationRecord ...@@ -140,7 +140,7 @@ class MediaAttachment < ApplicationRecord
end end
def prepare_description def prepare_description
self.description = description.strip[0...140] unless description.nil? self.description = description.strip[0...420] unless description.nil?
end end
def set_type_and_extension def set_type_and_extension
......
...@@ -52,9 +52,9 @@ RSpec.describe MediaAttachment, type: :model do ...@@ -52,9 +52,9 @@ RSpec.describe MediaAttachment, type: :model do
describe 'descriptions for remote attachments' do describe 'descriptions for remote attachments' do
it 'are cut off at 140 characters' do it 'are cut off at 140 characters' do
media = Fabricate(:media_attachment, description: 'foo' * 100, remote_url: 'http://example.com/blah.jpg') media = Fabricate(:media_attachment, description: 'foo' * 1000, remote_url: 'http://example.com/blah.jpg')
expect(media.description.size).to be <= 140 expect(media.description.size).to be <= 420
end end
end end
end end
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter