fix-message-struct
This commit is contained in:
parent
13e126589d
commit
332193622d
|
@ -19,8 +19,8 @@ type Props = {
|
|||
|
||||
export const Message = (props: Props) => {
|
||||
const { formatTime } = useLocalize()
|
||||
const isOwn = props.ownId === Number(props.content.author)
|
||||
const user = props.members?.find((m) => m.id === Number(props.content.author))
|
||||
const isOwn = props.ownId === Number(props.content.created_by)
|
||||
const user = props.members?.find((m) => m.id === Number(props.content.created_by))
|
||||
const [isPopupVisible, setIsPopupVisible] = createSignal<boolean>(false)
|
||||
|
||||
return (
|
||||
|
@ -48,7 +48,7 @@ export const Message = (props: Props) => {
|
|||
<div innerHTML={props.content.body} />
|
||||
</div>
|
||||
</div>
|
||||
<div class={styles.time}>{formatTime(new Date(props.content.createdAt * 1000))}</div>
|
||||
<div class={styles.time}>{formatTime(new Date(props.content.created_at * 1000))}</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ export const Expo = (props: Props) => {
|
|||
offset: sortedArticles().length
|
||||
}
|
||||
|
||||
options.filters = getLayout() ? { layout: getLayout() } : { excludeLayout: 'article' }
|
||||
options.filters = getLayout() ? { layout: getLayout() } : { exclude_layout: 'article' }
|
||||
|
||||
const { hasMore } = await loadShouts(options)
|
||||
setIsLoadMoreButtonVisible(hasMore)
|
||||
|
|
|
@ -70,7 +70,7 @@ export const InboxProvider = (props: { children: JSX.Element }) => {
|
|||
try {
|
||||
const message = await inboxClient.createMessage(args)
|
||||
setMessages((prev) => [...prev, message])
|
||||
const currentChat = chats().find((chat) => chat.id === args.chat)
|
||||
const currentChat = chats().find((chat) => chat.id === args.chat_id)
|
||||
setChats((prev) => [
|
||||
...prev.filter((c) => c.id !== currentChat.id),
|
||||
{ ...currentChat, updatedAt: message.createdAt }
|
||||
|
|
|
@ -104,11 +104,10 @@ export const NotificationsProvider = (props: { children: JSX.Element }) => {
|
|||
},
|
||||
onmessage(event) {
|
||||
const m: SSEMessage = JSON.parse(event.data)
|
||||
if (m.entity === 'chat' || m.entity == 'message') {
|
||||
console.log('[context.notifications] Received message:', m)
|
||||
if (m.entity === 'chat' || m.entity == 'message') {
|
||||
messageHandler()(m)
|
||||
} else {
|
||||
console.log('[context.notifications] Received notification:', m)
|
||||
storeNotification({
|
||||
...m,
|
||||
id: event.id,
|
||||
|
|
|
@ -7,7 +7,7 @@ export default gql`
|
|||
message {
|
||||
id
|
||||
body
|
||||
author
|
||||
created_by
|
||||
created_at
|
||||
reply_to
|
||||
updated_at
|
||||
|
|
|
@ -8,7 +8,7 @@ export default gql`
|
|||
message {
|
||||
id
|
||||
body
|
||||
author
|
||||
created_by
|
||||
created_at
|
||||
reply_to
|
||||
updated_at
|
||||
|
|
|
@ -6,7 +6,7 @@ export default gql`
|
|||
error
|
||||
messages {
|
||||
id
|
||||
author
|
||||
created_by
|
||||
body
|
||||
reply_to
|
||||
created_at
|
||||
|
|
|
@ -128,7 +128,7 @@ export type LoadShoutsFilters = {
|
|||
author?: InputMaybe<Scalars['String']['input']>
|
||||
body?: InputMaybe<Scalars['String']['input']>
|
||||
days?: InputMaybe<Scalars['Int']['input']>
|
||||
excludeLayout?: InputMaybe<Scalars['String']['input']>
|
||||
exclude_layout?: InputMaybe<Scalars['String']['input']>
|
||||
layout?: InputMaybe<Scalars['String']['input']>
|
||||
reacted?: InputMaybe<Scalars['Boolean']['input']>
|
||||
title?: InputMaybe<Scalars['String']['input']>
|
||||
|
@ -146,7 +146,7 @@ export type LoadShoutsOptions = {
|
|||
}
|
||||
|
||||
export type Message = {
|
||||
author: Scalars['Int']['output']
|
||||
created_by: Scalars['Int']['output']
|
||||
body: Scalars['String']['output']
|
||||
chat_id: Scalars['String']['output']
|
||||
created_at: Scalars['Int']['output']
|
||||
|
@ -163,7 +163,7 @@ export enum MessageStatus {
|
|||
}
|
||||
|
||||
export type MessagesBy = {
|
||||
author?: InputMaybe<Scalars['String']['input']>
|
||||
created_by?: InputMaybe<Scalars['String']['input']>
|
||||
body?: InputMaybe<Scalars['String']['input']>
|
||||
chat?: InputMaybe<Scalars['String']['input']>
|
||||
days?: InputMaybe<Scalars['Int']['input']>
|
||||
|
@ -635,7 +635,6 @@ export type ShoutInput = {
|
|||
description?: InputMaybe<Scalars['String']['input']>
|
||||
layout?: InputMaybe<Scalars['String']['input']>
|
||||
lead?: InputMaybe<Scalars['String']['input']>
|
||||
mainTopic?: InputMaybe<TopicInput>
|
||||
media?: InputMaybe<Scalars['String']['input']>
|
||||
slug?: InputMaybe<Scalars['String']['input']>
|
||||
subtitle?: InputMaybe<Scalars['String']['input']>
|
||||
|
|
|
@ -5,7 +5,7 @@ import { PRERENDERED_ARTICLES_COUNT } from '../../components/Views/Expo/Expo'
|
|||
|
||||
export const onBeforeRender = async (_pageContext: PageContext) => {
|
||||
const expoShouts = await apiClient.getShouts({
|
||||
filters: { excludeLayout: 'article' },
|
||||
filters: { exclude_layout: 'article' },
|
||||
limit: PRERENDERED_ARTICLES_COUNT
|
||||
})
|
||||
const pageProps: PageProps = { expoShouts }
|
||||
|
|
Loading…
Reference in New Issue
Block a user