Skip to content

Commit

Permalink
chore: move some conditionals to effect
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinSchoeler committed Nov 22, 2024
1 parent f95f668 commit 38e057b
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ export const useJumpToStarMessage = () => {
const allowStarring = useSetting('Message_AllowStarring');

useEffect(() => {
if (!allowStarring) {
return () => {
MessageAction.removeButton('jump-to-star-message');
};
}

MessageAction.addButton({
id: 'jump-to-star-message',
icon: 'jump',
Expand All @@ -17,7 +23,7 @@ export const useJumpToStarMessage = () => {
setMessageJumpQueryStringParameter(message._id);
},
condition({ message, subscription, user }) {
if (subscription == null || !allowStarring) {
if (subscription == null) {
return false;
}

Expand Down

0 comments on commit 38e057b

Please sign in to comment.