Clean up _properStatus() nonsense
This commit is contained in:
parent
82d717d8ce
commit
4edd28a08b
|
@ -104,6 +104,8 @@ const Status: React.FC<IStatus> = (props) => {
|
||||||
const [showMedia, setShowMedia] = useState<boolean>(defaultMediaVisibility(status, displayMedia));
|
const [showMedia, setShowMedia] = useState<boolean>(defaultMediaVisibility(status, displayMedia));
|
||||||
const [emojiSelectorFocused, setEmojiSelectorFocused] = useState(false);
|
const [emojiSelectorFocused, setEmojiSelectorFocused] = useState(false);
|
||||||
|
|
||||||
|
const actualStatus = getActualStatus(status);
|
||||||
|
|
||||||
// Track height changes we know about to compensate scrolling.
|
// Track height changes we know about to compensate scrolling.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
didShowCard.current = Boolean(!muted && !hidden && status?.card);
|
didShowCard.current = Boolean(!muted && !hidden && status?.card);
|
||||||
|
@ -121,16 +123,16 @@ const Status: React.FC<IStatus> = (props) => {
|
||||||
if (onClick) {
|
if (onClick) {
|
||||||
onClick();
|
onClick();
|
||||||
} else {
|
} else {
|
||||||
history.push(`/@${_properStatus().getIn(['account', 'acct'])}/posts/${_properStatus().id}`);
|
history.push(`/@${actualStatus.getIn(['account', 'acct'])}/posts/${actualStatus.id}`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleExpandedToggle = (): void => {
|
const handleExpandedToggle = (): void => {
|
||||||
onToggleHidden(_properStatus());
|
onToggleHidden(actualStatus);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleHotkeyOpenMedia = (e?: KeyboardEvent): void => {
|
const handleHotkeyOpenMedia = (e?: KeyboardEvent): void => {
|
||||||
const status = _properStatus();
|
const status = actualStatus;
|
||||||
const firstAttachment = status.media_attachments.first();
|
const firstAttachment = status.media_attachments.first();
|
||||||
|
|
||||||
e?.preventDefault();
|
e?.preventDefault();
|
||||||
|
@ -146,28 +148,28 @@ const Status: React.FC<IStatus> = (props) => {
|
||||||
|
|
||||||
const handleHotkeyReply = (e?: KeyboardEvent): void => {
|
const handleHotkeyReply = (e?: KeyboardEvent): void => {
|
||||||
e?.preventDefault();
|
e?.preventDefault();
|
||||||
onReply(_properStatus());
|
onReply(actualStatus);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleHotkeyFavourite = (): void => {
|
const handleHotkeyFavourite = (): void => {
|
||||||
onFavourite(_properStatus());
|
onFavourite(actualStatus);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleHotkeyBoost = (e?: KeyboardEvent): void => {
|
const handleHotkeyBoost = (e?: KeyboardEvent): void => {
|
||||||
onReblog(_properStatus(), e);
|
onReblog(actualStatus, e);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleHotkeyMention = (e?: KeyboardEvent): void => {
|
const handleHotkeyMention = (e?: KeyboardEvent): void => {
|
||||||
e?.preventDefault();
|
e?.preventDefault();
|
||||||
onMention(_properStatus().account);
|
onMention(actualStatus.account);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleHotkeyOpen = (): void => {
|
const handleHotkeyOpen = (): void => {
|
||||||
history.push(`/@${_properStatus().getIn(['account', 'acct'])}/posts/${_properStatus().id}`);
|
history.push(`/@${actualStatus.getIn(['account', 'acct'])}/posts/${actualStatus.id}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleHotkeyOpenProfile = (): void => {
|
const handleHotkeyOpenProfile = (): void => {
|
||||||
history.push(`/@${_properStatus().getIn(['account', 'acct'])}`);
|
history.push(`/@${actualStatus.getIn(['account', 'acct'])}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleHotkeyMoveUp = (e?: KeyboardEvent): void => {
|
const handleHotkeyMoveUp = (e?: KeyboardEvent): void => {
|
||||||
|
@ -179,7 +181,7 @@ const Status: React.FC<IStatus> = (props) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleHotkeyToggleHidden = (): void => {
|
const handleHotkeyToggleHidden = (): void => {
|
||||||
onToggleHidden(_properStatus());
|
onToggleHidden(actualStatus);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleHotkeyToggleSensitive = (): void => {
|
const handleHotkeyToggleSensitive = (): void => {
|
||||||
|
@ -200,12 +202,7 @@ const Status: React.FC<IStatus> = (props) => {
|
||||||
firstEmoji?.focus();
|
firstEmoji?.focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
const _properStatus = (): StatusEntity => {
|
|
||||||
return getActualStatus(status);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!status) return null;
|
if (!status) return null;
|
||||||
const actualStatus = _properStatus();
|
|
||||||
let prepend, rebloggedByText, reblogElement, reblogElementMobile;
|
let prepend, rebloggedByText, reblogElement, reblogElementMobile;
|
||||||
|
|
||||||
if (hidden) {
|
if (hidden) {
|
||||||
|
|
Loading…
Reference in New Issue