-
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 jump-to-star-message
- Loading branch information
1 parent
726cfbe
commit f95f668
Showing
4 changed files
with
36 additions
and
27 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
34 changes: 34 additions & 0 deletions
34
apps/meteor/client/components/message/toolbar/useJumpToStarMessage.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,34 @@ | ||
import { useSetting } from '@rocket.chat/ui-contexts'; | ||
import { useEffect } from 'react'; | ||
|
||
import { MessageAction } from '../../../../app/ui-utils/client/lib/MessageAction'; | ||
import { setMessageJumpQueryStringParameter } from '../../../lib/utils/setMessageJumpQueryStringParameter'; | ||
|
||
export const useJumpToStarMessage = () => { | ||
const allowStarring = useSetting('Message_AllowStarring'); | ||
|
||
useEffect(() => { | ||
MessageAction.addButton({ | ||
id: 'jump-to-star-message', | ||
icon: 'jump', | ||
label: 'Jump_to_message', | ||
context: ['starred', 'threads', 'message-mobile', 'videoconf-threads'], | ||
action(_, { message }) { | ||
setMessageJumpQueryStringParameter(message._id); | ||
}, | ||
condition({ message, subscription, user }) { | ||
if (subscription == null || !allowStarring) { | ||
return false; | ||
} | ||
|
||
return Boolean(message.starred?.find((star) => star._id === user?._id)); | ||
}, | ||
order: 100, | ||
group: 'message', | ||
}); | ||
|
||
return () => { | ||
MessageAction.removeButton('jump-to-star-message'); | ||
}; | ||
}, [allowStarring]); | ||
}; |
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
26 changes: 0 additions & 26 deletions
26
apps/meteor/client/startup/actionButtons/jumpToStarMessage.ts
This file was deleted.
Oops, something went wrong.