MM-60141 - Scheduled post copy text option (#29123)
* verified available actions on scheduled posts * Review fixes * Added copy text option for scheudled posts * Added check for archived channel and deactivated DM * Import optimisation
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
847f42fd4c
Коммит
64bf13f250
@@ -55,6 +55,13 @@ const sendNowTooltipText = (
|
||||
/>
|
||||
);
|
||||
|
||||
const copyTextTooltipText = (
|
||||
<FormattedMessage
|
||||
id='scheduled_post.action.copy_text'
|
||||
defaultMessage='Copy text'
|
||||
/>
|
||||
);
|
||||
|
||||
type Props = {
|
||||
scheduledPost: ScheduledPost;
|
||||
channel?: Channel;
|
||||
@@ -62,9 +69,10 @@ type Props = {
|
||||
onDelete: (scheduledPostId: string) => Promise<{error?: string}>;
|
||||
onSend: (scheduledPostId: string) => void;
|
||||
onEdit: () => void;
|
||||
onCopyText: () => void;
|
||||
}
|
||||
|
||||
function ScheduledPostActions({scheduledPost, channel, onReschedule, onDelete, onSend, onEdit}: Props) {
|
||||
function ScheduledPostActions({scheduledPost, channel, onReschedule, onDelete, onSend, onEdit, onCopyText}: Props) {
|
||||
const dispatch = useDispatch();
|
||||
const userTimezone = useSelector(getCurrentTimezone);
|
||||
|
||||
@@ -149,6 +157,14 @@ function ScheduledPostActions({scheduledPost, channel, onReschedule, onDelete, o
|
||||
/>
|
||||
}
|
||||
|
||||
<Action
|
||||
icon='icon-content-copy'
|
||||
id='copy_text'
|
||||
name='copy_text'
|
||||
tooltipText={copyTextTooltipText}
|
||||
onClick={onCopyText}
|
||||
/>
|
||||
|
||||
{
|
||||
showRescheduleOption &&
|
||||
<Action
|
||||
|
||||
@@ -37,6 +37,7 @@ import PlaceholderScheduledPostsTitle
|
||||
import EditPost from 'components/edit_post';
|
||||
|
||||
import Constants, {StoragePrefixes} from 'utils/constants';
|
||||
import {copyToClipboard} from 'utils/utils';
|
||||
|
||||
import type {GlobalState} from 'types/store';
|
||||
import type {PostDraft} from 'types/store/draft';
|
||||
@@ -278,6 +279,10 @@ function DraftRow({
|
||||
setIsEditing((isEditing) => !isEditing);
|
||||
}, []);
|
||||
|
||||
const handleCopyText = useCallback(() => {
|
||||
copyToClipboard(item.message);
|
||||
}, [item]);
|
||||
|
||||
const handleScheduledPostOnSend = useCallback(() => {
|
||||
handleCancelEdit();
|
||||
|
||||
@@ -296,6 +301,7 @@ function DraftRow({
|
||||
onDelete={handleSchedulePostOnDelete}
|
||||
onSend={handleScheduledPostOnSend}
|
||||
onEdit={handleSchedulePostEdit}
|
||||
onCopyText={handleCopyText}
|
||||
/>
|
||||
);
|
||||
}, [
|
||||
@@ -304,6 +310,7 @@ function DraftRow({
|
||||
handleSchedulePostOnReschedule,
|
||||
handleScheduledPostOnSend,
|
||||
handleSchedulePostEdit,
|
||||
handleCopyText,
|
||||
item,
|
||||
]);
|
||||
|
||||
|
||||
@@ -4859,6 +4859,7 @@
|
||||
"Schedule_post.empty_state.subtitle": "Schedule drafts to send messages at a later time. Any scheduled drafts will show up here and can be modified after being scheduled.",
|
||||
"Schedule_post.empty_state.title": "No scheduled drafts at the moment",
|
||||
"schedule_post.tab.heading": "Scheduled",
|
||||
"scheduled_post.action.copy_text": "Copy text",
|
||||
"scheduled_post.action.delete": "Delete scheduled post",
|
||||
"scheduled_post.action.edit": "Edit scheduled post",
|
||||
"scheduled_post.action.reschedule": "Reschedule post",
|
||||
|
||||
Ссылка в новой задаче
Block a user