Skip to content

Commit

Permalink
Merge branch 'mastodon:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
DismalShadowX authored Jul 12, 2024
2 parents f90144c + c929b4c commit bbb3f59
Show file tree
Hide file tree
Showing 50 changed files with 284 additions and 213 deletions.
4 changes: 2 additions & 2 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config --auto-gen-only-exclude --no-offense-counts --no-auto-gen-timestamp`
# using RuboCop version 1.64.1.
# using RuboCop version 1.65.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand All @@ -14,7 +14,7 @@ Lint/NonLocalExitFromIterator:
Metrics/AbcSize:
Max: 82

# Configuration parameters: CountBlocks, Max.
# Configuration parameters: CountBlocks, CountModifierForms, Max.
Metrics/BlockNesting:
Exclude:
- 'lib/tasks/mastodon.rake'
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ ENV \
# Optimize jemalloc 5.x performance
MALLOC_CONF="narenas:2,background_thread:true,thp:never,dirty_decay_ms:1000,muzzy_decay_ms:0" \
# Enable libvips, should not be changed
MASTODON_USE_LIBVIPS=true
MASTODON_USE_LIBVIPS=true \
# Sidekiq will touch tmp/sidekiq_process_has_started_and_will_begin_processing_jobs to indicate it is ready. This can be used for a readiness check in Kubernetes
MASTODON_SIDEKIQ_READY_FILENAME=sidekiq_process_has_started_and_will_begin_processing_jobs

# Set default shell used for running commands
SHELL ["/bin/bash", "-o", "pipefail", "-o", "errexit", "-c"]
Expand Down
14 changes: 7 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ GEM
case_transform (0.2)
activesupport
cbor (0.5.9.8)
charlock_holmes (0.7.8)
charlock_holmes (0.7.9)
chewy (7.6.0)
activesupport (>= 5.2)
elasticsearch (>= 7.14.0, < 8)
Expand All @@ -180,7 +180,7 @@ GEM
css_parser (1.17.1)
addressable
csv (3.3.0)
database_cleaner-active_record (2.1.0)
database_cleaner-active_record (2.2.0)
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
Expand Down Expand Up @@ -583,15 +583,15 @@ GEM
orm_adapter (0.5.0)
ox (2.14.18)
parallel (1.25.1)
parser (3.3.3.0)
parser (3.3.4.0)
ast (~> 2.4.1)
racc
parslet (2.0.0)
pastel (0.8.0)
tty-color (~> 0.5)
pg (1.5.6)
pghero (3.5.0)
activerecord (>= 6)
pghero (3.6.0)
activerecord (>= 6.1)
premailer (1.23.0)
addressable
css_parser (>= 1.12.0)
Expand Down Expand Up @@ -733,13 +733,13 @@ GEM
rspec-mocks (~> 3.0)
sidekiq (>= 5, < 8)
rspec-support (3.13.1)
rubocop (1.64.1)
rubocop (1.65.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
regexp_parser (>= 2.4, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/components/status.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ class Status extends ImmutablePureComponent {
<RelativeTimestamp timestamp={status.get('created_at')} />{status.get('edited_at') && <abbr title={intl.formatMessage(messages.edited, { date: intl.formatDate(status.get('edited_at'), { year: 'numeric', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }) })}> *</abbr>}
</a>

<a onClick={this.handleAccountClick} href={`/@${status.getIn(['account', 'acct'])}`} data-hover-card-account={status.getIn(['account', 'id'])} className='status__display-name' target='_blank' rel='noopener noreferrer'>
<a onClick={this.handleAccountClick} href={`/@${status.getIn(['account', 'acct'])}`} title={status.getIn(['account', 'acct'])} data-hover-card-account={status.getIn(['account', 'id'])} className='status__display-name' target='_blank' rel='noopener noreferrer'>
<div className='status__avatar'>
{statusAvatar}
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/components/status_content.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class StatusContent extends PureComponent {

if (mention) {
link.addEventListener('click', this.onMentionClick.bind(this, mention), false);
link.removeAttribute('title');
link.setAttribute('title', `@${mention.get('acct')}`);
link.setAttribute('href', `/@${mention.get('acct')}`);
link.setAttribute('data-hover-card-account', mention.get('id'));
} else if (link.textContent[0] === '#' || (link.previousSibling && link.previousSibling.textContent && link.previousSibling.textContent[link.previousSibling.textContent.length - 1] === '#')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ class Notification extends ImmutablePureComponent {

const targetAccount = report.get('target_account');
const targetDisplayNameHtml = { __html: targetAccount.get('display_name_html') };
const targetLink = <bdi><Link className='notification__display-name' data-hover-card-account={targetAccount.get('id')} to={`/@${targetAccount.get('acct')}`} dangerouslySetInnerHTML={targetDisplayNameHtml} /></bdi>;
const targetLink = <bdi><Link className='notification__display-name' title={targetAccount.get('acct')} data-hover-card-account={targetAccount.get('id')} to={`/@${targetAccount.get('acct')}`} dangerouslySetInnerHTML={targetDisplayNameHtml} /></bdi>;

return (
<HotKeys handlers={this.getHandlers()}>
Expand All @@ -458,7 +458,7 @@ class Notification extends ImmutablePureComponent {
const { notification } = this.props;
const account = notification.get('account');
const displayNameHtml = { __html: account.get('display_name_html') };
const link = <bdi><Link className='notification__display-name' href={`/@${account.get('acct')}`} data-hover-card-account={account.get('id')} to={`/@${account.get('acct')}`} dangerouslySetInnerHTML={displayNameHtml} /></bdi>;
const link = <bdi><Link className='notification__display-name' href={`/@${account.get('acct')}`} title={account.get('acct')} data-hover-card-account={account.get('id')} to={`/@${account.get('acct')}`} dangerouslySetInnerHTML={displayNameHtml} /></bdi>;

switch(notification.get('type')) {
case 'follow':
Expand Down
4 changes: 2 additions & 2 deletions app/javascript/mastodon/features/ui/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { clearHeight } from '../../actions/height_cache';
import { expandNotifications } from '../../actions/notifications';
import { fetchServer, fetchServerTranslationLanguages } from '../../actions/server';
import { expandHomeTimeline } from '../../actions/timelines';
import initialState, { me, owner, singleUserMode, trendsEnabled, trendsAsLanding } from '../../initial_state';
import initialState, { me, owner, singleUserMode, trendsEnabled, trendsAsLanding, disableHoverCards } from '../../initial_state';

import BundleColumnError from './components/bundle_column_error';
import Header from './components/header';
Expand Down Expand Up @@ -588,7 +588,7 @@ class UI extends PureComponent {

{layout !== 'mobile' && <PictureInPicture />}
<NotificationsContainer />
<HoverCardController />
{!disableHoverCards && <HoverCardController />}
<LoadingBarContainer className='loading-bar' />
<ModalContainer />
<UploadArea active={draggingOver} onClose={this.closeUploadModal} />
Expand Down
2 changes: 2 additions & 0 deletions app/javascript/mastodon/initial_state.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* @property {boolean=} boost_modal
* @property {boolean=} delete_modal
* @property {boolean=} disable_swiping
* @property {boolean=} disable_hover_cards
* @property {string=} disabled_account_id
* @property {string} display_media
* @property {string} domain
Expand Down Expand Up @@ -86,6 +87,7 @@ export const autoPlayGif = getMeta('auto_play_gif');
export const boostModal = getMeta('boost_modal');
export const deleteModal = getMeta('delete_modal');
export const disableSwiping = getMeta('disable_swiping');
export const disableHoverCards = getMeta('disable_hover_cards');
export const disabledAccountId = getMeta('disabled_account_id');
export const displayMedia = getMeta('display_media');
export const domain = getMeta('domain');
Expand Down
24 changes: 12 additions & 12 deletions app/javascript/mastodon/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"about.disclaimer": "ماستدون برنامج حر ومفتوح المصدر وعلامة تجارية لـ Mastodon GmbH.",
"about.domain_blocks.no_reason_available": "السبب غير متوفر",
"about.domain_blocks.preamble": "يسمح لك ماستدون عموماً بعرض المحتوى من المستخدمين من أي خادم آخر في الفدرالية والتفاعل معهم. وهذه هي الاستثناءات التي وضعت على هذا الخادم بالذات.",
"about.domain_blocks.silenced.explanation": "عموماً، لن ترى ملفات التعريف والمحتوى من هذا الخادم، إلا إذا كنت تبحث عنه بشكل صريح أو تختار أن تتابعه.",
"about.domain_blocks.silenced.explanation": "لن تظهر لك ملفات التعريف الشخصية والمحتوى من هذا الخادوم، إلا إن بحثت عنه عمدًا أو تابعته.",
"about.domain_blocks.silenced.title": "محدود",
"about.domain_blocks.suspended.explanation": "لن يتم معالجة أي بيانات من هذا الخادم أو تخزينها أو تبادلها، مما يجعل أي تفاعل أو اتصال مع المستخدمين من هذا الخادم مستحيلا.",
"about.domain_blocks.suspended.title": "مُعلّق",
Expand All @@ -21,7 +21,7 @@
"account.blocked": "محظور",
"account.browse_more_on_origin_server": "تصفح المزيد في الملف الشخصي الأصلي",
"account.cancel_follow_request": "إلغاء طلب المتابعة",
"account.copy": "نسخ الرابط إلى الحساب",
"account.copy": "نسخ الرابط إلى الملف الشخصي",
"account.direct": "إشارة خاصة لـ @{name}",
"account.disable_notifications": "توقف عن إشعاري عندما ينشر @{name}",
"account.domain_blocked": "اسم النِّطاق محظور",
Expand All @@ -32,7 +32,7 @@
"account.featured_tags.last_status_never": "لا توجد رسائل",
"account.featured_tags.title": "وسوم {name} المميَّزة",
"account.follow": "متابعة",
"account.follow_back": "رد المتابعة",
"account.follow_back": "تابعهم بالمثل",
"account.followers": "مُتابِعون",
"account.followers.empty": "لا أحدَ يُتابع هذا المُستخدم إلى حد الآن.",
"account.following": "الاشتراكات",
Expand All @@ -51,7 +51,7 @@
"account.mute_notifications_short": "كتم الإشعارات",
"account.mute_short": "اكتم",
"account.muted": "مَكتوم",
"account.mutual": "متبادل",
"account.mutual": "متبادلة",
"account.no_bio": "لم يتم تقديم وصف.",
"account.open_original_page": "افتح الصفحة الأصلية",
"account.posts": "منشورات",
Expand All @@ -70,8 +70,8 @@
"account.unmute_notifications_short": "إلغاء كَتم الإشعارات",
"account.unmute_short": "إلغاء الكتم",
"account_note.placeholder": "اضغط لإضافة مُلاحظة",
"admin.dashboard.daily_retention": "معدل الاحتفاظ بالمستخدم بعد التسجيل بيوم",
"admin.dashboard.monthly_retention": "معدل الاحتفاظ بالمستخدم بعد التسجيل بالشهور",
"admin.dashboard.daily_retention": "معدّل بقاء المستخدمين بعد إنشاء الحسابات، بالأيام",
"admin.dashboard.monthly_retention": "معدّل بقاء المستخدمين بعد إنشاء الحسابات، بالشهور",
"admin.dashboard.retention.average": "المعدل",
"admin.dashboard.retention.cohort": "شهر التسجيل",
"admin.dashboard.retention.cohort_size": "المستخدمون الجدد",
Expand All @@ -87,12 +87,12 @@
"attachments_list.unprocessed": "(غير معالَج)",
"audio.hide": "إخفاء المقطع الصوتي",
"block_modal.remote_users_caveat": "سوف نطلب من الخادم {domain} أن يحترم قرارك، لكن الالتزام غير مضمون لأن بعض الخواديم قد تتعامل مع نصوص الكتل بشكل مختلف. قد تظل المنشورات العامة مرئية للمستخدمين غير المسجلين الدخول.",
"block_modal.show_less": "أظهر الأقل",
"block_modal.show_more": "أظهر المزيد",
"block_modal.show_less": "تفاصيل أقلّ",
"block_modal.show_more": "تفاصيل أكثر",
"block_modal.they_cant_mention": "لن يستطيع ذِكرك أو متابعتك.",
"block_modal.they_cant_see_posts": "لن يستطيع رؤية منشوراتك ولن ترى منشوراته.",
"block_modal.they_will_know": "يمكنه أن يرى أنه قد تم حظره.",
"block_modal.title": "أتريد حظر المستخدم؟",
"block_modal.they_cant_see_posts": "لن يستطيع مطالعة منشوراتك ولن تطالع منشوراته.",
"block_modal.they_will_know": "سيعلم أنه قد حُظِر.",
"block_modal.title": "أتريد حظر هذا المستخدم؟",
"block_modal.you_wont_see_mentions": "لن تر المنشورات التي يُشار فيهم إليه.",
"boost_modal.combo": "يُمكنك الضّغط على {combo} لتخطي هذا في المرة المُقبلة",
"bundle_column_error.copy_stacktrace": "انسخ تقرير الخطأ",
Expand Down Expand Up @@ -156,7 +156,7 @@
"compose_form.poll.single": "اختر واحدا",
"compose_form.poll.switch_to_multiple": "تغيِير الاستطلاع للسماح باِخيارات مُتعدِّدة",
"compose_form.poll.switch_to_single": "تغيِير الاستطلاع للسماح باِخيار واحد فقط",
"compose_form.poll.type": "الأسلوب",
"compose_form.poll.type": "الطراز",
"compose_form.publish": "نشر",
"compose_form.publish_form": "منشور جديد",
"compose_form.reply": "ردّ",
Expand Down
4 changes: 4 additions & 0 deletions app/javascript/mastodon/locales/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
"account.follow_back": "Падпісацца ў адказ",
"account.followers": "Падпісчыкі",
"account.followers.empty": "Ніхто пакуль не падпісаны на гэтага карыстальніка.",
"account.followers_counter": "{count, plural, one {{counter} падпісчык} few {{counter} падпісчыкі} many {{counter} падпісчыкаў} other {{counter} падпісчыка}}",
"account.following": "Падпіскі",
"account.following_counter": "{count, plural, one {{counter} падпіска} few {{counter} падпіскі} many {{counter} падпісак} other {{counter} падпіскі}}",
"account.follows.empty": "Карыстальнік ні на каго не падпісаны.",
"account.go_to_profile": "Перайсці да профілю",
"account.hide_reblogs": "Схаваць пашырэнні ад @{name}",
Expand All @@ -61,6 +63,7 @@
"account.requested_follow": "{name} адправіў запыт на падпіску",
"account.share": "Абагуліць профіль @{name}",
"account.show_reblogs": "Паказаць падштурхоўванні ад @{name}",
"account.statuses_counter": "{count, plural, one {{counter} допіс} few {{counter} допісы} many {{counter} допісаў} other {{counter} допісу}}",
"account.unblock": "Разблакіраваць @{name}",
"account.unblock_domain": "Разблакіраваць дамен {domain}",
"account.unblock_short": "Разблакіраваць",
Expand Down Expand Up @@ -412,6 +415,7 @@
"limited_account_hint.title": "Гэты профіль быў схаваны мадэратарамі",
"link_preview.author": "Ад {name}",
"link_preview.more_from_author": "Больш ад {name}",
"link_preview.shares": "{count, plural, one {{counter} допіс} few {{counter} допісы} many {{counter} допісаў} other {{counter} допісу}}",
"lists.account.add": "Дадаць да спісу",
"lists.account.remove": "Выдаліць са спісу",
"lists.delete": "Выдаліць спіс",
Expand Down
6 changes: 6 additions & 0 deletions app/javascript/mastodon/locales/kab.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@
"account.featured_tags.last_status_at": "Tasuffeɣt taneggarut ass n {date}",
"account.featured_tags.last_status_never": "Ulac tisuffaɣ",
"account.follow": "Ḍfer",
"account.follow_back": "Ḍfer-it ula d kečč·m",
"account.followers": "Imeḍfaren",
"account.followers.empty": "Ar tura, ulac yiwen i yeṭṭafaṛen amseqdac-agi.",
"account.followers_counter": "{count, plural, one {{counter} n umḍfar} other {{counter} n yimeḍfaren}}",
"account.following": "Yeṭṭafaṛ",
"account.following_counter": "{count, plural, one {{counter} yettwaḍfaren} other {{counter} yettwaḍfaren}}",
"account.follows.empty": "Ar tura, amseqdac-agi ur yeṭṭafaṛ yiwen.",
"account.go_to_profile": "Ddu ɣer umaɣnu",
"account.hide_reblogs": "Ffer ayen i ibeṭṭu @{name}",
Expand All @@ -53,6 +56,7 @@
"account.requested_follow": "{name} yessuter ad k·m-yeḍfer",
"account.share": "Bḍu amaɣnu n @{name}",
"account.show_reblogs": "Ssken-d inebḍa n @{name}",
"account.statuses_counter": "{count, plural, one {{counter} n tsuffeɣt} other {{counter} n tsuffaɣ}}",
"account.unblock": "Serreḥ i @{name}",
"account.unblock_domain": "Ssken-d {domain}",
"account.unblock_short": "Serreḥ",
Expand Down Expand Up @@ -560,6 +564,7 @@
"status.edited_x_times": "Tettwaẓreg {count, plural, one {{count} n tikkelt} other {{count} n tikkal}}",
"status.embed": "Seddu",
"status.favourite": "Amenyaf",
"status.favourites": "{count, plural, one {n usmenyaf} other {n ismenyafen}}",
"status.filter": "Sizdeg tassufeɣt-a",
"status.filtered": "Yettwasizdeg",
"status.hide": "Ffer tasuffeɣt",
Expand All @@ -579,6 +584,7 @@
"status.read_more": "Issin ugar",
"status.reblog": "Bḍu",
"status.reblogged_by": "Yebḍa-tt {name}",
"status.reblogs": "{count, plural, one {n usnerni} other {n yisnernuyen}}",
"status.reblogs.empty": "Ula yiwen ur yebḍi tajewwiqt-agi ar tura. Ticki yebḍa-tt yiwen, ad d-iban da.",
"status.redraft": "Kkes tɛiwdeḍ tira",
"status.remove_bookmark": "Kkes tacreḍt",
Expand Down
4 changes: 4 additions & 0 deletions app/javascript/styles/mastodon-light/diff.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ html {
}
}

.icon-button:disabled {
color: darken($action-button-color, 25%);
}

.account__header__bar .avatar .account__avatar {
border-color: $white;
}
Expand Down
9 changes: 8 additions & 1 deletion app/lib/link_details_extractor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def document
end

def detect_encoding_and_parse_document
[detect_encoding, nil, @html_charset].uniq.each do |encoding|
[detect_encoding, nil, header_encoding].uniq.each do |encoding|
document = Nokogiri::HTML(@html, nil, encoding)
return document if document.to_s.valid_encoding?
end
Expand All @@ -286,6 +286,13 @@ def detect_encoding
guess&.fetch(:confidence, 0).to_i > 60 ? guess&.fetch(:encoding, nil) : nil
end

def header_encoding
Encoding.find(@html_charset).name if @html_charset
rescue ArgumentError
# Encoding from HTTP header is not recognized by ruby
nil
end

def detector
@detector ||= CharlockHolmes::EncodingDetector.new.tap do |detector|
detector.strip_tags = true
Expand Down
4 changes: 4 additions & 0 deletions app/models/concerns/user/has_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ def setting_disable_swiping
settings['web.disable_swiping']
end

def setting_disable_hover_cards
settings['web.disable_hover_cards']
end

def setting_always_send_emails
settings['always_send_emails']
end
Expand Down
1 change: 1 addition & 0 deletions app/models/user_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class KeyError < Error; end
setting :use_pending_items, default: false
setting :use_system_font, default: false
setting :disable_swiping, default: false
setting :disable_hover_cards, default: false
setting :delete_modal, default: true
setting :reblog_modal, default: false
setting :reduce_motion, default: false
Expand Down
1 change: 1 addition & 0 deletions app/serializers/initial_state_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def meta
store[:expand_spoilers] = object_account_user.setting_expand_spoilers
store[:reduce_motion] = object_account_user.setting_reduce_motion
store[:disable_swiping] = object_account_user.setting_disable_swiping
store[:disable_hover_cards] = object_account_user.setting_disable_hover_cards
store[:advanced_layout] = object_account_user.setting_advanced_layout
store[:use_blurhash] = object_account_user.setting_use_blurhash
store[:use_pending_items] = object_account_user.setting_use_pending_items
Expand Down
Loading

0 comments on commit bbb3f59

Please sign in to comment.