[Glitch] Add UI support for disabled live feeds
Port 2fa5dd6d1f to glitch-soc
Co-authored-by: diondiondion <mail@diondiondion.com>
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
1 parent
deed31ba8c
commit
b11bd2bdbb
6 files changed
+72
-17
No files matched your search
@@ -14,7 +14,8 @@ import { connectPublicStream, connectCommunityStream } from 'flavours/glitch/act
|
||||
import { expandPublicTimeline, expandCommunityTimeline } from 'flavours/glitch/actions/timelines';
|
||||
import { DismissableBanner } from 'flavours/glitch/components/dismissable_banner';
|
||||
import SettingText from 'flavours/glitch/components/setting_text';
|
||||
import { localLiveFeedAccess, remoteLiveFeedAccess, me, domain } from 'flavours/glitch/initial_state';
|
||||
import { localLiveFeedAccess, remoteLiveFeedAccess, domain } from 'flavours/glitch/initial_state';
|
||||
import { canViewFeed } from 'flavours/glitch/permissions';
|
||||
import { useAppDispatch, useAppSelector } from 'flavours/glitch/store';
|
||||
|
||||
import Column from '../../components/column';
|
||||
@@ -75,7 +76,7 @@ const ColumnSettings = () => {
|
||||
const Firehose = ({ feedType, multiColumn }) => {
|
||||
const dispatch = useAppDispatch();
|
||||
const intl = useIntl();
|
||||
const { signedIn } = useIdentity();
|
||||
const { signedIn, permissions } = useIdentity();
|
||||
const columnRef = useRef(null);
|
||||
|
||||
const allowLocalOnly = useAppSelector((state) => state.getIn(['settings', 'firehose', 'allowLocalOnly']));
|
||||
@@ -177,6 +178,15 @@ const Firehose = ({ feedType, multiColumn }) => {
|
||||
/>
|
||||
);
|
||||
|
||||
const canViewSelectedFeed = canViewFeed(signedIn, permissions, feedType === 'community' ? localLiveFeedAccess : remoteLiveFeedAccess);
|
||||
|
||||
const disabledTimelineMessage = (
|
||||
<FormattedMessage
|
||||
id='empty_column.disabled_feed'
|
||||
defaultMessage='This feed has been disabled by your server administrators.'
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<Column bindToDocument={!multiColumn} ref={columnRef} label={intl.formatMessage(messages.title)}>
|
||||
<ColumnHeader
|
||||
@@ -191,7 +201,7 @@ const Firehose = ({ feedType, multiColumn }) => {
|
||||
<ColumnSettings />
|
||||
</ColumnHeader>
|
||||
|
||||
{(signedIn || (localLiveFeedAccess === 'public' && remoteLiveFeedAccess === 'public')) && (
|
||||
{(canViewFeed(signedIn, permissions, localLiveFeedAccess) && canViewFeed(signedIn, permissions, remoteLiveFeedAccess)) && (
|
||||
<div className='account__section-headline'>
|
||||
<NavLink exact to='/public/local'>
|
||||
<FormattedMessage tagName='div' id='firehose.local' defaultMessage='This server' />
|
||||
@@ -213,7 +223,7 @@ const Firehose = ({ feedType, multiColumn }) => {
|
||||
onLoadMore={handleLoadMore}
|
||||
trackScroll
|
||||
scrollKey='firehose'
|
||||
emptyMessage={emptyMessage}
|
||||
emptyMessage={canViewSelectedFeed ? emptyMessage : disabledTimelineMessage}
|
||||
bindToDocument={!multiColumn}
|
||||
regex={regex}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user