-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: remove meteor.startup from permalink-pinned
- Loading branch information
1 parent
726cfbe
commit 75eeaec
Showing
4 changed files
with
45 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
apps/meteor/client/components/message/toolbar/usePermalinkPinned.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { isE2EEMessage } from '@rocket.chat/core-typings'; | ||
import { useToastMessageDispatch } from '@rocket.chat/ui-contexts'; | ||
import { useEffect } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import { MessageAction } from '../../../../app/ui-utils/client/lib/MessageAction'; | ||
import { getPermaLink } from '../../../lib/getPermaLink'; | ||
|
||
export const usePermalinkPinned = () => { | ||
const { t } = useTranslation(); | ||
|
||
const dispatchToastMessage = useToastMessageDispatch(); | ||
|
||
useEffect(() => { | ||
MessageAction.addButton({ | ||
id: 'permalink-pinned', | ||
icon: 'permalink', | ||
label: 'Copy_link', | ||
context: ['pinned'], | ||
async action(_, { message }) { | ||
try { | ||
const permalink = await getPermaLink(message._id); | ||
navigator.clipboard.writeText(permalink); | ||
dispatchToastMessage({ type: 'success', message: t('Copied') }); | ||
} catch (e) { | ||
dispatchToastMessage({ type: 'error', message: e }); | ||
} | ||
}, | ||
condition({ subscription }) { | ||
return !!subscription; | ||
}, | ||
order: 5, | ||
group: 'menu', | ||
disabled({ message }) { | ||
return isE2EEMessage(message); | ||
}, | ||
}); | ||
|
||
return () => { | ||
MessageAction.removeButton('permalink-pinned'); | ||
}; | ||
}, [dispatchToastMessage, t]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
apps/meteor/client/startup/actionButtons/permalinkPinned.ts
This file was deleted.
Oops, something went wrong.