Skip to content

Commit

Permalink
Merge pull request #512 from kmycode/upstream-20240201
Browse files Browse the repository at this point in the history
Upstream 20240201
  • Loading branch information
kmycode authored Feb 1, 2024
2 parents a7954d0 + 6dd728b commit 832da1c
Show file tree
Hide file tree
Showing 182 changed files with 1,212 additions and 2,894 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup-javascript/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ runs:
shell: bash
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
- uses: actions/cache@v4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ jobs:
if: failure()
with:
name: e2e-screenshots
path: tmp/screenshots/
path: tmp/capybara/

test-search:
name: Elastic Search integration testing
Expand Down
12 changes: 10 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,11 @@ Rails/FilePath:
Rails/HttpStatus:
EnforcedStyle: numeric

# Reason: Allowed in `tootctl` CLI code and in boot ENV checker
# Reason: Allowed in boot ENV checker
# https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsexit
Rails/Exit:
Exclude:
- 'config/boot.rb'
- 'lib/mastodon/cli/*.rb'

# Reason: Conflicts with `Lint/UselessMethodDefinition` for inherited controller actions
# https://docs.rubocop.org/rubocop-rails/cops_rails.html#railslexicallyscopedactionfilter
Expand Down Expand Up @@ -187,6 +186,15 @@ Style/ClassAndModuleChildren:
Style/Documentation:
Enabled: false

# Reason: Route redirects are not token-formatted and must be skipped
# https://docs.rubocop.org/rubocop/cops_style.html#styleformatstringtoken
Style/FormatStringToken:
inherit_mode:
merge:
- AllowedMethods # The rubocop-rails config adds `redirect`
AllowedMethods:
- redirect_with_vary

# Reason: Enforce modern Ruby style
# https://docs.rubocop.org/rubocop/cops_style.html#stylehashsyntax
Style/HashSyntax:
Expand Down
12 changes: 6 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,6 @@ group :test do
# Used to mock environment variables
gem 'climate_control'

# Generating fake data for specs
gem 'faker', '~> 3.2'

# Generate test objects for specs
gem 'fabrication', '~> 2.30'

# Add back helpers functions removed in Rails 5.1
gem 'rails-controller-testing', '~> 1.0'

Expand Down Expand Up @@ -184,6 +178,12 @@ group :development, :test do
# Interactive Debugging tools
gem 'debug', '~> 1.8'

# Generate fake data values
gem 'faker', '~> 3.2'

# Generate factory objects
gem 'fabrication', '~> 2.30'

# Profiling tools
gem 'memory_profiler', require: false
gem 'ruby-prof', require: false
Expand Down
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ GEM
bundler-audit (0.9.1)
bundler (>= 1.2.0, < 3)
thor (~> 1.0)
capybara (3.39.2)
capybara (3.40.0)
addressable
matrix
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
nokogiri (~> 1.11)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
Expand All @@ -180,7 +180,7 @@ GEM
activesupport
cbor (0.5.9.6)
charlock_holmes (0.7.7)
chewy (7.5.0)
chewy (7.5.1)
activesupport (>= 5.2)
elasticsearch (>= 7.12.0, < 7.14.0)
elasticsearch-dsl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class ComposeForm extends ImmutablePureComponent {
singleColumn: PropTypes.bool,
lang: PropTypes.string,
circleId: PropTypes.string,
maxChars: PropTypes.number,
...WithOptionalRouterPropTypes
};

Expand Down Expand Up @@ -109,11 +110,11 @@ class ComposeForm extends ImmutablePureComponent {
};

canSubmit = () => {
const { isSubmitting, isChangingUpload, isUploading, anyMedia, privacy, circleId, isEditing } = this.props;
const { isSubmitting, isChangingUpload, isUploading, anyMedia, maxChars, privacy, circleId, isEditing } = this.props;
const fulltext = this.getFulltextForCharacterCounting();
const isOnlyWhitespace = fulltext.length !== 0 && fulltext.trim().length === 0;

return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > 500 || (isOnlyWhitespace && !anyMedia) || (privacy === 'circle' && !isEditing && !circleId));
return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > maxChars || (isOnlyWhitespace && !anyMedia) || (privacy === 'circle' && !isEditing && !circleId));
};

handleSubmit = (e) => {
Expand Down Expand Up @@ -238,7 +239,7 @@ class ComposeForm extends ImmutablePureComponent {
};

render () {
const { intl, onPaste, autoFocus, withoutNavigation } = this.props;
const { intl, onPaste, autoFocus, withoutNavigation, maxChars } = this.props;
const { highlighted } = this.state;
const disabled = this.props.isSubmitting;

Expand Down Expand Up @@ -319,7 +320,7 @@ class ComposeForm extends ImmutablePureComponent {
<SpoilerButtonContainer />
<EmojiPickerDropdown onPickEmoji={this.handleEmojiPick} />
<MarkdownButtonContainer />
<CharacterCounter max={500} text={this.getFulltextForCharacterCounting()} />
<CharacterCounter max={maxChars} text={this.getFulltextForCharacterCounting()} />
</div>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class EmojiPickerMenuImpl extends PureComponent {
intl: PropTypes.object.isRequired,
skinTone: PropTypes.number.isRequired,
onSkinTone: PropTypes.func.isRequired,
pickerButtonRef: PropTypes.func.isRequired
};

static defaultProps = {
Expand All @@ -178,7 +179,7 @@ class EmojiPickerMenuImpl extends PureComponent {
};

handleDocumentClick = e => {
if (this.node && !this.node.contains(e.target)) {
if (this.node && !this.node.contains(e.target) && !this.props.pickerButtonRef.contains(e.target)) {
this.props.onClose();
}
};
Expand Down Expand Up @@ -233,6 +234,7 @@ class EmojiPickerMenuImpl extends PureComponent {
emoji.native = emoji.colons;
}
if (!(event.ctrlKey || event.metaKey)) {

this.props.onClose();
}
this.props.onPick(emoji);
Expand Down Expand Up @@ -426,6 +428,7 @@ class EmojiPickerDropdown extends PureComponent {
onSkinTone={onSkinTone}
skinTone={skinTone}
frequentlyUsedEmojis={frequentlyUsedEmojis}
pickerButtonRef={this.target}
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import AutosuggestInput from 'mastodon/components/autosuggest_input';

const messages = defineMessages({
option_placeholder: { id: 'compose_form.poll.option_placeholder', defaultMessage: 'Option {number}' },
add_option: { id: 'compose_form.poll.add_option', defaultMessage: 'Add option' },
remove_option: { id: 'compose_form.poll.remove_option', defaultMessage: 'Remove this option' },
duration: { id: 'compose_form.poll.duration', defaultMessage: 'Poll length' },
type: { id: 'compose_form.poll.type', defaultMessage: 'Style' },
switchToMultiple: { id: 'compose_form.poll.switch_to_multiple', defaultMessage: 'Change poll to allow multiple choices' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const mapStateToProps = state => ({
isInReply: state.getIn(['compose', 'in_reply_to']) !== null,
lang: state.getIn(['compose', 'language']),
circleId: state.getIn(['compose', 'circle_id']),
maxChars: state.getIn(['server', 'server', 'configuration', 'statuses', 'max_characters'], 500),
});

const mapDispatchToProps = (dispatch) => ({
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/features/ui/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ class UI extends PureComponent {
handleHotkeyNew = e => {
e.preventDefault();

const element = this.node.querySelector('.compose-form__autosuggest-wrapper textarea');
const element = this.node.querySelector('.compose-form__scrollable textarea');

if (element) {
element.focus();
Expand Down
16 changes: 0 additions & 16 deletions app/javascript/mastodon/locales/af.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"alert.unexpected.message": "Iets het skeefgeloop.",
"alert.unexpected.title": "Oeps!",
"announcement.announcement": "Aankondiging",
"autosuggest_hashtag.per_week": "{count} per week",
"boost_modal.combo": "Druk {combo} om dit volgende keer oor te slaan",
"bundle_column_error.error.title": "Ag nee!",
"bundle_column_error.network.title": "Netwerkfout",
Expand Down Expand Up @@ -111,19 +110,12 @@
"compose_form.lock_disclaimer": "Jou rekening is nie {locked} nie. Enigiemand kan jou volg en sien wat jy vir jou volgers plaas.",
"compose_form.lock_disclaimer.lock": "gesluit",
"compose_form.placeholder": "Wat wil jy deel?",
"compose_form.poll.add_option": "Voeg ’n keuse by",
"compose_form.poll.duration": "Duur van peiling",
"compose_form.poll.option_placeholder": "Keuse {number}",
"compose_form.poll.remove_option": "Verwyder hierdie keuse",
"compose_form.poll.switch_to_multiple": "Verander peiling om meer as een keuse toe te laat",
"compose_form.poll.switch_to_single": "Verander die peiling om slegs een keuse toe te laat",
"compose_form.publish": "Publiseer",
"compose_form.publish_form": "Publiseer",
"compose_form.publish_loud": "{publish}!",
"compose_form.save_changes": "Stoor veranderinge",
"compose_form.spoiler.marked": "Verwyder inhoudswaarskuwing",
"compose_form.spoiler.unmarked": "Voeg inhoudswaarskuwing by",
"compose_form.spoiler_placeholder": "Skryf jou waarskuwing hier",
"confirmation_modal.cancel": "Kanselleer",
"confirmations.block.block_and_report": "Blokkeer en rapporteer",
"confirmations.block.confirm": "Blokkeer",
Expand Down Expand Up @@ -234,7 +226,6 @@
"navigation_bar.community_timeline": "Plaaslike tydlyn",
"navigation_bar.compose": "Skep nuwe plasing",
"navigation_bar.domain_blocks": "Geblokkeerde domeine",
"navigation_bar.edit_profile": "Redigeer profiel",
"navigation_bar.lists": "Lyste",
"navigation_bar.logout": "Teken uit",
"navigation_bar.personal": "Persoonlik",
Expand Down Expand Up @@ -267,14 +258,7 @@
"onboarding.steps.share_profile.body": "Let your friends know how to find you on Mastodon!",
"onboarding.steps.share_profile.title": "Share your profile",
"privacy.change": "Verander privaatheid van plasing",
"privacy.direct.long": "Slegs sigbaar vir genoemde gebruikers",
"privacy.direct.short": "Slegs genoemde persone",
"privacy.private.long": "Slegs sigbaar vir volgelinge",
"privacy.private.short": "Slegs volgelinge",
"privacy.public.long": "Sigbaar vir almal",
"privacy.public.short": "Publiek",
"privacy.unlisted.long": "Sigbaar vir almal, maar onttrek uit verkennings-kenmerke",
"privacy.unlisted.short": "Ongelys",
"privacy_policy.last_updated": "Laaste bywerking op {date}",
"privacy_policy.title": "Privaatheidsbeleid",
"regeneration_indicator.sublabel": "Jou tuis-voer word voorberei!",
Expand Down
21 changes: 0 additions & 21 deletions app/javascript/mastodon/locales/an.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
"announcement.announcement": "Anuncio",
"attachments_list.unprocessed": "(sin procesar)",
"audio.hide": "Amagar audio",
"autosuggest_hashtag.per_week": "{count} per semana",
"boost_modal.combo": "Puetz fer clic en {combo} pa blincar este aviso la proxima vegada",
"bundle_column_error.copy_stacktrace": "Copiar informe d'error",
"bundle_column_error.error.body": "La pachina solicitada no podió estar renderizada. Podría deber-se a una error en o nuestro codigo u a un problema de compatibilidat con o navegador.",
Expand Down Expand Up @@ -126,22 +125,12 @@
"compose_form.lock_disclaimer": "La tuya cuenta no ye {locked}. Totz pueden seguir-te pa veyer las tuyas publicacions nomás pa seguidores.",
"compose_form.lock_disclaimer.lock": "blocau",
"compose_form.placeholder": "En qué yes pensando?",
"compose_form.poll.add_option": "Anyadir una opción",
"compose_form.poll.duration": "Duración d'a enqüesta",
"compose_form.poll.option_placeholder": "Elección {number}",
"compose_form.poll.remove_option": "Eliminar esta opción",
"compose_form.poll.switch_to_multiple": "Modificar enqüesta pa permitir multiples opcions",
"compose_form.poll.switch_to_single": "Modificar enqüesta pa permitir una sola opción",
"compose_form.publish": "Publicar",
"compose_form.publish_form": "Publicar",
"compose_form.publish_loud": "{publish}!",
"compose_form.save_changes": "Alzar cambios",
"compose_form.sensitive.hide": "{count, plural, one {Marcar material como sensible} other {Marcar material como sensible}}",
"compose_form.sensitive.marked": "{count, plural, one {Material marcau como sensible} other {Material marcau como sensible}}",
"compose_form.sensitive.unmarked": "{count, plural, one {Material no marcau como sensible} other {Material no marcau como sensible}}",
"compose_form.spoiler.marked": "Texto amagau dimpués de l'alvertencia",
"compose_form.spoiler.unmarked": "Texto no amagau",
"compose_form.spoiler_placeholder": "Alvertencia de conteniu",
"confirmation_modal.cancel": "Cancelar",
"confirmations.block.block_and_report": "Blocar y Denunciar",
"confirmations.block.confirm": "Blocar",
Expand Down Expand Up @@ -345,7 +334,6 @@
"navigation_bar.compose": "Escribir nueva publicación",
"navigation_bar.discover": "Descubrir",
"navigation_bar.domain_blocks": "Dominios amagaus",
"navigation_bar.edit_profile": "Editar perfil",
"navigation_bar.explore": "Explorar",
"navigation_bar.filters": "Parolas silenciadas",
"navigation_bar.follow_requests": "Solicitutz pa seguir-te",
Expand Down Expand Up @@ -429,14 +417,7 @@
"poll_button.add_poll": "Anyadir una enqüesta",
"poll_button.remove_poll": "Eliminar enqüesta",
"privacy.change": "Achustar privacidat",
"privacy.direct.long": "Nomás amostrar a los usuarios mencionaus",
"privacy.direct.short": "Nomás contas mencionadas",
"privacy.private.long": "Nomás amostrar a seguidores",
"privacy.private.short": "Solo seguidores",
"privacy.public.long": "Visible pa totz",
"privacy.public.short": "Publico",
"privacy.unlisted.long": "Visible pa totz, pero excluyiu d'as funcions d'escubrimiento",
"privacy.unlisted.short": "No listau",
"privacy_policy.last_updated": "Ultima vegada actualizau {date}",
"privacy_policy.title": "Politica de Privacidat",
"refresh": "Actualizar",
Expand Down Expand Up @@ -590,10 +571,8 @@
"upload_error.poll": "Puyada de fichers no permitida con enqüestas.",
"upload_form.audio_description": "Describir pa personas con problemas auditivos",
"upload_form.description": "Describir pa los usuarios con dificultat visual",
"upload_form.description_missing": "Garra descripción anyadida",
"upload_form.edit": "Editar",
"upload_form.thumbnail": "Cambiar miniatura",
"upload_form.undo": "Borrar",
"upload_form.video_description": "Describir pa personas con problemas auditivos u visuals",
"upload_modal.analyzing_picture": "Analisando imachen…",
"upload_modal.apply": "Aplicar",
Expand Down
21 changes: 0 additions & 21 deletions app/javascript/mastodon/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
"announcement.announcement": "إعلان",
"attachments_list.unprocessed": "(غير معالَج)",
"audio.hide": "إخفاء المقطع الصوتي",
"autosuggest_hashtag.per_week": "{count} في الأسبوع",
"boost_modal.combo": "يُمكنك الضّغط على {combo} لتخطي هذا في المرة المُقبلة",
"bundle_column_error.copy_stacktrace": "انسخ تقرير الخطأ",
"bundle_column_error.error.body": "لا يمكن تقديم الصفحة المطلوبة. قد يكون بسبب خطأ في التعليمات البرمجية، أو مشكلة توافق المتصفح.",
Expand Down Expand Up @@ -143,22 +142,12 @@
"compose_form.lock_disclaimer": "حسابُك غير {locked}. يُمكن لأي شخص مُتابعتك لرؤية (منشورات المتابعين فقط).",
"compose_form.lock_disclaimer.lock": "مُقفَل",
"compose_form.placeholder": "فِيمَ تُفكِّر؟",
"compose_form.poll.add_option": "إضافة خيار",
"compose_form.poll.duration": "مُدَّة اِستطلاع الرأي",
"compose_form.poll.option_placeholder": "الخيار {number}",
"compose_form.poll.remove_option": "إزالة هذا الخيار",
"compose_form.poll.switch_to_multiple": "تغيِير الاستطلاع للسماح باِخيارات مُتعدِّدة",
"compose_form.poll.switch_to_single": "تغيِير الاستطلاع للسماح باِخيار واحد فقط",
"compose_form.publish": "نشر",
"compose_form.publish_form": "منشور جديد",
"compose_form.publish_loud": "{publish}!",
"compose_form.save_changes": "احفظ التعديلات",
"compose_form.sensitive.hide": "{count, plural, one {الإشارة إلى الوَسط كمُحتوى حسّاس} two{الإشارة إلى الوسطان كمُحتويان حسّاسان} other {الإشارة إلى الوسائط كمُحتويات حسّاسة}}",
"compose_form.sensitive.marked": "{count, plural, one {تمَّ الإشارة إلى الوسط كمُحتوى حسّاس} two{تمَّ الإشارة إلى الوسطان كمُحتويان حسّاسان} other {تمَّ الإشارة إلى الوسائط كمُحتويات حسّاسة}}",
"compose_form.sensitive.unmarked": "{count, plural, one {لم تَتِمّ الإشارة إلى الوسط كمُحتوى حسّاس} two{لم تَتِمّ الإشارة إلى الوسطان كمُحتويان حسّاسان} other {لم تَتِمّ الإشارة إلى الوسائط كمُحتويات حسّاسة}}",
"compose_form.spoiler.marked": "إزالة تحذير المحتوى",
"compose_form.spoiler.unmarked": "إضافة تحذير للمحتوى",
"compose_form.spoiler_placeholder": "اُكتُب تحذيركَ هُنا",
"confirmation_modal.cancel": "إلغاء",
"confirmations.block.block_and_report": "حظره والإبلاغ عنه",
"confirmations.block.confirm": "حظر",
Expand Down Expand Up @@ -402,7 +391,6 @@
"navigation_bar.direct": "الإشارات الخاصة",
"navigation_bar.discover": "اكتشف",
"navigation_bar.domain_blocks": "النطاقات المحظورة",
"navigation_bar.edit_profile": "عدّل الملف التعريفي",
"navigation_bar.explore": "استكشف",
"navigation_bar.favourites": "المفضلة",
"navigation_bar.filters": "الكلمات المكتومة",
Expand Down Expand Up @@ -509,14 +497,7 @@
"poll_button.add_poll": "إضافة استطلاع للرأي",
"poll_button.remove_poll": "إزالة استطلاع الرأي",
"privacy.change": "اضبط خصوصية المنشور",
"privacy.direct.long": "مرئي للمستخدمين المذكورين فقط",
"privacy.direct.short": "الأشخاص المشار إليهم فقط",
"privacy.private.long": "أنشر لمتابعيك فقط",
"privacy.private.short": "للمتابِعين فقط",
"privacy.public.long": "مرئي للكل",
"privacy.public.short": "للعامة",
"privacy.unlisted.long": "مرئي للجميع، ولكن مِن دون ميزات الاكتشاف",
"privacy.unlisted.short": "غير مدرج",
"privacy_policy.last_updated": "آخر تحديث {date}",
"privacy_policy.title": "سياسة الخصوصية",
"refresh": "أنعِش",
Expand Down Expand Up @@ -696,10 +677,8 @@
"upload_error.poll": "لا يمكن إدراج ملفات في استطلاعات الرأي.",
"upload_form.audio_description": "وصف للأشخاص ذي قِصر السمع",
"upload_form.description": "وصف للمعاقين بصريا",
"upload_form.description_missing": "لم يُضف وصف",
"upload_form.edit": "تعديل",
"upload_form.thumbnail": "غيّر الصورة المصغرة",
"upload_form.undo": "حذف",
"upload_form.video_description": "وصف للمعاقين بصريا أو لِذي قِصر السمع",
"upload_modal.analyzing_picture": "جارٍ فحص الصورة…",
"upload_modal.apply": "طبّق",
Expand Down
Loading

0 comments on commit 832da1c

Please sign in to comment.