Skip to content

Instantly share code, notes, and snippets.

@Exagone313
Last active November 6, 2022 10:40
Show Gist options
  • Select an option

  • Save Exagone313/ea7e71400cd8b33d0d05de848ab24db7 to your computer and use it in GitHub Desktop.

Select an option

Save Exagone313/ea7e71400cd8b33d0d05de848ab24db7 to your computer and use it in GitHub Desktop.

Revisions

  1. Exagone313 revised this gist May 26, 2022. 1 changed file with 10 additions and 10 deletions.
    20 changes: 10 additions & 10 deletions 2048.diff
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js
    index ba2d20cc7..94b2bed1a 100644
    index 4620d1c43..3028bb684 100644
    --- a/app/javascript/mastodon/features/compose/components/compose_form.js
    +++ b/app/javascript/mastodon/features/compose/components/compose_form.js
    @@ -86,7 +86,7 @@ class ComposeForm extends ImmutablePureComponent {
    @@ -90,7 +90,7 @@ class ComposeForm extends ImmutablePureComponent {
    const fulltext = this.getFulltextForCharacterCounting();
    const isOnlyWhitespace = fulltext.length !== 0 && fulltext.trim().length === 0;

    @@ -11,17 +11,17 @@ index ba2d20cc7..94b2bed1a 100644
    }

    handleSubmit = () => {
    @@ -257,7 +257,7 @@ class ComposeForm extends ImmutablePureComponent {
    <PrivacyDropdownContainer />
    <SpoilerButtonContainer />
    @@ -273,7 +273,7 @@ class ComposeForm extends ImmutablePureComponent {
    </div>

    <div className='character-counter__wrapper'>
    - <CharacterCounter max={500} text={this.getFulltextForCharacterCounting()} />
    + <CharacterCounter max={2048} text={this.getFulltextForCharacterCounting()} />
    </div>
    - <div className='character-counter__wrapper'><CharacterCounter max={500} text={this.getFulltextForCharacterCounting()} /></div>
    + <div className='character-counter__wrapper'><CharacterCounter max={2048} text={this.getFulltextForCharacterCounting()} /></div>
    </div>

    <div className='compose-form__publish'>
    diff --git a/app/validators/status_length_validator.rb b/app/validators/status_length_validator.rb
    index 4c258ec16..acebec60d 100644
    index e107912b7..6bb5beb86 100644
    --- a/app/validators/status_length_validator.rb
    +++ b/app/validators/status_length_validator.rb
    @@ -1,7 +1,7 @@
    @@ -31,4 +31,4 @@ index 4c258ec16..acebec60d 100644
    - MAX_CHARS = 500
    + MAX_CHARS = 2048
    URL_PLACEHOLDER_CHARS = 23
    URL_PLACEHOLDER = "\1#{'x' * URL_PLACEHOLDER_CHARS}"
    URL_PLACEHOLDER = 'x' * 23
  2. Exagone313 revised this gist Nov 6, 2021. 1 changed file with 3 additions and 4 deletions.
    7 changes: 3 additions & 4 deletions 2048.diff
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ index ba2d20cc7..94b2bed1a 100644

    <div className='compose-form__publish'>
    diff --git a/app/validators/status_length_validator.rb b/app/validators/status_length_validator.rb
    index d036f1925..90924e0ce 100644
    index 4c258ec16..acebec60d 100644
    --- a/app/validators/status_length_validator.rb
    +++ b/app/validators/status_length_validator.rb
    @@ -1,7 +1,7 @@
    @@ -30,6 +30,5 @@ index d036f1925..90924e0ce 100644
    class StatusLengthValidator < ActiveModel::Validator
    - MAX_CHARS = 500
    + MAX_CHARS = 2048
    URL_PLACEHOLDER = "\1#{'x' * 23}"

    def validate(status)
    URL_PLACEHOLDER_CHARS = 23
    URL_PLACEHOLDER = "\1#{'x' * URL_PLACEHOLDER_CHARS}"
  3. Exagone313 revised this gist May 17, 2021. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions 2048.diff
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js
    index 8af806ec4..49b142456 100644
    index ba2d20cc7..94b2bed1a 100644
    --- a/app/javascript/mastodon/features/compose/components/compose_form.js
    +++ b/app/javascript/mastodon/features/compose/components/compose_form.js
    @@ -86,7 +86,7 @@ class ComposeForm extends ImmutablePureComponent {
    @@ -11,7 +11,7 @@ index 8af806ec4..49b142456 100644
    }

    handleSubmit = () => {
    @@ -249,7 +249,7 @@ class ComposeForm extends ImmutablePureComponent {
    @@ -257,7 +257,7 @@ class ComposeForm extends ImmutablePureComponent {
    <PrivacyDropdownContainer />
    <SpoilerButtonContainer />
    </div>
    @@ -21,7 +21,7 @@ index 8af806ec4..49b142456 100644

    <div className='compose-form__publish'>
    diff --git a/app/validators/status_length_validator.rb b/app/validators/status_length_validator.rb
    index 93bae2fa8..3cae672ae 100644
    index d036f1925..90924e0ce 100644
    --- a/app/validators/status_length_validator.rb
    +++ b/app/validators/status_length_validator.rb
    @@ -1,7 +1,7 @@
    @@ -30,6 +30,6 @@ index 93bae2fa8..3cae672ae 100644
    class StatusLengthValidator < ActiveModel::Validator
    - MAX_CHARS = 500
    + MAX_CHARS = 2048
    URL_PLACEHOLDER = "\1#{'x' * 23}"

    def validate(status)
    return unless status.local? && !status.reblog?
    def validate(status)
  4. Exagone313 revised this gist Dec 28, 2020. 1 changed file with 11 additions and 20 deletions.
    31 changes: 11 additions & 20 deletions 2048.diff
    Original file line number Diff line number Diff line change
    @@ -1,31 +1,22 @@
    diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js
    index 47e189251..7ab9d7417 100644
    index 8af806ec4..49b142456 100644
    --- a/app/javascript/mastodon/features/compose/components/compose_form.js
    +++ b/app/javascript/mastodon/features/compose/components/compose_form.js
    @@ -88,7 +88,7 @@ class ComposeForm extends ImmutablePureComponent {
    const { isSubmitting, isChangingUpload, isUploading, anyMedia } = this.props;
    const fulltext = [this.props.spoilerText, countableText(this.props.text)].join('');
    @@ -86,7 +86,7 @@ class ComposeForm extends ImmutablePureComponent {
    const fulltext = this.getFulltextForCharacterCounting();
    const isOnlyWhitespace = fulltext.length !== 0 && fulltext.trim().length === 0;

    - if (isSubmitting || isUploading || isChangingUpload || length(fulltext) > 500 || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) {
    + if (isSubmitting || isUploading || isChangingUpload || length(fulltext) > 2048 || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) {
    return;
    }
    - return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > 500 || (isOnlyWhitespace && !anyMedia));
    + return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > 2048 || (isOnlyWhitespace && !anyMedia));
    }

    @@ -181,7 +181,7 @@ class ComposeForm extends ImmutablePureComponent {
    const { intl, onPaste, showSearch, anyMedia } = this.props;
    const disabled = this.props.isSubmitting;
    const text = [this.props.spoilerText, countableText(this.props.text)].join('');
    - const disabledButton = disabled || this.props.isUploading || this.props.isChangingUpload || length(text) > 500 || (text.length !== 0 && text.trim().length === 0 && !anyMedia);
    + const disabledButton = disabled || this.props.isUploading || this.props.isChangingUpload || length(text) > 2048 || (text.length !== 0 && text.trim().length === 0 && !anyMedia);
    let publishText = '';

    if (this.props.privacy === 'private' || this.props.privacy === 'direct') {
    @@ -243,7 +243,7 @@ class ComposeForm extends ImmutablePureComponent {
    handleSubmit = () => {
    @@ -249,7 +249,7 @@ class ComposeForm extends ImmutablePureComponent {
    <PrivacyDropdownContainer />
    <SpoilerButtonContainer />
    </div>
    - <div className='character-counter__wrapper'><CharacterCounter max={500} text={text} /></div>
    + <div className='character-counter__wrapper'><CharacterCounter max={2048} text={text} /></div>
    - <div className='character-counter__wrapper'><CharacterCounter max={500} text={this.getFulltextForCharacterCounting()} /></div>
    + <div className='character-counter__wrapper'><CharacterCounter max={2048} text={this.getFulltextForCharacterCounting()} /></div>
    </div>

    <div className='compose-form__publish'>
  5. Exagone313 created this gist Nov 29, 2020.
    44 changes: 44 additions & 0 deletions 2048.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,44 @@
    diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js
    index 47e189251..7ab9d7417 100644
    --- a/app/javascript/mastodon/features/compose/components/compose_form.js
    +++ b/app/javascript/mastodon/features/compose/components/compose_form.js
    @@ -88,7 +88,7 @@ class ComposeForm extends ImmutablePureComponent {
    const { isSubmitting, isChangingUpload, isUploading, anyMedia } = this.props;
    const fulltext = [this.props.spoilerText, countableText(this.props.text)].join('');

    - if (isSubmitting || isUploading || isChangingUpload || length(fulltext) > 500 || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) {
    + if (isSubmitting || isUploading || isChangingUpload || length(fulltext) > 2048 || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) {
    return;
    }

    @@ -181,7 +181,7 @@ class ComposeForm extends ImmutablePureComponent {
    const { intl, onPaste, showSearch, anyMedia } = this.props;
    const disabled = this.props.isSubmitting;
    const text = [this.props.spoilerText, countableText(this.props.text)].join('');
    - const disabledButton = disabled || this.props.isUploading || this.props.isChangingUpload || length(text) > 500 || (text.length !== 0 && text.trim().length === 0 && !anyMedia);
    + const disabledButton = disabled || this.props.isUploading || this.props.isChangingUpload || length(text) > 2048 || (text.length !== 0 && text.trim().length === 0 && !anyMedia);
    let publishText = '';

    if (this.props.privacy === 'private' || this.props.privacy === 'direct') {
    @@ -243,7 +243,7 @@ class ComposeForm extends ImmutablePureComponent {
    <PrivacyDropdownContainer />
    <SpoilerButtonContainer />
    </div>
    - <div className='character-counter__wrapper'><CharacterCounter max={500} text={text} /></div>
    + <div className='character-counter__wrapper'><CharacterCounter max={2048} text={text} /></div>
    </div>

    <div className='compose-form__publish'>
    diff --git a/app/validators/status_length_validator.rb b/app/validators/status_length_validator.rb
    index 93bae2fa8..3cae672ae 100644
    --- a/app/validators/status_length_validator.rb
    +++ b/app/validators/status_length_validator.rb
    @@ -1,7 +1,7 @@
    # frozen_string_literal: true

    class StatusLengthValidator < ActiveModel::Validator
    - MAX_CHARS = 500
    + MAX_CHARS = 2048

    def validate(status)
    return unless status.local? && !status.reblog?