1
0
mirror of https://github.com/funamitech/mastodon synced 2024-12-01 00:08:39 +09:00

Merge pull request #2475 from ClearlyClaire/glitch-soc/cleanup

Further reduce differences with upstream
This commit is contained in:
Claire 2023-11-20 13:39:56 +01:00 committed by GitHub
commit 769ab0ce47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 66 deletions

View File

@ -18,7 +18,7 @@ import { RelativeTimestamp } from './relative_timestamp';
const messages = defineMessages({ const messages = defineMessages({
follow: { id: 'account.follow', defaultMessage: 'Follow' }, follow: { id: 'account.follow', defaultMessage: 'Follow' },
unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' }, 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}' }, unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' },
unmute: { id: 'account.unmute', defaultMessage: 'Unmute @{name}' }, unmute: { id: 'account.unmute', defaultMessage: 'Unmute @{name}' },
mute_notifications: { id: 'account.mute_notifications', defaultMessage: 'Mute notifications from @{name}' }, mute_notifications: { id: 'account.mute_notifications', defaultMessage: 'Mute notifications from @{name}' },
@ -38,7 +38,6 @@ 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,
small: PropTypes.bool,
actionIcon: PropTypes.string, actionIcon: PropTypes.string,
actionTitle: PropTypes.string, actionTitle: PropTypes.string,
defaultAction: PropTypes.string, defaultAction: PropTypes.string,
@ -74,17 +73,7 @@ class Account extends ImmutablePureComponent {
}; };
render () { render () {
const { const { account, intl, hidden, onActionClick, actionIcon, actionTitle, defaultAction, size } = this.props;
account,
hidden,
intl,
small,
onActionClick,
actionIcon,
actionTitle,
defaultAction,
size,
} = this.props;
if (!account) { if (!account) {
return ( return (
@ -114,7 +103,7 @@ class Account extends ImmutablePureComponent {
if (actionIcon) { if (actionIcon) {
buttons = <IconButton icon={actionIcon} title={actionTitle} onClick={this.handleAction} />; 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 following = account.getIn(['relationship', 'following']);
const requested = account.getIn(['relationship', 'requested']); const requested = account.getIn(['relationship', 'requested']);
const blocking = account.getIn(['relationship', 'blocking']); 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>; mute_expires_at = <div><RelativeTimestamp timestamp={account.get('mute_expires_at')} futureDate /></div>;
} }
return small ? ( return (
<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>
) : (
<div className='account'> <div className='account'>
<div className='account__wrapper'> <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')}`}> <Permalink key={account.get('id')} className='account__display-name' title={account.get('acct')} href={account.get('url')} to={`/@${account.get('acct')}`}>

View File

@ -6,9 +6,11 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
import AttachmentList from 'flavours/glitch/components/attachment_list'; import AttachmentList from 'flavours/glitch/components/attachment_list';
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'; import { IconButton } from '../../../components/icon_button';
import AccountContainer from '../../../containers/account_container';
const messages = defineMessages({ const messages = defineMessages({
cancel: { id: 'reply_indicator.cancel', defaultMessage: 'Cancel' }, cancel: { id: 'reply_indicator.cancel', defaultMessage: 'Cancel' },
@ -18,14 +20,19 @@ class ReplyIndicator extends ImmutablePureComponent {
static propTypes = { static propTypes = {
status: ImmutablePropTypes.map, status: ImmutablePropTypes.map,
onCancel: PropTypes.func, onCancel: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
...WithOptionalRouterPropTypes,
}; };
handleClick = () => { handleClick = () => {
const { onCancel } = this.props; this.props.onCancel();
if (onCancel) { };
onCancel();
handleAccountClick = (e) => {
if (e.button === 0 && !(e.ctrlKey || e.metaKey)) {
e.preventDefault();
this.props.history?.push(`/@${this.props.status.getIn(['account', 'acct'])}`);
} }
}; };
@ -38,19 +45,15 @@ class ReplyIndicator extends ImmutablePureComponent {
const content = { __html: status.get('contentHtml') }; const content = { __html: status.get('contentHtml') };
const account = status.get('account');
return ( return (
<div className='reply-indicator'> <div className='reply-indicator'>
<div className='reply-indicator__header'> <div className='reply-indicator__header'>
<div className='reply-indicator__cancel'><IconButton title={intl.formatMessage(messages.cancel)} icon='times' onClick={this.handleClick} inverted /></div> <div className='reply-indicator__cancel'><IconButton title={intl.formatMessage(messages.cancel)} icon='times' onClick={this.handleClick} inverted /></div>
{account && ( <a href={status.getIn(['account', 'url'])} onClick={this.handleAccountClick} className='reply-indicator__display-name' target='_blank' rel='noopener noreferrer'>
<AccountContainer <div className='reply-indicator__display-avatar'><Avatar account={status.get('account')} size={24} /></div>
id={account} <DisplayName account={status.get('account')} inline />
small </a>
/>
)}
</div> </div>
<div className='reply-indicator__content translate' dangerouslySetInnerHTML={content} /> <div className='reply-indicator__content translate' dangerouslySetInnerHTML={content} />
@ -67,4 +70,4 @@ class ReplyIndicator extends ImmutablePureComponent {
} }
export default injectIntl(ReplyIndicator); export default withOptionalRouter(injectIntl(ReplyIndicator));

View File

@ -1,9 +1,12 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { cancelReplyCompose } from '../../../actions/compose'; import { cancelReplyCompose } from '../../../actions/compose';
import { makeGetStatus } from '../../../selectors';
import ReplyIndicator from '../components/reply_indicator'; import ReplyIndicator from '../components/reply_indicator';
const makeMapStateToProps = () => { const makeMapStateToProps = () => {
const getStatus = makeGetStatus();
const mapStateToProps = state => { const mapStateToProps = state => {
let statusId = state.getIn(['compose', 'id'], null); let statusId = state.getIn(['compose', 'id'], null);
let editing = true; let editing = true;
@ -14,7 +17,7 @@ const makeMapStateToProps = () => {
} }
return { return {
status: state.getIn(['statuses', statusId]), status: getStatus(state, { id: statusId }),
editing, editing,
}; };
}; };

View File

@ -27,21 +27,6 @@
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
color: $ui-secondary-color; 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 { .follow-recommendations-account {

View File

@ -141,10 +141,6 @@
.reply-indicator__header { .reply-indicator__header {
margin-bottom: 5px; margin-bottom: 5px;
overflow: hidden; overflow: hidden;
& > .account.small {
color: $inverted-text-color;
}
} }
.reply-indicator__cancel { .reply-indicator__cancel {
@ -152,6 +148,25 @@
line-height: 24px; 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 { .reply-indicator__content {
position: relative; position: relative;
font-size: 14px; font-size: 14px;