[Glitch] Add more resilience to Emoji IDB upgrades
Port 1dc2abb9f5b430f80e771f214343983919cd543d to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
1 parent
d45a4a2dc3
commit
6308fcd9f8
12 files changed
+471
-84
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
|
||||
import { useIntl } from 'react-intl';
|
||||
import { defineMessage, useIntl } from 'react-intl';
|
||||
import type { IntlShape } from 'react-intl';
|
||||
|
||||
import { dismissAlert } from 'flavours/glitch/actions/alerts';
|
||||
@@ -75,6 +75,9 @@ const TimedAlert: React.FC<{
|
||||
|
||||
export const AlertsController: React.FC = () => {
|
||||
const alerts = useAppSelector((state) => state.alerts);
|
||||
const needsReload = useAppSelector(
|
||||
(state) => !!state.meta.get('needsReload'),
|
||||
);
|
||||
|
||||
return (
|
||||
<A11yLiveRegion className='notification-list'>
|
||||
@@ -85,6 +88,18 @@ export const AlertsController: React.FC = () => {
|
||||
dismissAfter={5000 + idx * 1000}
|
||||
/>
|
||||
))}
|
||||
{needsReload && <ReloadAlert />}
|
||||
</A11yLiveRegion>
|
||||
);
|
||||
};
|
||||
|
||||
const reloadMessage = defineMessage({
|
||||
id: 'alert.need_reload.message',
|
||||
defaultMessage:
|
||||
'Mastodon has been updated. Some things may not work correctly until you reload the page.',
|
||||
});
|
||||
|
||||
const ReloadAlert: React.FC = () => {
|
||||
const intl = useIntl();
|
||||
return <Alert isActive message={intl.formatMessage(reloadMessage)} />;
|
||||
};
|
||||
Reference in new issue
Block a user