fix social-app menubar chat
This commit is contained in:
@@ -1,70 +1,75 @@
|
||||
diff --git a/src/state/messages/events/index.tsx b/src/state/messages/events/index.tsx
|
||||
index 2ff0784ae..dc314ecc5 100644
|
||||
--- a/src/state/messages/events/index.tsx
|
||||
+++ b/src/state/messages/events/index.tsx
|
||||
@@ -10,13 +10,7 @@ const MessagesEventBusContext = React.createContext<MessagesEventBus | null>(
|
||||
MessagesEventBusContext.displayName = 'MessagesEventBusContext'
|
||||
|
||||
export function useMessagesEventBus() {
|
||||
- const ctx = React.useContext(MessagesEventBusContext)
|
||||
- if (!ctx) {
|
||||
- throw new Error(
|
||||
- 'useMessagesEventBus must be used within a MessagesEventBusProvider',
|
||||
- )
|
||||
- }
|
||||
- return ctx
|
||||
+ return React.useContext(MessagesEventBusContext)
|
||||
}
|
||||
|
||||
export function MessagesEventBusProvider({
|
||||
@@ -24,18 +18,11 @@ export function MessagesEventBusProvider({
|
||||
}: {
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
- const {currentAccount} = useSession()
|
||||
-
|
||||
- if (!currentAccount) {
|
||||
- return (
|
||||
- <MessagesEventBusContext.Provider value={null}>
|
||||
- {children}
|
||||
- </MessagesEventBusContext.Provider>
|
||||
- )
|
||||
- }
|
||||
-
|
||||
+ // DM functionality is disabled for syu.is
|
||||
return (
|
||||
- <MessagesEventBusProviderInner>{children}</MessagesEventBusProviderInner>
|
||||
+ <MessagesEventBusContext.Provider value={null}>
|
||||
+ {children}
|
||||
+ </MessagesEventBusContext.Provider>
|
||||
)
|
||||
}
|
||||
|
||||
diff --git a/src/state/queries/messages/list-conversations.tsx b/src/state/queries/messages/list-conversations.tsx
|
||||
index c5457d1cb..5bc37bdce 100644
|
||||
--- a/src/state/queries/messages/list-conversations.tsx
|
||||
+++ b/src/state/queries/messages/list-conversations.tsx
|
||||
@@ -74,17 +74,12 @@ export function useListConvos() {
|
||||
|
||||
const empty = {accepted: [], request: []}
|
||||
export function ListConvosProvider({children}: {children: React.ReactNode}) {
|
||||
- const {hasSession} = useSession()
|
||||
-
|
||||
- if (!hasSession) {
|
||||
- return (
|
||||
- <ListConvosContext.Provider value={empty}>
|
||||
- {children}
|
||||
- </ListConvosContext.Provider>
|
||||
- )
|
||||
- }
|
||||
-
|
||||
- return <ListConvosProviderInner>{children}</ListConvosProviderInner>
|
||||
+ // DM functionality is disabled for syu.is - always return empty
|
||||
+ return (
|
||||
+ <ListConvosContext.Provider value={empty}>
|
||||
+ {children}
|
||||
+ </ListConvosContext.Provider>
|
||||
+ )
|
||||
}
|
||||
|
||||
export function ListConvosProviderInner({
|
||||
--- a/src/view/shell/bottom-bar/BottomBar.tsx
|
||||
+++ b/src/view/shell/bottom-bar/BottomBar.tsx
|
||||
@@ -198,38 +198,40 @@
|
||||
accessibilityLabel={_(msg`Search`)}
|
||||
accessibilityHint=""
|
||||
/>
|
||||
- <Btn
|
||||
- testID="bottomBarMessagesBtn"
|
||||
- icon={
|
||||
- isAtMessages ? (
|
||||
- <MessageFilled
|
||||
- width={iconWidth - 1}
|
||||
- style={[styles.ctrlIcon, pal.text, styles.feedsIcon]}
|
||||
- />
|
||||
- ) : (
|
||||
- <Message
|
||||
- width={iconWidth - 1}
|
||||
- style={[styles.ctrlIcon, pal.text, styles.feedsIcon]}
|
||||
- />
|
||||
- )
|
||||
- }
|
||||
- onPress={onPressMessages}
|
||||
- notificationCount={numUnreadMessages.numUnread}
|
||||
- hasNew={numUnreadMessages.hasNew}
|
||||
- accessible={true}
|
||||
- accessibilityRole="tab"
|
||||
- accessibilityLabel={_(msg`Chat`)}
|
||||
- accessibilityHint={
|
||||
- numUnreadMessages.count > 0
|
||||
- ? _(
|
||||
- msg`${plural(numUnreadMessages.numUnread ?? 0, {
|
||||
- one: '# unread item',
|
||||
- other: '# unread items',
|
||||
- })}` || '',
|
||||
- )
|
||||
- : ''
|
||||
- }
|
||||
- />
|
||||
+ {!currentAccount?.isSelfHosted && (
|
||||
+ <Btn
|
||||
+ testID="bottomBarMessagesBtn"
|
||||
+ icon={
|
||||
+ isAtMessages ? (
|
||||
+ <MessageFilled
|
||||
+ width={iconWidth - 1}
|
||||
+ style={[styles.ctrlIcon, pal.text, styles.feedsIcon]}
|
||||
+ />
|
||||
+ ) : (
|
||||
+ <Message
|
||||
+ width={iconWidth - 1}
|
||||
+ style={[styles.ctrlIcon, pal.text, styles.feedsIcon]}
|
||||
+ />
|
||||
+ )
|
||||
+ }
|
||||
+ onPress={onPressMessages}
|
||||
+ notificationCount={numUnreadMessages.numUnread}
|
||||
+ hasNew={numUnreadMessages.hasNew}
|
||||
+ accessible={true}
|
||||
+ accessibilityRole="tab"
|
||||
+ accessibilityLabel={_(msg`Chat`)}
|
||||
+ accessibilityHint={
|
||||
+ numUnreadMessages.count > 0
|
||||
+ ? _(
|
||||
+ msg`${plural(numUnreadMessages.numUnread ?? 0, {
|
||||
+ one: '# unread item',
|
||||
+ other: '# unread items',
|
||||
+ })}` || '',
|
||||
+ )
|
||||
+ : ''
|
||||
+ }
|
||||
+ />
|
||||
+ )}
|
||||
<Btn
|
||||
testID="bottomBarNotificationsBtn"
|
||||
icon={
|
||||
|
||||
Reference in New Issue
Block a user