Merge branch 'main' into glitch-soc/merge-upstream
commit
7b15f4006a
|
@ -47,7 +47,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController
|
||||||
super(hash)
|
super(hash)
|
||||||
|
|
||||||
resource.locale = I18n.locale
|
resource.locale = I18n.locale
|
||||||
resource.invite_code = params[:invite_code] if resource.invite_code.blank?
|
resource.invite_code = @invite&.code if resource.invite_code.blank?
|
||||||
resource.registration_form_time = session[:registration_form_time]
|
resource.registration_form_time = session[:registration_form_time]
|
||||||
resource.sign_up_ip = request.remote_ip
|
resource.sign_up_ip = request.remote_ip
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ module HomeHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def account_link_to(account, button = '', path: nil)
|
def account_link_to(account, button = '', path: nil)
|
||||||
content_tag(:div, class: 'account') do
|
content_tag(:div, class: 'account account--minimal') do
|
||||||
content_tag(:div, class: 'account__wrapper') do
|
content_tag(:div, class: 'account__wrapper') do
|
||||||
section = if account.nil?
|
section = if account.nil?
|
||||||
content_tag(:div, class: 'account__display-name') do
|
content_tag(:div, class: 'account__display-name') do
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { Fragment } from 'react';
|
import React from 'react';
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import Avatar from './avatar';
|
import Avatar from './avatar';
|
||||||
|
@ -13,6 +13,7 @@ import { Link } from 'react-router-dom';
|
||||||
import { counterRenderer } from 'mastodon/components/common_counter';
|
import { counterRenderer } from 'mastodon/components/common_counter';
|
||||||
import ShortNumber from 'mastodon/components/short_number';
|
import ShortNumber from 'mastodon/components/short_number';
|
||||||
import Icon from 'mastodon/components/icon';
|
import Icon from 'mastodon/components/icon';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
follow: { id: 'account.follow', defaultMessage: 'Follow' },
|
follow: { id: 'account.follow', defaultMessage: 'Follow' },
|
||||||
|
@ -57,6 +58,7 @@ class Account extends ImmutablePureComponent {
|
||||||
onMuteNotifications: PropTypes.func.isRequired,
|
onMuteNotifications: PropTypes.func.isRequired,
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
hidden: PropTypes.bool,
|
hidden: PropTypes.bool,
|
||||||
|
minimal: PropTypes.bool,
|
||||||
actionIcon: PropTypes.string,
|
actionIcon: PropTypes.string,
|
||||||
actionTitle: PropTypes.string,
|
actionTitle: PropTypes.string,
|
||||||
defaultAction: PropTypes.string,
|
defaultAction: PropTypes.string,
|
||||||
|
@ -92,14 +94,14 @@ class Account extends ImmutablePureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { account, intl, hidden, onActionClick, actionIcon, actionTitle, defaultAction, size } = this.props;
|
const { account, intl, hidden, onActionClick, actionIcon, actionTitle, defaultAction, size, minimal } = this.props;
|
||||||
|
|
||||||
if (!account) {
|
if (!account) {
|
||||||
return (
|
return (
|
||||||
<div className='account'>
|
<div className={classNames('account', { 'account--minimal': minimal })}>
|
||||||
<div className='account__wrapper'>
|
<div className='account__wrapper'>
|
||||||
<div className='account__display-name'>
|
<div className='account__display-name'>
|
||||||
<div className='account__avatar-wrapper'><Skeleton width={36} height={36} /></div>
|
<div className='account__avatar-wrapper'><Skeleton width={size} height={size} /></div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<DisplayName />
|
<DisplayName />
|
||||||
|
@ -113,10 +115,10 @@ class Account extends ImmutablePureComponent {
|
||||||
|
|
||||||
if (hidden) {
|
if (hidden) {
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<>
|
||||||
{account.get('display_name')}
|
{account.get('display_name')}
|
||||||
{account.get('username')}
|
{account.get('username')}
|
||||||
</Fragment>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,10 +146,10 @@ class Account extends ImmutablePureComponent {
|
||||||
hidingNotificationsButton = <IconButton active icon='bell-slash' title={intl.formatMessage(messages.mute_notifications, { name: account.get('username') })} onClick={this.handleMuteNotifications} />;
|
hidingNotificationsButton = <IconButton active icon='bell-slash' title={intl.formatMessage(messages.mute_notifications, { name: account.get('username') })} onClick={this.handleMuteNotifications} />;
|
||||||
}
|
}
|
||||||
buttons = (
|
buttons = (
|
||||||
<Fragment>
|
<>
|
||||||
<IconButton active icon='volume-up' title={intl.formatMessage(messages.unmute, { name: account.get('username') })} onClick={this.handleMute} />
|
<IconButton active icon='volume-up' title={intl.formatMessage(messages.unmute, { name: account.get('username') })} onClick={this.handleMute} />
|
||||||
{hidingNotificationsButton}
|
{hidingNotificationsButton}
|
||||||
</Fragment>
|
</>
|
||||||
);
|
);
|
||||||
} else if (defaultAction === 'mute') {
|
} else if (defaultAction === 'mute') {
|
||||||
buttons = <IconButton icon='volume-off' title={intl.formatMessage(messages.mute, { name: account.get('username') })} onClick={this.handleMute} />;
|
buttons = <IconButton icon='volume-off' title={intl.formatMessage(messages.mute, { name: account.get('username') })} onClick={this.handleMute} />;
|
||||||
|
@ -173,7 +175,7 @@ class Account extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='account'>
|
<div className={classNames('account', { 'account--minimal': minimal })}>
|
||||||
<div className='account__wrapper'>
|
<div className='account__wrapper'>
|
||||||
<Link key={account.get('id')} className='account__display-name' title={account.get('acct')} to={`/@${account.get('acct')}`}>
|
<Link key={account.get('id')} className='account__display-name' title={account.get('acct')} to={`/@${account.get('acct')}`}>
|
||||||
<div className='account__avatar-wrapper'>
|
<div className='account__avatar-wrapper'>
|
||||||
|
@ -182,13 +184,15 @@ class Account extends ImmutablePureComponent {
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<DisplayName account={account} />
|
<DisplayName account={account} />
|
||||||
<ShortNumber value={account.get('followers_count')} renderer={counterRenderer('followers')} /> {verification} {muteTimeRemaining}
|
{!minimal && <><ShortNumber value={account.get('followers_count')} renderer={counterRenderer('followers')} /> {verification} {muteTimeRemaining}</>}
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
|
{!minimal && (
|
||||||
<div className='account__relationship'>
|
<div className='account__relationship'>
|
||||||
{buttons}
|
{buttons}
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ServerBanner extends React.PureComponent {
|
||||||
<div className='server-banner__meta__column'>
|
<div className='server-banner__meta__column'>
|
||||||
<h4><FormattedMessage id='server_banner.administered_by' defaultMessage='Administered by:' /></h4>
|
<h4><FormattedMessage id='server_banner.administered_by' defaultMessage='Administered by:' /></h4>
|
||||||
|
|
||||||
<Account id={server.getIn(['contact', 'account', 'id'])} size={36} />
|
<Account id={server.getIn(['contact', 'account', 'id'])} size={36} minimal />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='server-banner__meta__column'>
|
<div className='server-banner__meta__column'>
|
||||||
|
|
|
@ -123,7 +123,7 @@ class About extends React.PureComponent {
|
||||||
<div className='about__meta__column'>
|
<div className='about__meta__column'>
|
||||||
<h4><FormattedMessage id='server_banner.administered_by' defaultMessage='Administered by:' /></h4>
|
<h4><FormattedMessage id='server_banner.administered_by' defaultMessage='Administered by:' /></h4>
|
||||||
|
|
||||||
<Account id={server.getIn(['contact', 'account', 'id'])} size={36} />
|
<Account id={server.getIn(['contact', 'account', 'id'])} size={36} minimal />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr className='about__meta__divider' />
|
<hr className='about__meta__divider' />
|
||||||
|
|
|
@ -1427,15 +1427,6 @@ body > [data-popper-placement] {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
border-bottom: 1px solid lighten($ui-base-color, 8%);
|
border-bottom: 1px solid lighten($ui-base-color, 8%);
|
||||||
|
|
||||||
&.compact {
|
|
||||||
padding: 0;
|
|
||||||
border-bottom: 0;
|
|
||||||
|
|
||||||
.account__avatar-wrapper {
|
|
||||||
margin-inline-start: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.account__display-name {
|
.account__display-name {
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -1455,6 +1446,18 @@ body > [data-popper-placement] {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&--minimal {
|
||||||
|
.account__display-name {
|
||||||
|
.display-name {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.display-name strong {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&__note {
|
&__note {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
|
@ -14,12 +14,10 @@ class Scheduler::IndexingScheduler
|
||||||
|
|
||||||
indexes.each do |type|
|
indexes.each do |type|
|
||||||
with_redis do |redis|
|
with_redis do |redis|
|
||||||
redis.sscan_each("chewy:queue:#{type.name}", count: SCAN_BATCH_SIZE) do |ids|
|
redis.sscan_each("chewy:queue:#{type.name}", count: SCAN_BATCH_SIZE).each_slice(IMPORT_BATCH_SIZE) do |ids|
|
||||||
redis.pipelined do
|
type.import!(ids)
|
||||||
ids.each_slice(IMPORT_BATCH_SIZE) do |slice_ids|
|
redis.pipelined do |pipeline|
|
||||||
type.import!(slice_ids)
|
pipeline.srem("chewy:queue:#{type.name}", ids)
|
||||||
redis.srem("chewy:queue:#{type.name}", slice_ids)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue