Clear announcement history using window.clearLastViewedAnnouncement()

This helps testing, and can be eventually removed. No harm leaving it there, though.
This commit is contained in:
infinite-persistence 2022-05-18 17:19:51 +08:00
parent d70f0f1d6d
commit 14a11aa78a
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
2 changed files with 11 additions and 0 deletions

View file

@ -7,6 +7,7 @@ import {
selectSyncIsLocked,
} from 'redux/selectors/sync';
import { doUserSetReferrer } from 'redux/actions/user';
import { doSetLastViewedAnnouncement } from 'redux/actions/content';
import {
selectOdyseeMembershipIsPremiumPlus,
selectUser,
@ -58,6 +59,7 @@ const perform = {
fetchModBlockedList: doFetchModBlockedList,
fetchModAmIList: doFetchCommentModAmIList,
doOpenAnnouncements,
doSetLastViewedAnnouncement,
};
export default hot(connect(select, perform)(App));

View file

@ -89,6 +89,7 @@ type Props = {
fetchModAmIList: () => void,
homepageFetched: boolean,
doOpenAnnouncements: () => void,
doSetLastViewedAnnouncement: (hash: string) => void,
};
function App(props: Props) {
@ -123,6 +124,7 @@ function App(props: Props) {
fetchModAmIList,
homepageFetched,
doOpenAnnouncements,
doSetLastViewedAnnouncement,
} = props;
const isMobile = useIsMobile();
@ -481,6 +483,13 @@ function App(props: Props) {
}
}, [prefsReady]);
useEffect(() => {
window.clearLastViewedAnnouncement = () => {
console.log('Clearing history. Please wait ...');
doSetLastViewedAnnouncement('');
};
}, []);
// Keep this at the end to ensure initial setup effects are run first
useEffect(() => {
if (!hasSignedIn && hasVerifiedEmail) {