Skip to content

Commit

Permalink
Merge branch 'main' into temp2_for-ffxiv-mastodon
Browse files Browse the repository at this point in the history
# Conflicts:
#	config/locales/simple_form.en.yml
#	config/locales/simple_form.ja.yml
#	config/locales/simple_form.vi.yml
  • Loading branch information
mayaeh committed Aug 15, 2023
2 parents 7cce599 + df6e719 commit 29dbd72
Show file tree
Hide file tree
Showing 175 changed files with 737 additions and 922 deletions.
29 changes: 15 additions & 14 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
{
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
extends: [
'config:base',
':dependencyDashboard',
'config:recommended',
':labels(dependencies)',
':maintainLockFilesMonthly', // update non-direct dependencies monthly
':prConcurrentLimit10', // only 10 open PRs at the same time
':prConcurrentLimitNone', // Remove limit for open PRs at any time.
':prHourlyLimit2', // Rate limit PR creation to a maximum of two per hour.
],
stabilityDays: 3, // Wait 3 days after the package has been published before upgrading it
minimumReleaseAge: '3', // Wait 3 days after the package has been published before upgrading it
// packageRules order is important, they are applied from top to bottom and are merged,
// meaning the most important ones must be at the bottom, for example grouping rules
// If we do not want a package to be grouped with others, we need to set its groupName
// to `null` after any other rule set it to something.
dependencyDashboardHeader: 'This issue lists Renovate updates and detected dependencies. Read the [Dependency Dashboard](https://docs.renovatebot.com/key-concepts/dashboard/) docs to learn more. Before approving any upgrade: read the description and comments in the [`renovate.json5` file](https://github.com/mastodon/mastodon/blob/main/.github/renovate.json5).',
packageRules: [
{
// Ignore major version bumps for these node packages
// Require Dependency Dashboard Approval for major version bumps of these node packages
matchManagers: ['npm'],
matchPackageNames: [
'tesseract.js', // Requires code changes
Expand All @@ -41,10 +42,10 @@
'react-router-dom',
],
matchUpdateTypes: ['major'],
enabled: false,
dependencyDashboardApproval: true,
},
{
// Ignore major version bumps for these Ruby packages
// Require Dependency Dashboard Approval for major version bumps of these Ruby packages
matchManagers: ['bundler'],
matchPackageNames: [
'rack', // Needs to be synced with Rails version
Expand All @@ -55,33 +56,33 @@
'redis', // Requires manual upgrade and sync with Sidekiq version
],
matchUpdateTypes: ['major'],
enabled: false,
dependencyDashboardApproval: true,
},
{
// Update Github Actions and Docker images weekly
matchManagers: ['github-actions', 'dockerfile', 'docker-compose'],
extends: ['schedule:weekly'],
},
{
// Ignore major & minor bumps for the ruby image, this needs to be synced with .ruby-version
// Require Dependency Dashboard Approval for major & minor bumps for the ruby image, this needs to be synced with .ruby-version
matchManagers: ['dockerfile'],
matchPackageNames: ['moritzheiber/ruby-jemalloc'],
matchUpdateTypes: ['minor', 'major'],
enabled: false,
dependencyDashboardApproval: true,
},
{
// Ignore major bump for the node image, this needs to be synced with .nvmrc
// Require Dependency Dashboard Approval for major bumps for the node image, this needs to be synced with .nvmrc
matchManagers: ['dockerfile'],
matchPackageNames: ['node'],
matchUpdateTypes: ['major'],
enabled: false,
dependencyDashboardApproval: true,
},
{
// Ignore major postgres bumps in the docker-compose file, as those break dev environments
// Require Dependency Dashboard Approval for major postgres bumps in the docker-compose file, as those break dev environments
matchManagers: ['docker-compose'],
matchPackageNames: ['postgres'],
matchUpdateTypes: ['major'],
enabled: false,
dependencyDashboardApproval: true,
},
{
// Update devDependencies every week, with one grouped PR
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ GEM
tzinfo
excon (0.100.0)
fabrication (2.30.0)
faker (3.2.0)
faker (3.2.1)
i18n (>= 1.8.11, < 2)
faraday (1.10.3)
faraday-em_http (~> 1.0)
Expand Down Expand Up @@ -478,7 +478,7 @@ GEM
net-protocol
net-ssh (7.1.0)
nio4r (2.5.9)
nokogiri (1.15.3)
nokogiri (1.15.4)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
oj (3.15.0)
Expand Down
2 changes: 1 addition & 1 deletion app/chewy/accounts_index.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class AccountsIndex < Chewy::Index
settings index: { refresh_interval: '30s' }, analysis: {
settings index: index_preset(refresh_interval: '30s'), analysis: {
filter: {
english_stop: {
type: 'stop',
Expand Down
2 changes: 1 addition & 1 deletion app/chewy/instances_index.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class InstancesIndex < Chewy::Index
settings index: { refresh_interval: '30s' }
settings index: index_preset(refresh_interval: '30s')

index_scope ::Instance.searchable

Expand Down
2 changes: 1 addition & 1 deletion app/chewy/statuses_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class StatusesIndex < Chewy::Index
include FormattingHelper

settings index: { refresh_interval: '30s' }, analysis: {
settings index: index_preset(refresh_interval: '30s', number_of_shards: 5), analysis: {
filter: {
english_stemmer: {
type: 'stemmer',
Expand Down
2 changes: 1 addition & 1 deletion app/chewy/tags_index.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class TagsIndex < Chewy::Index
settings index: { refresh_interval: '30s' }, analysis: {
settings index: index_preset(refresh_interval: '30s'), analysis: {
analyzer: {
content: {
tokenizer: 'keyword',
Expand Down
27 changes: 27 additions & 0 deletions app/controllers/settings/privacy_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

class Settings::PrivacyController < Settings::BaseController
before_action :set_account

def show; end

def update
if UpdateAccountService.new.call(@account, account_params.except(:settings))
current_user.update!(settings_attributes: account_params[:settings])
ActivityPub::UpdateDistributionWorker.perform_async(@account.id)
redirect_to settings_privacy_path, notice: I18n.t('generic.changes_saved_msg')
else
render :show
end
end

private

def account_params
params.require(:account).permit(:discoverable, :locked, :hide_collections, settings: UserSettings.keys)
end

def set_account
@account = current_account
end
end
2 changes: 1 addition & 1 deletion app/controllers/settings/profiles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def update
private

def account_params
params.require(:account).permit(:display_name, :note, :avatar, :header, :locked, :bot, :discoverable, :hide_collections, fields_attributes: [:name, :value])
params.require(:account).permit(:display_name, :note, :avatar, :header, :bot, fields_attributes: [:name, :value])
end

def set_account
Expand Down
1 change: 1 addition & 0 deletions app/helpers/context_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module ContextHelper
focal_point: { 'toot' => 'http://joinmastodon.org/ns#', 'focalPoint' => { '@container' => '@list', '@id' => 'toot:focalPoint' } },
blurhash: { 'toot' => 'http://joinmastodon.org/ns#', 'blurhash' => 'toot:blurhash' },
discoverable: { 'toot' => 'http://joinmastodon.org/ns#', 'discoverable' => 'toot:discoverable' },
indexable: { 'toot' => 'http://joinmastodon.org/ns#', 'indexable' => 'toot:indexable' },
voters_count: { 'toot' => 'http://joinmastodon.org/ns#', 'votersCount' => 'toot:votersCount' },
olm: {
'toot' => 'http://joinmastodon.org/ns#', 'Device' => 'toot:Device', 'Ed25519Signature' => 'toot:Ed25519Signature', 'Ed25519Key' => 'toot:Ed25519Key', 'Curve25519Key' => 'toot:Curve25519Key', 'EncryptedMessage' => 'toot:EncryptedMessage', 'publicKeyBase64' => 'toot:publicKeyBase64', 'deviceId' => 'toot:deviceId',
Expand Down
50 changes: 50 additions & 0 deletions app/javascript/mastodon/components/hashtag_bar.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import PropTypes from 'prop-types';
import { useMemo, useState, useCallback } from 'react';

import { FormattedMessage } from 'react-intl';

import { Link } from 'react-router-dom';

import ImmutablePropTypes from 'react-immutable-proptypes';

const domParser = new DOMParser();

// About two lines on desktop
const VISIBLE_HASHTAGS = 7;

export const HashtagBar = ({ hashtags, text }) => {
const renderedHashtags = useMemo(() => {
const body = domParser.parseFromString(text, 'text/html').documentElement;
return [].map.call(body.querySelectorAll('[rel=tag]'), node => node.textContent.toLowerCase());
}, [text]);

const invisibleHashtags = useMemo(() => (
hashtags.filter(hashtag => !renderedHashtags.some(textContent => textContent === `#${hashtag.get('name')}` || textContent === hashtag.get('name')))
), [hashtags, renderedHashtags]);

const [expanded, setExpanded] = useState(false);
const handleClick = useCallback(() => setExpanded(true), []);

if (invisibleHashtags.isEmpty()) {
return null;
}

const revealedHashtags = expanded ? invisibleHashtags : invisibleHashtags.take(VISIBLE_HASHTAGS);

return (
<div className='hashtag-bar'>
{revealedHashtags.map(hashtag => (
<Link key={hashtag.get('name')} to={`/tags/${hashtag.get('name')}`}>
#{hashtag.get('name')}
</Link>
))}

{!expanded && invisibleHashtags.size > VISIBLE_HASHTAGS && <button className='link-button' onClick={handleClick}><FormattedMessage id='hashtags.and_other' defaultMessage='…and {count, plural, other {# more}}' values={{ count: invisibleHashtags.size - VISIBLE_HASHTAGS }} /></button>}
</div>
);
};

HashtagBar.propTypes = {
hashtags: ImmutablePropTypes.list,
text: PropTypes.string,
};
3 changes: 3 additions & 0 deletions app/javascript/mastodon/components/status.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import AttachmentList from './attachment_list';
import { Avatar } from './avatar';
import { AvatarOverlay } from './avatar_overlay';
import { DisplayName } from './display_name';
import { HashtagBar } from './hashtag_bar';
import { RelativeTimestamp } from './relative_timestamp';
import StatusActionBar from './status_action_bar';
import StatusContent from './status_content';
Expand Down Expand Up @@ -556,6 +557,8 @@ class Status extends ImmutablePureComponent {

{media}

<HashtagBar hashtags={status.get('tags')} text={status.get('content')} />

<StatusActionBar scrollKey={scrollKey} status={status} account={account} onFilter={matchedFilters ? this.handleFilterClick : null} {...other} />
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ class Header extends ImmutablePureComponent {
if (signedIn && !account.get('relationship')) { // Wait until the relationship is loaded
actionBtn = '';
} else if (account.getIn(['relationship', 'requested'])) {
actionBtn = <Button className={classNames({ 'button--with-bell': bellBtn !== '' })} text={intl.formatMessage(messages.cancel_follow_request)} title={intl.formatMessage(messages.requested)} onClick={this.props.onFollow} />;
actionBtn = <Button text={intl.formatMessage(messages.cancel_follow_request)} title={intl.formatMessage(messages.requested)} onClick={this.props.onFollow} />;
} else if (!account.getIn(['relationship', 'blocking'])) {
actionBtn = <Button disabled={account.getIn(['relationship', 'blocked_by'])} className={classNames({ 'button--destructive': account.getIn(['relationship', 'following']), 'button--with-bell': bellBtn !== '' })} text={intl.formatMessage(account.getIn(['relationship', 'following']) ? messages.unfollow : messages.follow)} onClick={signedIn ? this.props.onFollow : this.props.onInteractionModal} />;
actionBtn = <Button disabled={account.getIn(['relationship', 'blocked_by'])} className={classNames({ 'button--destructive': account.getIn(['relationship', 'following']) })} text={intl.formatMessage(account.getIn(['relationship', 'following']) ? messages.unfollow : messages.follow)} onClick={signedIn ? this.props.onFollow : this.props.onInteractionModal} />;
} else if (account.getIn(['relationship', 'blocking'])) {
actionBtn = <Button text={intl.formatMessage(messages.unblock, { name: account.get('username') })} onClick={this.props.onBlock} />;
}
Expand Down
13 changes: 9 additions & 4 deletions app/javascript/mastodon/features/interaction_modal/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ const messages = defineMessages({

const mapStateToProps = (state, { accountId }) => ({
displayNameHtml: state.getIn(['accounts', accountId, 'display_name_html']),
signupUrl: state.getIn(['server', 'server', 'registrations', 'url'], null) || '/auth/sign_up',
});

const mapDispatchToProps = (dispatch) => ({
onSignupClick() {
dispatch(closeModal());
dispatch(openModal('CLOSED_REGISTRATIONS'));
dispatch(closeModal({
modalType: undefined,
ignoreFocus: false,
}));
dispatch(openModal({ modalType: 'CLOSED_REGISTRATIONS' }));
},
});

Expand Down Expand Up @@ -294,14 +298,15 @@ class InteractionModal extends React.PureComponent {
url: PropTypes.string,
type: PropTypes.oneOf(['reply', 'reblog', 'favourite', 'follow']),
onSignupClick: PropTypes.func.isRequired,
signupUrl: PropTypes.string.isRequired,
};

handleSignupClick = () => {
this.props.onSignupClick();
};

render () {
const { url, type, displayNameHtml } = this.props;
const { url, type, displayNameHtml, signupUrl } = this.props;

const name = <bdi dangerouslySetInnerHTML={{ __html: displayNameHtml }} />;

Expand Down Expand Up @@ -340,7 +345,7 @@ class InteractionModal extends React.PureComponent {
);
} else if (registrationsOpen) {
signupButton = (
<a href='/auth/sign_up' className='link-button'>
<a href={signupUrl} className='link-button'>
<FormattedMessage id='sign_in_banner.create_account' defaultMessage='Create account' />
</a>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';

import { AnimatedNumber } from 'mastodon/components/animated_number';
import EditedTimestamp from 'mastodon/components/edited_timestamp';
import { HashtagBar } from 'mastodon/components/hashtag_bar';
import { Icon } from 'mastodon/components/icon';
import PictureInPicturePlaceholder from 'mastodon/components/picture_in_picture_placeholder';

Expand Down Expand Up @@ -277,6 +278,8 @@ class DetailedStatus extends ImmutablePureComponent {

{media}

<HashtagBar hashtags={status.get('tags')} text={status.get('content')} />

<div className='detailed-status__meta'>
<a className='detailed-status__datetime' href={`/@${status.getIn(['account', 'acct'])}/${status.get('id')}`} target='_blank' rel='noopener noreferrer'>
<FormattedDate value={new Date(status.get('created_at'))} hour12={false} year='numeric' month='short' day='2-digit' hour='2-digit' minute='2-digit' />
Expand Down
2 changes: 2 additions & 0 deletions app/javascript/mastodon/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
"dismissable_banner.community_timeline": "هذه هي أحدث المشاركات العامة من الأشخاص الذين تُستضاف حساباتهم على {domain}.",
"dismissable_banner.dismiss": "رفض",
"dismissable_banner.explore_links": "هذه القصص الإخبارية يتحدث عنها حاليًا أشخاص على هذا الخادم وكذا على الخوادم الأخرى للشبكة اللامركزية.",
"dismissable_banner.explore_statuses": "هذه هي المنشورات الرائجة على الشبكات الاجتماعيّة اليوم. تظهر المنشورات التي أعيد مشاركتها وحازت على مفضّلات أكثر في مرتبة عليا.",
"dismissable_banner.explore_tags": "هذه الوسوم تكتسب جذب اهتمام الناس حاليًا على هذا الخادم وكذا على الخوادم الأخرى للشبكة اللامركزية.",
"dismissable_banner.public_timeline": "هذه هي أحدث المنشورات العامة من الناس على الشبكة الاجتماعية التي يتبعها الناس على {domain}.",
"embed.instructions": "يمكنكم إدماج هذا المنشور على موقعكم الإلكتروني عن طريق نسخ الشفرة أدناه.",
Expand Down Expand Up @@ -315,6 +316,7 @@
"interaction_modal.on_another_server": "على خادم مختلف",
"interaction_modal.on_this_server": "على هذا الخادم",
"interaction_modal.sign_in": "لم تقم بتسجيل الدخول إلى هذا الخادم. أين هو مستضاف حسابك؟",
"interaction_modal.sign_in_hint": "تلميح: هذا هو الموقع الذي سجّلت عن طريقه. إن لم تتذكّر/ين اسم الموقع، يمكنك البحث عن الرسالة الترحيبيّة في بريدك الالكتروني. يمكنك أيضاً استخدام إسم المستخدم/ـة الكامل! (مثلاً: @Mastadon@mastadon.social)",
"interaction_modal.title.favourite": "إضافة منشور {name} إلى المفضلة",
"interaction_modal.title.follow": "اتبع {name}",
"interaction_modal.title.reblog": "مشاركة منشور {name}",
Expand Down
1 change: 1 addition & 0 deletions app/javascript/mastodon/locales/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@
"hashtag.column_header.tag_mode.none": "ensin {additional}",
"hashtag.column_settings.select.no_options_message": "Nun s'atopó nenguna suxerencia",
"hashtag.column_settings.tag_toggle": "Include additional tags in this column",
"hashtag.counter_by_accounts": "{count, plural, one {{counter} participante} other {{counter} participantes}}",
"hashtag.follow": "Siguir a la etiqueta",
"hashtag.unfollow": "Dexar de siguir a la etiqueta",
"home.column_settings.basic": "Configuración básica",
Expand Down
1 change: 1 addition & 0 deletions app/javascript/mastodon/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@
"hashtag.counter_by_uses_today": "{count, plural, one {{counter} post} other {{counter} posts}} today",
"hashtag.follow": "Follow hashtag",
"hashtag.unfollow": "Unfollow hashtag",
"hashtags.and_other": "…and {count, plural, other {# more}}",
"home.actions.go_to_explore": "See what's trending",
"home.actions.go_to_suggestions": "Find people to follow",
"home.column_settings.basic": "Basic",
Expand Down
6 changes: 3 additions & 3 deletions app/javascript/mastodon/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"account.following_counter": "{count, plural, one {{counter} Abonnement} other {{counter} Abonnements}}",
"account.follows.empty": "Cet·te utilisateur·rice ne suit personne pour l’instant.",
"account.follows_you": "Vous suit",
"account.go_to_profile": "Voir le profil",
"account.go_to_profile": "Aller au profil",
"account.hide_reblogs": "Masquer les partages de @{name}",
"account.in_memoriam": "En mémoire de.",
"account.joined_short": "Ici depuis",
Expand All @@ -50,9 +50,9 @@
"account.moved_to": "{name} a indiqué que son nouveau compte est maintenant :",
"account.mute": "Masquer @{name}",
"account.mute_notifications_short": "Désactiver les alertes",
"account.mute_short": "Mettre en sourdine",
"account.mute_short": "Masquer",
"account.muted": "Masqué·e",
"account.no_bio": "Aucune description enregistrée.",
"account.no_bio": "Aucune description fournie.",
"account.open_original_page": "Ouvrir la page d'origine",
"account.posts": "Messages",
"account.posts_with_replies": "Messages et réponses",
Expand Down
Loading

0 comments on commit 29dbd72

Please sign in to comment.