Allow to change folder for an existing bookmark
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
e181296596
commit
f90a1618d2
4 changed files with 24 additions and 1 deletions
|
@ -38,6 +38,8 @@ const messages = defineMessages({
|
|||
blockAndReport: { id: 'confirmations.block.block_and_report', defaultMessage: 'Block & Report' },
|
||||
blockConfirm: { id: 'confirmations.block.confirm', defaultMessage: 'Block' },
|
||||
bookmark: { id: 'status.bookmark', defaultMessage: 'Bookmark' },
|
||||
bookmarkSetFolder: { id: 'status.bookmark_folder', defaultMessage: 'Set bookmark folder' },
|
||||
bookmarkChangeFolder: { id: 'status.bookmark_folder_change', defaultMessage: 'Change bookmark folder' },
|
||||
cancel_reblog_private: { id: 'status.cancel_reblog_private', defaultMessage: 'Un-repost' },
|
||||
cannot_reblog: { id: 'status.cannot_reblog', defaultMessage: 'This post cannot be reposted' },
|
||||
chat: { id: 'status.chat', defaultMessage: 'Chat with @{name}' },
|
||||
|
@ -112,6 +114,7 @@ interface IStatusActionBar {
|
|||
expandable?: boolean;
|
||||
space?: 'sm' | 'md' | 'lg';
|
||||
statusActionButtonTheme?: 'default' | 'inverse';
|
||||
fromBookmarks?: boolean;
|
||||
}
|
||||
|
||||
const StatusActionBar: React.FC<IStatusActionBar> = ({
|
||||
|
@ -120,6 +123,7 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
|
|||
expandable = true,
|
||||
space = 'sm',
|
||||
statusActionButtonTheme = 'default',
|
||||
fromBookmarks = false,
|
||||
}) => {
|
||||
const intl = useIntl();
|
||||
const history = useHistory();
|
||||
|
@ -201,6 +205,12 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
|
|||
dispatch(toggleBookmark(status));
|
||||
};
|
||||
|
||||
const handleBookmarkFolderClick = () => {
|
||||
dispatch(openModal('SELECT_BOOKMARK_FOLDER', {
|
||||
statusId: status.id,
|
||||
}));
|
||||
};
|
||||
|
||||
const handleExternalClick = () => {
|
||||
window.open(status.uri, '_blank');
|
||||
};
|
||||
|
@ -453,6 +463,14 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
|
|||
});
|
||||
}
|
||||
|
||||
if (features.bookmarkFolders && fromBookmarks) {
|
||||
menu.push({
|
||||
text: intl.formatMessage(status.pleroma.get('bookmark_folder') ? messages.bookmarkChangeFolder : messages.bookmarkSetFolder),
|
||||
action: handleBookmarkFolderClick,
|
||||
icon: require('@tabler/icons/outline/folders.svg'),
|
||||
});
|
||||
}
|
||||
|
||||
if (features.federating && !account.local) {
|
||||
const { hostname: domain } = new URL(status.uri);
|
||||
menu.push({
|
||||
|
|
|
@ -129,6 +129,7 @@ const StatusList: React.FC<IStatusList> = ({
|
|||
contextType={timelineId}
|
||||
showGroup={showGroup}
|
||||
variant={divideType === 'border' ? 'slim' : 'rounded'}
|
||||
fromBookmarks={other.scrollKey === 'bookmarked_statuses'}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -50,6 +50,7 @@ export interface IStatus {
|
|||
variant?: 'default' | 'rounded' | 'slim';
|
||||
showGroup?: boolean;
|
||||
accountAction?: React.ReactElement;
|
||||
fromBookmarks?: boolean;
|
||||
}
|
||||
|
||||
const Status: React.FC<IStatus> = (props) => {
|
||||
|
@ -69,6 +70,7 @@ const Status: React.FC<IStatus> = (props) => {
|
|||
hideActionBar,
|
||||
variant = 'rounded',
|
||||
showGroup = true,
|
||||
fromBookmarks = false,
|
||||
} = props;
|
||||
|
||||
const intl = useIntl();
|
||||
|
@ -478,7 +480,7 @@ const Status: React.FC<IStatus> = (props) => {
|
|||
|
||||
{(!hideActionBar && !isUnderReview) && (
|
||||
<div className='pt-4'>
|
||||
<StatusActionBar status={actualStatus} />
|
||||
<StatusActionBar status={actualStatus} fromBookmarks={fromBookmarks} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
@ -1481,6 +1481,8 @@
|
|||
"status.approval.rejected": "Rejected",
|
||||
"status.bookmark": "Bookmark",
|
||||
"status.bookmark.select_folder": "Select folder",
|
||||
"status.bookmark_folder": "Set bookmark folder",
|
||||
"status.bookmark_folder_change": "Change bookmark folder",
|
||||
"status.bookmark_folder_changed": "Changed folder",
|
||||
"status.bookmarked": "Bookmark added.",
|
||||
"status.cancel_reblog_private": "Un-repost",
|
||||
|
|
Loading…
Reference in a new issue