RocketChat/Rocket.Chat

View on GitHub
apps/meteor/client/hooks/useDontAskAgain.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { useUserPreference } from '@rocket.chat/ui-contexts';

export type DontAskAgainList = Array<{ action: string; label: string }>;

export const useDontAskAgain = (action: string): boolean => {
    const dontAskAgainList = useUserPreference<DontAskAgainList>('dontAskAgainList');
    const shouldNotAskAgain = !!dontAskAgainList?.filter(({ action: currentAction }) => action === currentAction).length;

    return shouldNotAskAgain;
};