Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refs #703 Allow some actions in unauthorized timelines #746

Merged
merged 1 commit into from
May 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions src/components/timelines/status/Actions.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { open } from '@tauri-apps/api/shell'
import { writeText } from '@tauri-apps/api/clipboard'
import { FlexboxGrid, useToaster, Popover, Whisper, IconButton, Dropdown } from 'rsuite'
import {
BsChat,
Expand Down Expand Up @@ -201,11 +202,12 @@ const Actions: React.FC<Props> = props => {
top,
onClose,
own: props.account && props.account.account_id === props.status.account.id,
disabled: typeof props.disabled === 'boolean' ? props.disabled : props.disabled.detail,
openBrowser: () => {
open(status.url)
},
copyLink: () => {
navigator.clipboard.writeText(status.url)
copyLink: async () => {
await writeText(status.url)
},
openEdit: () => {
props.setShowEdit(current => !current)
Expand All @@ -226,12 +228,7 @@ const Actions: React.FC<Props> = props => {
)
}
>
<IconButton
appearance="link"
icon={<Icon as={BsThreeDots} />}
disabled={typeof props.disabled === 'boolean' ? props.disabled : props.disabled.detail}
title={t('timeline.actions.detail.title')}
/>
<IconButton appearance="link" icon={<Icon as={BsThreeDots} />} title={t('timeline.actions.detail.title')} />
</Whisper>
</FlexboxGrid.Item>
</FlexboxGrid>
Expand Down Expand Up @@ -275,6 +272,7 @@ type DetailMenuProps = {
left?: number
top?: number
own: boolean
disabled: boolean
openBrowser: () => void
copyLink: () => void
onDelete: () => void
Expand Down Expand Up @@ -317,10 +315,20 @@ const detailMenu = (props: DetailMenuProps, ref: React.RefCallback<HTMLElement>)
<Dropdown.Menu onSelect={handleSelect}>
<Dropdown.Item eventKey="browser">{t('timeline.actions.detail.browser')}</Dropdown.Item>
<Dropdown.Item eventKey="copy">{t('timeline.actions.detail.copy')}</Dropdown.Item>
{props.own && <Dropdown.Item eventKey="edit">{t('timeline.actions.detail.edit')}</Dropdown.Item>}
{props.own && <Dropdown.Item eventKey="delete">{t('timeline.actions.detail.delete')}</Dropdown.Item>}
{props.own && (
<Dropdown.Item disabled={props.disabled} eventKey="edit">
{t('timeline.actions.detail.edit')}
</Dropdown.Item>
)}
{props.own && (
<Dropdown.Item disabled={props.disabled} eventKey="delete">
{t('timeline.actions.detail.delete')}
</Dropdown.Item>
)}
<Dropdown.Separator />
<Dropdown.Item eventKey="report">{t('timeline.actions.detail.report')}</Dropdown.Item>
<Dropdown.Item disabled={props.disabled} eventKey="report">
{t('timeline.actions.detail.report')}
</Dropdown.Item>
<Dropdown.Separator />
<Dropdown.Item eventKey="from_other_account">{t('timeline.actions.detail.from_other_account')}</Dropdown.Item>
</Dropdown.Menu>
Expand Down