|
|
|
@ -26,6 +26,7 @@ import { |
|
|
|
closeDropdownMenu, |
|
|
|
closeDropdownMenu, |
|
|
|
} from 'mastodon/actions/dropdown_menu'; |
|
|
|
} from 'mastodon/actions/dropdown_menu'; |
|
|
|
import { openModal, closeModal } from 'mastodon/actions/modal'; |
|
|
|
import { openModal, closeModal } from 'mastodon/actions/modal'; |
|
|
|
|
|
|
|
import { fetchStatus } from 'mastodon/actions/statuses'; |
|
|
|
import { CircularProgress } from 'mastodon/components/circular_progress'; |
|
|
|
import { CircularProgress } from 'mastodon/components/circular_progress'; |
|
|
|
import { isUserTouching } from 'mastodon/is_mobile'; |
|
|
|
import { isUserTouching } from 'mastodon/is_mobile'; |
|
|
|
import { |
|
|
|
import { |
|
|
|
@ -302,6 +303,7 @@ interface DropdownProps<Item extends object | null = MenuItem> { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
scrollKey?: string; |
|
|
|
scrollKey?: string; |
|
|
|
status?: ImmutableMap<string, unknown>; |
|
|
|
status?: ImmutableMap<string, unknown>; |
|
|
|
|
|
|
|
needsStatusRefresh?: boolean; |
|
|
|
forceDropdown?: boolean; |
|
|
|
forceDropdown?: boolean; |
|
|
|
renderItem?: RenderItemFn<Item>; |
|
|
|
renderItem?: RenderItemFn<Item>; |
|
|
|
renderHeader?: RenderHeaderFn<Item>; |
|
|
|
renderHeader?: RenderHeaderFn<Item>; |
|
|
|
@ -325,6 +327,7 @@ export const Dropdown = <Item extends object | null = MenuItem>({ |
|
|
|
placement = 'bottom', |
|
|
|
placement = 'bottom', |
|
|
|
offset = [5, 5], |
|
|
|
offset = [5, 5], |
|
|
|
status, |
|
|
|
status, |
|
|
|
|
|
|
|
needsStatusRefresh, |
|
|
|
forceDropdown = false, |
|
|
|
forceDropdown = false, |
|
|
|
renderItem, |
|
|
|
renderItem, |
|
|
|
renderHeader, |
|
|
|
renderHeader, |
|
|
|
@ -344,6 +347,7 @@ export const Dropdown = <Item extends object | null = MenuItem>({ |
|
|
|
const prefetchAccountId = status |
|
|
|
const prefetchAccountId = status |
|
|
|
? status.getIn(['account', 'id']) |
|
|
|
? status.getIn(['account', 'id']) |
|
|
|
: undefined; |
|
|
|
: undefined; |
|
|
|
|
|
|
|
const statusId = status?.get('id') as string | undefined; |
|
|
|
|
|
|
|
|
|
|
|
const handleClose = useCallback(() => { |
|
|
|
const handleClose = useCallback(() => { |
|
|
|
if (buttonRef.current) { |
|
|
|
if (buttonRef.current) { |
|
|
|
@ -408,6 +412,15 @@ export const Dropdown = <Item extends object | null = MenuItem>({ |
|
|
|
dispatch(fetchRelationships([prefetchAccountId])); |
|
|
|
dispatch(fetchRelationships([prefetchAccountId])); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (needsStatusRefresh && statusId) { |
|
|
|
|
|
|
|
dispatch( |
|
|
|
|
|
|
|
fetchStatus(statusId, { |
|
|
|
|
|
|
|
forceFetch: true, |
|
|
|
|
|
|
|
alsoFetchContext: false, |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (isUserTouching() && !forceDropdown) { |
|
|
|
if (isUserTouching() && !forceDropdown) { |
|
|
|
dispatch( |
|
|
|
dispatch( |
|
|
|
openModal({ |
|
|
|
openModal({ |
|
|
|
@ -441,6 +454,8 @@ export const Dropdown = <Item extends object | null = MenuItem>({ |
|
|
|
items, |
|
|
|
items, |
|
|
|
forceDropdown, |
|
|
|
forceDropdown, |
|
|
|
handleClose, |
|
|
|
handleClose, |
|
|
|
|
|
|
|
statusId, |
|
|
|
|
|
|
|
needsStatusRefresh, |
|
|
|
], |
|
|
|
], |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|