Skip to content

Commit

Permalink
Merge est-social/main
Browse files Browse the repository at this point in the history
  • Loading branch information
SlyEcho committed Sep 22, 2023
1 parent 4fcc026 commit be68c0e
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 6 deletions.
22 changes: 22 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Mastodon fork for [est.social](https://est.social/)

Forked from [Mastodon](https://github.com/mastodon/mastodon/).

This is mainly to manage localization ahead of the official releases.

## Changes made

1. Upped char limit to 10,000 after some [discussion](https://est.social/@diana/109989076059242012) on our site.
- app/javascript/mastodon/features/compose/components/compose_form.js
- app/serializers/rest/instance_serializer.rb
- app/serializers/rest/v1/instance_serializer.rb
- app/validators/status_length_validator.rb
2. Localization. These come from the official [Crowdin project](https://crowdin.com/project/mastodon/et) but they are merged ahead of the official releases.
- app/javascript/mastodon/locales/et.json
- config/locales/activerecord.et.yml
- config/locales/devise.et.yml
- config/locales/doorkeeper.et.yml
- config/locales/et.yml
- config/locales/simple_form.et.yml
3. Our version suffix `+est`:
- lib/mastodon/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class ComposeForm extends ImmutablePureComponent {
const fulltext = this.getFulltextForCharacterCounting();
const isOnlyWhitespace = fulltext.length !== 0 && fulltext.trim().length === 0;

return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > 500 || (isOnlyWhitespace && !anyMedia));
return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > 10000 || (isOnlyWhitespace && !anyMedia));
};

handleSubmit = (e) => {
Expand Down Expand Up @@ -297,7 +297,7 @@ class ComposeForm extends ImmutablePureComponent {
</div>

<div className='character-counter__wrapper'>
<CharacterCounter max={500} text={this.getFulltextForCharacterCounting()} />
<CharacterCounter max={10000} text={this.getFulltextForCharacterCounting()} />
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/lib/feed_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class FeedManager
include Redisable

# Maximum number of items stored in a single feed
MAX_ITEMS = 800
MAX_ITEMS = 10_000

# Number of items in the feed since last reblog of status
# before the new reblog will be inserted. Must be <= MAX_ITEMS
Expand Down
6 changes: 5 additions & 1 deletion app/serializers/rest/instance_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ContactSerializer < ActiveModel::Serializer

attributes :domain, :title, :version, :source_url, :description,
:usage, :thumbnail, :languages, :configuration,
:registrations
:registrations, :max_toot_chars

has_one :contact, serializer: ContactSerializer
has_many :rules, serializer: REST::RuleSerializer
Expand Down Expand Up @@ -89,6 +89,10 @@ def registrations
}
end

def max_toot_chars
StatusLengthValidator::MAX_CHARS
end

private

def registrations_enabled?
Expand Down
6 changes: 5 additions & 1 deletion app/serializers/rest/v1/instance_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class REST::V1::InstanceSerializer < ActiveModel::Serializer
attributes :uri, :title, :short_description, :description, :email,
:version, :urls, :stats, :thumbnail,
:languages, :registrations, :approval_required, :invites_enabled,
:configuration
:configuration, :max_toot_chars

has_one :contact_account, serializer: REST::AccountSerializer

Expand Down Expand Up @@ -98,6 +98,10 @@ def invites_enabled
UserRole.everyone.can?(:invite_users)
end

def max_toot_chars
StatusLengthValidator::MAX_CHARS
end

private

def instance_presenter
Expand Down
2 changes: 1 addition & 1 deletion app/validators/status_length_validator.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class StatusLengthValidator < ActiveModel::Validator
MAX_CHARS = 500
MAX_CHARS = 10_000
URL_PLACEHOLDER_CHARS = 23
URL_PLACEHOLDER = 'x' * 23

Expand Down

0 comments on commit be68c0e

Please sign in to comment.