[Glitch] Remove unnused otherAccounts property

Port 2f6416db53 to glitch-soc + other related cleanup

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Claire 2022-05-30 17:10:13 +02:00
parent 1db92b510d
commit 444ac6d6e9
4 changed files with 43 additions and 71 deletions

View file

@ -67,7 +67,6 @@ class Status extends ImmutablePureComponent {
containerId: PropTypes.string, containerId: PropTypes.string,
id: PropTypes.string, id: PropTypes.string,
status: ImmutablePropTypes.map, status: ImmutablePropTypes.map,
otherAccounts: ImmutablePropTypes.list,
account: ImmutablePropTypes.map, account: ImmutablePropTypes.map,
onReply: PropTypes.func, onReply: PropTypes.func,
onFavourite: PropTypes.func, onFavourite: PropTypes.func,
@ -492,7 +491,6 @@ class Status extends ImmutablePureComponent {
intl, intl,
status, status,
account, account,
otherAccounts,
settings, settings,
collapsed, collapsed,
muted, muted,
@ -745,7 +743,6 @@ class Status extends ImmutablePureComponent {
friend={account} friend={account}
collapsed={isCollapsed} collapsed={isCollapsed}
parseClick={parseClick} parseClick={parseClick}
otherAccounts={otherAccounts}
/> />
) : null} ) : null}
</span> </span>
@ -755,7 +752,6 @@ class Status extends ImmutablePureComponent {
collapsible={settings.getIn(['collapsed', 'enabled'])} collapsible={settings.getIn(['collapsed', 'enabled'])}
collapsed={isCollapsed} collapsed={isCollapsed}
setCollapsed={setCollapsed} setCollapsed={setCollapsed}
directMessage={!!otherAccounts}
settings={settings.get('status_icons')} settings={settings.get('status_icons')}
/> />
</header> </header>
@ -776,7 +772,6 @@ class Status extends ImmutablePureComponent {
status={status} status={status}
account={status.get('account')} account={status.get('account')}
showReplyCount={settings.get('show_reply_count')} showReplyCount={settings.get('show_reply_count')}
directMessage={!!otherAccounts}
onFilter={this.handleFilterClick} onFilter={this.handleFilterClick}
/> />
) : null} ) : null}

View file

@ -67,7 +67,6 @@ class StatusActionBar extends ImmutablePureComponent {
onFilter: PropTypes.func, onFilter: PropTypes.func,
withDismiss: PropTypes.bool, withDismiss: PropTypes.bool,
showReplyCount: PropTypes.bool, showReplyCount: PropTypes.bool,
directMessage: PropTypes.bool,
scrollKey: PropTypes.string, scrollKey: PropTypes.string,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
}; };
@ -197,7 +196,7 @@ class StatusActionBar extends ImmutablePureComponent {
} }
render () { render () {
const { status, intl, withDismiss, showReplyCount, directMessage, scrollKey } = this.props; const { status, intl, withDismiss, showReplyCount, scrollKey } = this.props;
const anonymousAccess = !me; const anonymousAccess = !me;
const mutingConversation = status.get('muted'); const mutingConversation = status.get('muted');
@ -311,13 +310,13 @@ class StatusActionBar extends ImmutablePureComponent {
return ( return (
<div className='status__action-bar'> <div className='status__action-bar'>
{replyButton} {replyButton}
{!directMessage && [ <IconButton className={classNames('status__action-bar-button', { reblogPrivate })} disabled={!publicStatus && !reblogPrivate} active={status.get('reblogged')} pressed={status.get('reblogged')} title={reblogTitle} icon={reblogIcon} onClick={this.handleReblogClick} />
<IconButton key='reblog-button' className={classNames('status__action-bar-button', { reblogPrivate })} disabled={!publicStatus && !reblogPrivate} active={status.get('reblogged')} pressed={status.get('reblogged')} title={reblogTitle} icon={reblogIcon} onClick={this.handleReblogClick} />, <IconButton className='status__action-bar-button star-icon' animate active={status.get('favourited')} pressed={status.get('favourited')} title={intl.formatMessage(messages.favourite)} icon='star' onClick={this.handleFavouriteClick} />
<IconButton key='favourite-button' className='status__action-bar-button star-icon' animate active={status.get('favourited')} pressed={status.get('favourited')} title={intl.formatMessage(messages.favourite)} icon='star' onClick={this.handleFavouriteClick} />, {shareButton}
shareButton, <IconButton className='status__action-bar-button bookmark-icon' disabled={anonymousAccess} active={status.get('bookmarked')} pressed={status.get('bookmarked')} title={intl.formatMessage(messages.bookmark)} icon='bookmark' onClick={this.handleBookmarkClick} />
<IconButton key='bookmark-button' className='status__action-bar-button bookmark-icon' disabled={anonymousAccess} active={status.get('bookmarked')} pressed={status.get('bookmarked')} title={intl.formatMessage(messages.bookmark)} icon='bookmark' onClick={this.handleBookmarkClick} />, {filterButton}
filterButton,
<div key='dropdown-button' className='status__action-bar-dropdown'> <div className='status__action-bar-dropdown'>
<DropdownMenuContainer <DropdownMenuContainer
scrollKey={scrollKey} scrollKey={scrollKey}
disabled={anonymousAccess} disabled={anonymousAccess}
@ -328,8 +327,7 @@ class StatusActionBar extends ImmutablePureComponent {
direction='right' direction='right'
ariaLabel={intl.formatMessage(messages.more)} ariaLabel={intl.formatMessage(messages.more)}
/> />
</div>, </div>
]}
<a href={status.get('url')} className='status__relative-time' target='_blank' rel='noopener'> <a href={status.get('url')} className='status__relative-time' target='_blank' rel='noopener'>
<RelativeTimestamp timestamp={status.get('created_at')} />{status.get('edited_at') && <abbr title={intl.formatMessage(messages.edited, { date: intl.formatDate(status.get('edited_at'), { hour12: false, year: 'numeric', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }) })}> *</abbr>} <RelativeTimestamp timestamp={status.get('created_at')} />{status.get('edited_at') && <abbr title={intl.formatMessage(messages.edited, { date: intl.formatDate(status.get('edited_at'), { hour12: false, year: 'numeric', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }) })}> *</abbr>}

View file

@ -15,7 +15,6 @@ export default class StatusHeader extends React.PureComponent {
status: ImmutablePropTypes.map.isRequired, status: ImmutablePropTypes.map.isRequired,
friend: ImmutablePropTypes.map, friend: ImmutablePropTypes.map,
parseClick: PropTypes.func.isRequired, parseClick: PropTypes.func.isRequired,
otherAccounts: ImmutablePropTypes.list,
}; };
// Handles clicks on account name/image // Handles clicks on account name/image
@ -34,21 +33,17 @@ export default class StatusHeader extends React.PureComponent {
const { const {
status, status,
friend, friend,
otherAccounts,
} = this.props; } = this.props;
const account = status.get('account'); const account = status.get('account');
let statusAvatar; let statusAvatar;
if (otherAccounts && otherAccounts.size > 0) { if (friend === undefined || friend === null) {
statusAvatar = <AvatarComposite accounts={otherAccounts} size={48} onAccountClick={this.handleClick} />;
} else if (friend === undefined || friend === null) {
statusAvatar = <Avatar account={account} size={48} />; statusAvatar = <Avatar account={account} size={48} />;
} else { } else {
statusAvatar = <AvatarOverlay account={account} friend={friend} />; statusAvatar = <AvatarOverlay account={account} friend={friend} />;
} }
if (!otherAccounts) {
return ( return (
<div className='status__info__account'> <div className='status__info__account'>
<a <a
@ -67,24 +62,10 @@ export default class StatusHeader extends React.PureComponent {
onClick={this.handleAccountClick} onClick={this.handleAccountClick}
rel='noopener noreferrer' rel='noopener noreferrer'
> >
<DisplayName account={account} others={otherAccounts} /> <DisplayName account={account} />
</a> </a>
</div> </div>
); );
} else {
// This is a DM conversation
return (
<div className='status__info__account'>
<span className='status__avatar'>
{statusAvatar}
</span>
<span className='status__display-name'>
<DisplayName account={account} others={otherAccounts} onAccountClick={this.handleClick} />
</span>
</div>
);
}
} }
} }

View file

@ -48,7 +48,6 @@ class StatusIcons extends React.PureComponent {
mediaIcons: PropTypes.arrayOf(PropTypes.string), mediaIcons: PropTypes.arrayOf(PropTypes.string),
collapsible: PropTypes.bool, collapsible: PropTypes.bool,
collapsed: PropTypes.bool, collapsed: PropTypes.bool,
directMessage: PropTypes.bool,
setCollapsed: PropTypes.func.isRequired, setCollapsed: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
settings: ImmutablePropTypes.map.isRequired, settings: ImmutablePropTypes.map.isRequired,
@ -100,7 +99,6 @@ class StatusIcons extends React.PureComponent {
mediaIcons, mediaIcons,
collapsible, collapsible,
collapsed, collapsed,
directMessage,
settings, settings,
intl, intl,
} = this.props; } = this.props;
@ -125,7 +123,7 @@ class StatusIcons extends React.PureComponent {
title={intl.formatMessage(messages.localOnly)} title={intl.formatMessage(messages.localOnly)}
/>} />}
{settings.get('media') && !!mediaIcons && mediaIcons.map(icon => this.renderIcon(icon))} {settings.get('media') && !!mediaIcons && mediaIcons.map(icon => this.renderIcon(icon))}
{settings.get('visibility') && !directMessage && <VisibilityIcon visibility={status.get('visibility')} />} {settings.get('visibility') && <VisibilityIcon visibility={status.get('visibility')} />}
{collapsible && ( {collapsible && (
<IconButton <IconButton
className='status__collapse-button' className='status__collapse-button'