Merge branch 'main' of https://github.com/glitch-soc/mastodon
This commit is contained in:
commit
d805ede472
@ -18,7 +18,7 @@ import { RelativeTimestamp } from './relative_timestamp';
|
||||
const messages = defineMessages({
|
||||
follow: { id: 'account.follow', defaultMessage: 'Follow' },
|
||||
unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' },
|
||||
requested: { id: 'account.requested', defaultMessage: 'Awaiting approval. Click to cancel follow request' },
|
||||
requested: { id: 'account.requested', defaultMessage: 'Awaiting approval' },
|
||||
unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' },
|
||||
unmute: { id: 'account.unmute', defaultMessage: 'Unmute @{name}' },
|
||||
mute_notifications: { id: 'account.mute_notifications', defaultMessage: 'Mute notifications from @{name}' },
|
||||
@ -38,7 +38,6 @@ class Account extends ImmutablePureComponent {
|
||||
onMuteNotifications: PropTypes.func.isRequired,
|
||||
intl: PropTypes.object.isRequired,
|
||||
hidden: PropTypes.bool,
|
||||
small: PropTypes.bool,
|
||||
actionIcon: PropTypes.string,
|
||||
actionTitle: PropTypes.string,
|
||||
defaultAction: PropTypes.string,
|
||||
@ -74,17 +73,7 @@ class Account extends ImmutablePureComponent {
|
||||
};
|
||||
|
||||
render () {
|
||||
const {
|
||||
account,
|
||||
hidden,
|
||||
intl,
|
||||
small,
|
||||
onActionClick,
|
||||
actionIcon,
|
||||
actionTitle,
|
||||
defaultAction,
|
||||
size,
|
||||
} = this.props;
|
||||
const { account, intl, hidden, onActionClick, actionIcon, actionTitle, defaultAction, size } = this.props;
|
||||
|
||||
if (!account) {
|
||||
return (
|
||||
@ -114,7 +103,7 @@ class Account extends ImmutablePureComponent {
|
||||
if (actionIcon) {
|
||||
buttons = <IconButton icon={actionIcon} title={actionTitle} onClick={this.handleAction} />;
|
||||
}
|
||||
} else if (account.get('id') !== me && !small && account.get('relationship', null) !== null) {
|
||||
} else if (account.get('id') !== me && account.get('relationship', null) !== null) {
|
||||
const following = account.getIn(['relationship', 'following']);
|
||||
const requested = account.getIn(['relationship', 'requested']);
|
||||
const blocking = account.getIn(['relationship', 'blocking']);
|
||||
@ -151,24 +140,7 @@ class Account extends ImmutablePureComponent {
|
||||
mute_expires_at = <div><RelativeTimestamp timestamp={account.get('mute_expires_at')} futureDate /></div>;
|
||||
}
|
||||
|
||||
return small ? (
|
||||
<Permalink
|
||||
className='account small'
|
||||
href={account.get('url')}
|
||||
to={`/@${account.get('acct')}`}
|
||||
>
|
||||
<div className='account__avatar-wrapper'>
|
||||
<Avatar
|
||||
account={account}
|
||||
size={24}
|
||||
/>
|
||||
</div>
|
||||
<DisplayName
|
||||
account={account}
|
||||
inline
|
||||
/>
|
||||
</Permalink>
|
||||
) : (
|
||||
return (
|
||||
<div className='account'>
|
||||
<div className='account__wrapper'>
|
||||
<Permalink key={account.get('id')} className='account__display-name' title={account.get('acct')} href={account.get('url')} to={`/@${account.get('acct')}`}>
|
||||
|
@ -41,7 +41,7 @@ const messages = defineMessages({
|
||||
class ComposeForm extends ImmutablePureComponent {
|
||||
static propTypes = {
|
||||
intl: PropTypes.object.isRequired,
|
||||
text: PropTypes.string,
|
||||
text: PropTypes.string.isRequired,
|
||||
suggestions: ImmutablePropTypes.list,
|
||||
spoiler: PropTypes.bool,
|
||||
privacy: PropTypes.string,
|
||||
|
@ -6,8 +6,11 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
|
||||
import AttachmentList from 'flavours/glitch/components/attachment_list';
|
||||
import { IconButton } from 'flavours/glitch/components/icon_button';
|
||||
import AccountContainer from 'flavours/glitch/containers/account_container';
|
||||
import { WithOptionalRouterPropTypes, withOptionalRouter } from 'flavours/glitch/utils/react_router';
|
||||
|
||||
import { Avatar } from '../../../components/avatar';
|
||||
import { DisplayName } from '../../../components/display_name';
|
||||
import { IconButton } from '../../../components/icon_button';
|
||||
|
||||
const messages = defineMessages({
|
||||
cancel: { id: 'reply_indicator.cancel', defaultMessage: 'Cancel' },
|
||||
@ -17,14 +20,19 @@ class ReplyIndicator extends ImmutablePureComponent {
|
||||
|
||||
static propTypes = {
|
||||
status: ImmutablePropTypes.map,
|
||||
onCancel: PropTypes.func.isRequired,
|
||||
intl: PropTypes.object.isRequired,
|
||||
onCancel: PropTypes.func,
|
||||
...WithOptionalRouterPropTypes,
|
||||
};
|
||||
|
||||
handleClick = () => {
|
||||
const { onCancel } = this.props;
|
||||
if (onCancel) {
|
||||
onCancel();
|
||||
this.props.onCancel();
|
||||
};
|
||||
|
||||
handleAccountClick = (e) => {
|
||||
if (e.button === 0 && !(e.ctrlKey || e.metaKey)) {
|
||||
e.preventDefault();
|
||||
this.props.history?.push(`/@${this.props.status.getIn(['account', 'acct'])}`);
|
||||
}
|
||||
};
|
||||
|
||||
@ -35,41 +43,31 @@ class ReplyIndicator extends ImmutablePureComponent {
|
||||
return null;
|
||||
}
|
||||
|
||||
const account = status.get('account');
|
||||
const content = status.get('content');
|
||||
const attachments = status.get('media_attachments');
|
||||
const content = { __html: status.get('contentHtml') };
|
||||
|
||||
return (
|
||||
<article className='reply-indicator'>
|
||||
<header className='reply-indicator__header'>
|
||||
<IconButton
|
||||
className='reply-indicator__cancel'
|
||||
icon='times'
|
||||
onClick={this.handleClick}
|
||||
title={intl.formatMessage(messages.cancel)}
|
||||
inverted
|
||||
/>
|
||||
{account && (
|
||||
<AccountContainer
|
||||
id={account}
|
||||
small
|
||||
/>
|
||||
)}
|
||||
</header>
|
||||
<div
|
||||
className='reply-indicator__content translate'
|
||||
dangerouslySetInnerHTML={{ __html: content || '' }}
|
||||
/>
|
||||
{attachments.size > 0 && (
|
||||
<div className='reply-indicator'>
|
||||
<div className='reply-indicator__header'>
|
||||
<div className='reply-indicator__cancel'><IconButton title={intl.formatMessage(messages.cancel)} icon='times' onClick={this.handleClick} inverted /></div>
|
||||
|
||||
<a href={status.getIn(['account', 'url'])} onClick={this.handleAccountClick} className='reply-indicator__display-name' target='_blank' rel='noopener noreferrer'>
|
||||
<div className='reply-indicator__display-avatar'><Avatar account={status.get('account')} size={24} /></div>
|
||||
<DisplayName account={status.get('account')} inline />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div className='reply-indicator__content translate' dangerouslySetInnerHTML={content} />
|
||||
|
||||
{status.get('media_attachments').size > 0 && (
|
||||
<AttachmentList
|
||||
compact
|
||||
media={attachments}
|
||||
media={status.get('media_attachments')}
|
||||
/>
|
||||
)}
|
||||
</article>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default injectIntl(ReplyIndicator);
|
||||
export default withOptionalRouter(injectIntl(ReplyIndicator));
|
||||
|
@ -1,9 +1,12 @@
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { cancelReplyCompose } from '../../../actions/compose';
|
||||
import { makeGetStatus } from '../../../selectors';
|
||||
import ReplyIndicator from '../components/reply_indicator';
|
||||
|
||||
const makeMapStateToProps = () => {
|
||||
const getStatus = makeGetStatus();
|
||||
|
||||
const mapStateToProps = state => {
|
||||
let statusId = state.getIn(['compose', 'id'], null);
|
||||
let editing = true;
|
||||
@ -14,7 +17,7 @@ const makeMapStateToProps = () => {
|
||||
}
|
||||
|
||||
return {
|
||||
status: state.getIn(['statuses', statusId]),
|
||||
status: getStatus(state, { id: statusId }),
|
||||
editing,
|
||||
};
|
||||
};
|
||||
|
@ -27,21 +27,6 @@
|
||||
-webkit-box-orient: vertical;
|
||||
color: $ui-secondary-color;
|
||||
}
|
||||
|
||||
&.small {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
|
||||
& > .account__avatar-wrapper {
|
||||
margin: 0;
|
||||
margin-inline-end: 8px;
|
||||
}
|
||||
|
||||
& > .display-name {
|
||||
height: 24px;
|
||||
line-height: 24px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.follow-recommendations-account {
|
||||
|
@ -141,10 +141,6 @@
|
||||
.reply-indicator__header {
|
||||
margin-bottom: 5px;
|
||||
overflow: hidden;
|
||||
|
||||
& > .account.small {
|
||||
color: $inverted-text-color;
|
||||
}
|
||||
}
|
||||
|
||||
.reply-indicator__cancel {
|
||||
@ -152,6 +148,25 @@
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.reply-indicator__display-name {
|
||||
color: $inverted-text-color;
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
line-height: 24px;
|
||||
overflow: hidden;
|
||||
text-decoration: none;
|
||||
|
||||
& > .display-name {
|
||||
line-height: unset;
|
||||
height: unset;
|
||||
}
|
||||
}
|
||||
|
||||
.reply-indicator__display-avatar {
|
||||
float: left;
|
||||
margin-inline-end: 5px;
|
||||
}
|
||||
|
||||
.reply-indicator__content {
|
||||
position: relative;
|
||||
font-size: 14px;
|
||||
|
@ -5,7 +5,7 @@ import { createRoot } from 'react-dom/client';
|
||||
import { IntlMessageFormat } from 'intl-messageformat';
|
||||
import { defineMessages } from 'react-intl';
|
||||
|
||||
import delegate from '@rails/ujs';
|
||||
import Rails from '@rails/ujs';
|
||||
import axios from 'axios';
|
||||
import { throttle } from 'lodash';
|
||||
|
||||
@ -129,7 +129,7 @@ function loaded() {
|
||||
});
|
||||
}
|
||||
|
||||
delegate(document, '#user_account_attributes_username', 'input', throttle(({ target }) => {
|
||||
Rails.delegate(document, '#user_account_attributes_username', 'input', throttle(({ target }) => {
|
||||
if (target.value && target.value.length > 0) {
|
||||
axios.get('/api/v1/accounts/lookup', { params: { acct: target.value } }).then(() => {
|
||||
target.setCustomValidity(formatMessage(messages.usernameTaken));
|
||||
@ -141,7 +141,7 @@ function loaded() {
|
||||
}
|
||||
}, 500, { leading: false, trailing: true }));
|
||||
|
||||
delegate(document, '#user_password,#user_password_confirmation', 'input', () => {
|
||||
Rails.delegate(document, '#user_password,#user_password_confirmation', 'input', () => {
|
||||
const password = document.getElementById('user_password');
|
||||
const confirmation = document.getElementById('user_password_confirmation');
|
||||
if (!confirmation) return;
|
||||
@ -155,7 +155,7 @@ function loaded() {
|
||||
}
|
||||
});
|
||||
|
||||
delegate(document, '.status__content__spoiler-link', 'click', function() {
|
||||
Rails.delegate(document, '.status__content__spoiler-link', 'click', function() {
|
||||
const statusEl = this.parentNode.parentNode;
|
||||
|
||||
if (statusEl.dataset.spoiler === 'expanded') {
|
||||
@ -192,23 +192,23 @@ const toggleSidebar = () => {
|
||||
sidebar.classList.toggle('visible');
|
||||
};
|
||||
|
||||
delegate(document, '.sidebar__toggle__icon', 'click', () => {
|
||||
Rails.delegate(document, '.sidebar__toggle__icon', 'click', () => {
|
||||
toggleSidebar();
|
||||
});
|
||||
|
||||
delegate(document, '.sidebar__toggle__icon', 'keydown', e => {
|
||||
Rails.delegate(document, '.sidebar__toggle__icon', 'keydown', e => {
|
||||
if (e.key === ' ' || e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
toggleSidebar();
|
||||
}
|
||||
});
|
||||
|
||||
delegate(document, '.custom-emoji', 'mouseover', ({ target }) => target.src = target.getAttribute('data-original'));
|
||||
delegate(document, '.custom-emoji', 'mouseout', ({ target }) => target.src = target.getAttribute('data-static'));
|
||||
Rails.delegate(document, '.custom-emoji', 'mouseover', ({ target }) => target.src = target.getAttribute('data-original'));
|
||||
Rails.delegate(document, '.custom-emoji', 'mouseout', ({ target }) => target.src = target.getAttribute('data-static'));
|
||||
|
||||
// Empty the honeypot fields in JS in case something like an extension
|
||||
// automatically filled them.
|
||||
delegate(document, '#registration_new_user,#new_user', 'submit', () => {
|
||||
Rails.delegate(document, '#registration_new_user,#new_user', 'submit', () => {
|
||||
['user_website', 'user_confirm_password', 'registration_user_website', 'registration_user_confirm_password'].forEach(id => {
|
||||
const field = document.getElementById(id);
|
||||
if (field) {
|
||||
|
Loading…
Reference in New Issue
Block a user