mirror of
https://github.com/tooot-app/app
synced 2025-03-12 09:30:11 +01:00
Fixed #514
This commit is contained in:
parent
955478c605
commit
c6e27d6d88
@ -120,7 +120,7 @@ const TimelineDefault: React.FC<Props> = ({
|
|||||||
queryKey,
|
queryKey,
|
||||||
rootQueryKey,
|
rootQueryKey,
|
||||||
status,
|
status,
|
||||||
isReblog: !!item.reblog,
|
reblogStatus: item.reblog ? item : undefined,
|
||||||
ownAccount,
|
ownAccount,
|
||||||
spoilerHidden,
|
spoilerHidden,
|
||||||
copiableContent,
|
copiableContent,
|
||||||
|
@ -38,7 +38,7 @@ const TimelineNotifications: React.FC<Props> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const instanceAccount = useSelector(getInstanceAccount, () => true)
|
const instanceAccount = useSelector(getInstanceAccount, () => true)
|
||||||
|
|
||||||
const status = notification.status
|
const status = notification.status?.reblog ? notification.status.reblog : notification.status
|
||||||
const account = notification.status ? notification.status.account : notification.account
|
const account = notification.status ? notification.status.account : notification.account
|
||||||
const ownAccount = notification.account?.id === instanceAccount?.id
|
const ownAccount = notification.account?.id === instanceAccount?.id
|
||||||
const [spoilerExpanded, setSpoilerExpanded] = useState(
|
const [spoilerExpanded, setSpoilerExpanded] = useState(
|
||||||
@ -78,7 +78,11 @@ const TimelineNotifications: React.FC<Props> = ({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{notification.type !== 'mention' ? (
|
{notification.type !== 'mention' ? (
|
||||||
<TimelineActioned action={notification.type} isNotification account={account} />
|
<TimelineActioned
|
||||||
|
action={notification.type}
|
||||||
|
isNotification
|
||||||
|
account={notification.account}
|
||||||
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<View
|
<View
|
||||||
@ -132,7 +136,6 @@ const TimelineNotifications: React.FC<Props> = ({
|
|||||||
value={{
|
value={{
|
||||||
queryKey,
|
queryKey,
|
||||||
status,
|
status,
|
||||||
isReblog: !!status?.reblog,
|
|
||||||
ownAccount,
|
ownAccount,
|
||||||
spoilerHidden,
|
spoilerHidden,
|
||||||
copiableContent,
|
copiableContent,
|
||||||
|
@ -13,12 +13,12 @@ import StatusContext from './Context'
|
|||||||
export interface Props {
|
export interface Props {
|
||||||
action: Mastodon.Notification['type'] | 'reblog' | 'pinned'
|
action: Mastodon.Notification['type'] | 'reblog' | 'pinned'
|
||||||
isNotification?: boolean
|
isNotification?: boolean
|
||||||
account?: Mastodon.Account
|
account?: Mastodon.Account // For notification
|
||||||
}
|
}
|
||||||
|
|
||||||
const TimelineActioned: React.FC<Props> = ({ action, isNotification, ...rest }) => {
|
const TimelineActioned: React.FC<Props> = ({ action, isNotification, ...rest }) => {
|
||||||
const { status } = useContext(StatusContext)
|
const { status, reblogStatus } = useContext(StatusContext)
|
||||||
const account = isNotification ? rest.account : status?.account
|
const account = rest.account || (reblogStatus ? reblogStatus.account : status?.account)
|
||||||
if (!status || !account) return null
|
if (!status || !account) return null
|
||||||
|
|
||||||
const { t } = useTranslation('componentTimeline')
|
const { t } = useTranslation('componentTimeline')
|
||||||
|
@ -22,7 +22,7 @@ import { useSelector } from 'react-redux'
|
|||||||
import StatusContext from './Context'
|
import StatusContext from './Context'
|
||||||
|
|
||||||
const TimelineActions: React.FC = () => {
|
const TimelineActions: React.FC = () => {
|
||||||
const { queryKey, rootQueryKey, status, isReblog, ownAccount, highlighted, disableDetails } =
|
const { queryKey, rootQueryKey, status, reblogStatus, ownAccount, highlighted, disableDetails } =
|
||||||
useContext(StatusContext)
|
useContext(StatusContext)
|
||||||
if (!queryKey || !status || disableDetails) return null
|
if (!queryKey || !status || disableDetails) return null
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ const TimelineActions: React.FC = () => {
|
|||||||
queryKey,
|
queryKey,
|
||||||
rootQueryKey,
|
rootQueryKey,
|
||||||
id: status.id,
|
id: status.id,
|
||||||
isReblog,
|
isReblog: !!reblogStatus,
|
||||||
payload: {
|
payload: {
|
||||||
property: 'reblogged',
|
property: 'reblogged',
|
||||||
currentValue: status.reblogged,
|
currentValue: status.reblogged,
|
||||||
@ -125,7 +125,7 @@ const TimelineActions: React.FC = () => {
|
|||||||
queryKey,
|
queryKey,
|
||||||
rootQueryKey,
|
rootQueryKey,
|
||||||
id: status.id,
|
id: status.id,
|
||||||
isReblog,
|
isReblog: !!reblogStatus,
|
||||||
payload: {
|
payload: {
|
||||||
property: 'reblogged',
|
property: 'reblogged',
|
||||||
currentValue: status.reblogged,
|
currentValue: status.reblogged,
|
||||||
@ -144,7 +144,7 @@ const TimelineActions: React.FC = () => {
|
|||||||
queryKey,
|
queryKey,
|
||||||
rootQueryKey,
|
rootQueryKey,
|
||||||
id: status.id,
|
id: status.id,
|
||||||
isReblog,
|
isReblog: !!reblogStatus,
|
||||||
payload: {
|
payload: {
|
||||||
property: 'reblogged',
|
property: 'reblogged',
|
||||||
currentValue: status.reblogged,
|
currentValue: status.reblogged,
|
||||||
@ -161,7 +161,7 @@ const TimelineActions: React.FC = () => {
|
|||||||
queryKey,
|
queryKey,
|
||||||
rootQueryKey,
|
rootQueryKey,
|
||||||
id: status.id,
|
id: status.id,
|
||||||
isReblog,
|
isReblog: !!reblogStatus,
|
||||||
payload: {
|
payload: {
|
||||||
property: 'favourited',
|
property: 'favourited',
|
||||||
currentValue: status.favourited,
|
currentValue: status.favourited,
|
||||||
@ -176,7 +176,7 @@ const TimelineActions: React.FC = () => {
|
|||||||
queryKey,
|
queryKey,
|
||||||
rootQueryKey,
|
rootQueryKey,
|
||||||
id: status.id,
|
id: status.id,
|
||||||
isReblog,
|
isReblog: !!reblogStatus,
|
||||||
payload: {
|
payload: {
|
||||||
property: 'bookmarked',
|
property: 'bookmarked',
|
||||||
currentValue: status.bookmarked,
|
currentValue: status.bookmarked,
|
||||||
|
@ -7,7 +7,7 @@ type ContextType = {
|
|||||||
|
|
||||||
status?: Mastodon.Status
|
status?: Mastodon.Status
|
||||||
|
|
||||||
isReblog?: boolean
|
reblogStatus?: Mastodon.Status // When it is a reblog, pass the root status
|
||||||
ownAccount?: boolean
|
ownAccount?: boolean
|
||||||
spoilerHidden?: boolean
|
spoilerHidden?: boolean
|
||||||
copiableContent?: React.MutableRefObject<{
|
copiableContent?: React.MutableRefObject<{
|
||||||
|
@ -20,8 +20,15 @@ import { useQueryClient } from 'react-query'
|
|||||||
import StatusContext from './Context'
|
import StatusContext from './Context'
|
||||||
|
|
||||||
const TimelinePoll: React.FC = () => {
|
const TimelinePoll: React.FC = () => {
|
||||||
const { queryKey, rootQueryKey, status, isReblog, ownAccount, spoilerHidden, disableDetails } =
|
const {
|
||||||
useContext(StatusContext)
|
queryKey,
|
||||||
|
rootQueryKey,
|
||||||
|
status,
|
||||||
|
reblogStatus,
|
||||||
|
ownAccount,
|
||||||
|
spoilerHidden,
|
||||||
|
disableDetails
|
||||||
|
} = useContext(StatusContext)
|
||||||
if (!queryKey || !status || !status.poll) return null
|
if (!queryKey || !status || !status.poll) return null
|
||||||
const poll = status.poll
|
const poll = status.poll
|
||||||
|
|
||||||
@ -78,7 +85,7 @@ const TimelinePoll: React.FC = () => {
|
|||||||
queryKey,
|
queryKey,
|
||||||
rootQueryKey,
|
rootQueryKey,
|
||||||
id: status.id,
|
id: status.id,
|
||||||
isReblog,
|
isReblog: !!reblogStatus,
|
||||||
payload: {
|
payload: {
|
||||||
property: 'poll',
|
property: 'poll',
|
||||||
id: poll.id,
|
id: poll.id,
|
||||||
@ -104,7 +111,7 @@ const TimelinePoll: React.FC = () => {
|
|||||||
queryKey,
|
queryKey,
|
||||||
rootQueryKey,
|
rootQueryKey,
|
||||||
id: status.id,
|
id: status.id,
|
||||||
isReblog,
|
isReblog: !!reblogStatus,
|
||||||
payload: {
|
payload: {
|
||||||
property: 'poll',
|
property: 'poll',
|
||||||
id: poll.id,
|
id: poll.id,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user