Simply replace clearCache with clearArchivedCache

This commit is contained in:
Nicholas Zuber 2020-01-26 19:44:06 -05:00
parent ecd8b7ef0b
commit b066cf43c0
4 changed files with 5 additions and 16 deletions

View File

@ -494,11 +494,11 @@ class NotificationsPage extends React.Component {
fetchNotifications,
markAllAsStaged,
clearCache,
clearArchivedCache,
notificationsPermission,
loading: isFetchingNotifications,
error: fetchingNotificationsError,
} = this.props.notificationsApi;
const {
notifications: scoredAndSortedNotifications,
queuedCount,
@ -573,7 +573,6 @@ class NotificationsPage extends React.Component {
onMarkAsRead={this.enhancedOnMarkAsRead}
onMarkAllAsStaged={markAllAsStaged}
onClearCache={clearCache}
onClearArchivedCache={clearArchivedCache}
onStageThread={this.enhancedOnStageThread}
onRestoreThread={this.restoreThread}
onRefreshNotifications={this.props.storageApi.refreshNotifications}

View File

@ -329,7 +329,6 @@ export default function Scene ({
onFetchNotifications,
onMarkAllAsStaged,
onClearCache,
onClearArchivedCache,
setNotificationsPermission,
onStageThread,
onArchiveThread,
@ -643,15 +642,6 @@ export default function Scene ({
<h2>Mark all as read</h2>
<p>Move all your unread notifications to the read tab</p>
</optimized.div>
<optimized.div onClick={event => {
event.stopPropagation();
const response = window.confirm('Are you sure you want to delete the archived section?');
void (response && onClearArchivedCache());
setDropdownOpen(false);
}}>
<h2>Empty archived</h2>
<p>Clear all the notifications in the archived section from your local storage</p>
</optimized.div>
<optimized.div onClick={event => {
event.stopPropagation();
const response = window.confirm('Are you sure you want to clear the cache?');
@ -659,7 +649,7 @@ export default function Scene ({
setDropdownOpen(false);
}}>
<h2>Empty cache</h2>
<p>Clear all the notifications that are being tracked in your local storage</p>
<p>Delete all the archived notifications tracked in your local storage</p>
</optimized.div>
<optimized.div onClick={event => {
event.stopPropagation();

View File

@ -487,7 +487,7 @@ const withNotificationsProvider = WrappedComponent => props => (
setItem,
getUserItem,
setUserItem,
clearCache,
clearArchivedCache,
removeItem
}) => (
<NotificationsProvider
@ -497,7 +497,7 @@ const withNotificationsProvider = WrappedComponent => props => (
setItemInStorage={setItem}
getUserItem={getUserItem}
setUserItem={setUserItem}
clearStorageCache={clearCache}
clearStorageCache={clearArchivedCache}
removeItemFromStorage={removeItem}
token={token}
>

View File

@ -221,7 +221,7 @@ class StorageProvider extends React.Component {
}
clearArchivedCache = () => {
const notifications = Object
Object
.keys(window.localStorage)
.reduce((acc, key) => {
if (key.indexOf(LOCAL_STORAGE_PREFIX) > -1) {