From 504eb98cd78355c0a5787368e7ca3db4b50069a8 Mon Sep 17 00:00:00 2001 From: Untone Date: Wed, 31 Jan 2024 20:41:49 +0300 Subject: [PATCH 01/22] delete-debug --- src/graphql/client/core.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/graphql/client/core.ts b/src/graphql/client/core.ts index 04e8acf6..e14bdad2 100644 --- a/src/graphql/client/core.ts +++ b/src/graphql/client/core.ts @@ -163,8 +163,11 @@ export const apiClient = { console.debug('[graphql.client.core] updateArticle:', response.data) return response.data.update_shout.shout }, - deleteShout: async ({ shoutId }: { shoutId: number }): Promise => { - const response = await apiClient.private.mutation(deleteShout, { shout_id: shoutId }).toPromise() + deleteShout: async (params): Promise => { + console.debug(params) + const response = await apiClient.private + .mutation(deleteShout, { shout_id: params?.shoutId }) + .toPromise() console.debug('[graphql.client.core] deleteShout:', response) }, getDrafts: async (): Promise => { From 0a9b70bfb7125d88643750d0239d4374c7ea306c Mon Sep 17 00:00:00 2001 From: Untone Date: Wed, 31 Jan 2024 21:15:08 +0300 Subject: [PATCH 02/22] delete-shout-fix --- src/graphql/client/core.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/graphql/client/core.ts b/src/graphql/client/core.ts index e14bdad2..ad149d8b 100644 --- a/src/graphql/client/core.ts +++ b/src/graphql/client/core.ts @@ -13,6 +13,7 @@ import type { QueryLoad_Shouts_SearchArgs, QueryLoad_Shouts_Random_TopArgs, Community, + MutationDelete_ShoutArgs, } from '../schema/core.gen' import { createGraphQLClient } from '../createGraphQLClient' @@ -163,11 +164,8 @@ export const apiClient = { console.debug('[graphql.client.core] updateArticle:', response.data) return response.data.update_shout.shout }, - deleteShout: async (params): Promise => { - console.debug(params) - const response = await apiClient.private - .mutation(deleteShout, { shout_id: params?.shoutId }) - .toPromise() + deleteShout: async (params: MutationDelete_ShoutArgs): Promise => { + const response = await apiClient.private.mutation(deleteShout, params).toPromise() console.debug('[graphql.client.core] deleteShout:', response) }, getDrafts: async (): Promise => { From 5e5291d7e85d787aa5a0a2e8bda6c15f64a074c3 Mon Sep 17 00:00:00 2001 From: Untone Date: Wed, 31 Jan 2024 21:41:20 +0300 Subject: [PATCH 03/22] delete-shout-fix-2 --- src/context/editor.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/context/editor.tsx b/src/context/editor.tsx index 41975d52..6d7c550b 100644 --- a/src/context/editor.tsx +++ b/src/context/editor.tsx @@ -218,10 +218,10 @@ export const EditorProvider = (props: { children: JSX.Element }) => { } } - const deleteShout = async (shoutId: number) => { + const deleteShout = async (shout_id: number) => { try { await apiClient.deleteShout({ - shoutId, + shout_id, }) return true } catch { From 9b1f3c993cd57a3ff6989b62c3c6c666c74da6da Mon Sep 17 00:00:00 2001 From: Untone Date: Wed, 31 Jan 2024 22:06:29 +0300 Subject: [PATCH 04/22] delete-fix --- src/graphql/mutation/core/article-delete.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/graphql/mutation/core/article-delete.ts b/src/graphql/mutation/core/article-delete.ts index 9aa22fc1..6ac5578e 100644 --- a/src/graphql/mutation/core/article-delete.ts +++ b/src/graphql/mutation/core/article-delete.ts @@ -1,8 +1,8 @@ import { gql } from '@urql/core' export default gql` - mutation DeleteShoutMutation($shoutId: Int!) { - delete_shout(shout_id: $shoutId) { + mutation DeleteShoutMutation($shout_id: Int!) { + delete_shout(shout_id: $shout_id) { error } } From 5ca4c204db548d1b6bf6e700720b90e716e90fa3 Mon Sep 17 00:00:00 2001 From: to Date: Thu, 1 Feb 2024 08:48:36 +0000 Subject: [PATCH 05/22] Update .gitea/workflows/main.yml --- .gitea/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml index a21d1a60..c3927a4c 100644 --- a/.gitea/workflows/main.yml +++ b/.gitea/workflows/main.yml @@ -3,7 +3,7 @@ on: push: branches: - main - - feature/sse-connect + - dev jobs: test: From 0e392db5bda28f4f4ffcc44f388cc56ff8b9e79a Mon Sep 17 00:00:00 2001 From: to Date: Thu, 1 Feb 2024 08:57:19 +0000 Subject: [PATCH 06/22] Update .gitea/workflows/main.yml --- .gitea/workflows/main.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml index c3927a4c..356af9cd 100644 --- a/.gitea/workflows/main.yml +++ b/.gitea/workflows/main.yml @@ -30,14 +30,14 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - - name: update authorizer_password_reset - uses: jlepocher/mailgun-create-template-version-action@v1.3 + + - name: update authorizer_password_reset template + uses: gyto/mailgun-template-action@v2 with: - mailgun-host: 'api.eu.mailgun.net' - mailgun-api-key: ${{ secrets.MAILGUN_API_KEY }} - mailgun-domain-name: 'discours.io' - mailgun-template-name: 'authorizer_password_reset' - html-file-path: './templates/authorizer_password_reset.html' + html-file: './templates/authorizer_password_reset.html' + mailgun-api-key: ${{ secrets.MAILGUN_KEY }} + mailgun-domain: "discours.io", + mailgun-template: "authorizer_password_reset" - name: update authorizer_password_reset uses: jlepocher/mailgun-create-template-version-action@v1.3 From 09417a12e412981e90992830e79fc793da3f0b2c Mon Sep 17 00:00:00 2001 From: to Date: Thu, 1 Feb 2024 08:58:57 +0000 Subject: [PATCH 07/22] Update .gitea/workflows/main.yml --- .gitea/workflows/main.yml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml index 356af9cd..be43d562 100644 --- a/.gitea/workflows/main.yml +++ b/.gitea/workflows/main.yml @@ -34,16 +34,7 @@ jobs: - name: update authorizer_password_reset template uses: gyto/mailgun-template-action@v2 with: - html-file: './templates/authorizer_password_reset.html' + html-file: "./templates/authorizer_password_reset.html" mailgun-api-key: ${{ secrets.MAILGUN_KEY }} mailgun-domain: "discours.io", mailgun-template: "authorizer_password_reset" - - - name: update authorizer_password_reset - uses: jlepocher/mailgun-create-template-version-action@v1.3 - with: - mailgun-host: 'api.eu.mailgun.net' - mailgun-api-key: ${{ secrets.MAILGUN_API_KEY }} - mailgun-domain-name: 'discours.io' - mailgun-template-name: 'authorizer_email_confirm' - html-file-path: './templates/authorizer_email_confirm.html' From a7246cf9591f190d12b67011c3874558b7e2b20d Mon Sep 17 00:00:00 2001 From: to Date: Thu, 1 Feb 2024 09:00:39 +0000 Subject: [PATCH 08/22] Update .gitea/workflows/main.yml --- .gitea/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml index be43d562..85dd7801 100644 --- a/.gitea/workflows/main.yml +++ b/.gitea/workflows/main.yml @@ -31,7 +31,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: update authorizer_password_reset template + - name: "Create password reset template" uses: gyto/mailgun-template-action@v2 with: html-file: "./templates/authorizer_password_reset.html" From f2fd539d01f474a5f9ee98f1302e684f07b41eab Mon Sep 17 00:00:00 2001 From: to Date: Thu, 1 Feb 2024 09:01:16 +0000 Subject: [PATCH 09/22] Update .gitea/workflows/main.yml --- .gitea/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml index 85dd7801..caf313bd 100644 --- a/.gitea/workflows/main.yml +++ b/.gitea/workflows/main.yml @@ -31,10 +31,10 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: "Create password reset template" + - name: Password-reset-template uses: gyto/mailgun-template-action@v2 with: html-file: "./templates/authorizer_password_reset.html" mailgun-api-key: ${{ secrets.MAILGUN_KEY }} - mailgun-domain: "discours.io", + mailgun-domain: "discours.io" mailgun-template: "authorizer_password_reset" From e9bcb841a21e085d741ee241f009c36fc07600fc Mon Sep 17 00:00:00 2001 From: to Date: Thu, 1 Feb 2024 09:04:35 +0000 Subject: [PATCH 10/22] Update .gitea/workflows/main.yml --- .gitea/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml index caf313bd..5fbbdcf7 100644 --- a/.gitea/workflows/main.yml +++ b/.gitea/workflows/main.yml @@ -35,6 +35,6 @@ jobs: uses: gyto/mailgun-template-action@v2 with: html-file: "./templates/authorizer_password_reset.html" - mailgun-api-key: ${{ secrets.MAILGUN_KEY }} + mailgun-api-key: ${{ secrets.MAILGUN_API_KEY }} mailgun-domain: "discours.io" mailgun-template: "authorizer_password_reset" From c6e9a5e9503a60355df5dc6054e8d2327229f6f2 Mon Sep 17 00:00:00 2001 From: to Date: Thu, 1 Feb 2024 09:18:09 +0000 Subject: [PATCH 11/22] Update .gitea/workflows/main.yml --- .gitea/workflows/main.yml | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml index 5fbbdcf7..09c1881b 100644 --- a/.gitea/workflows/main.yml +++ b/.gitea/workflows/main.yml @@ -1,9 +1,11 @@ name: 'deploy' + on: push: branches: - main - dev + - feature/email-templates jobs: test: @@ -26,15 +28,40 @@ jobs: update_mailgun_template: runs-on: ubuntu-latest name: Update templates on Mailgun + if: github.event_name == 'push' && github.ref == 'refs/heads/feature/email-templates' continue-on-error: true steps: - name: Checkout uses: actions/checkout@v2 - - name: Password-reset-template + - name: "Email confirmation template" + uses: gyto/mailgun-template-action@v2 + with: + html-file: "./templates/authorizer_email_confirmation.html" + mailgun-api-key: ${{ secrets.MAILGUN_API_KEY }} + mailgun-domain: "discours.io" + mailgun-template: "authorizer_email_confirmation" + + - name: "Password reset template" uses: gyto/mailgun-template-action@v2 with: html-file: "./templates/authorizer_password_reset.html" mailgun-api-key: ${{ secrets.MAILGUN_API_KEY }} mailgun-domain: "discours.io" mailgun-template: "authorizer_password_reset" + + - name: "First publication notification" + uses: gyto/mailgun-template-action@v2 + with: + html-file: "./templates/first_publication_notification.html" + mailgun-api-key: ${{ secrets.MAILGUN_API_KEY }} + mailgun-domain: "discours.io" + mailgun-template: "first_publication_notification" + + - name: "New comment notification template" + uses: gyto/mailgun-template-action@v2 + with: + html-file: "./templates/new_comment_notification.html" + mailgun-api-key: ${{ secrets.MAILGUN_API_KEY }} + mailgun-domain: "discours.io" + mailgun-template: "new_comment_notification" From 2ee57a1dcc05e757c5ba10770dcf012cbb03a32e Mon Sep 17 00:00:00 2001 From: Untone Date: Fri, 2 Feb 2024 20:44:48 +0300 Subject: [PATCH 12/22] visibility-tail --- src/graphql/mutation/core/article-update.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/graphql/mutation/core/article-update.ts b/src/graphql/mutation/core/article-update.ts index ca455bc5..af47cade 100644 --- a/src/graphql/mutation/core/article-update.ts +++ b/src/graphql/mutation/core/article-update.ts @@ -12,7 +12,10 @@ export default gql` lead description body - visibility + created_at + updated_at + published_at + featured_at } } } From 1fa5fbd1a56c465737caed3ef79467fcd938daaf Mon Sep 17 00:00:00 2001 From: Untone Date: Fri, 2 Feb 2024 21:03:55 +0300 Subject: [PATCH 13/22] lesscode --- src/context/editor.tsx | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/context/editor.tsx b/src/context/editor.tsx index 02958b2d..56b875da 100644 --- a/src/context/editor.tsx +++ b/src/context/editor.tsx @@ -124,18 +124,10 @@ export const EditorProvider = (props: { children: JSX.Element }) => { return await apiClient.updateArticle({ shoutId: formToUpdate.shoutId, shoutInput: { - body: formToUpdate.body, + ...formToUpdate, topics: formToUpdate.selectedTopics.map((topic) => topic2topicInput(topic)), // NOTE: first is main - // authors?: InputMaybe>> - // community?: InputMaybe - // mainTopic: topic2topicInput(formToUpdate.mainTopic), - slug: formToUpdate.slug, - subtitle: formToUpdate.subtitle, - title: formToUpdate.title, - lead: formToUpdate.lead, - description: formToUpdate.description, - cover: formToUpdate.coverImageUrl, media: formToUpdate.media, + cover: formToUpdate.coverImageUrl, }, publish, }) From 571e3cd8a401bbebffcab3eea474ec91c6271388 Mon Sep 17 00:00:00 2001 From: Untone Date: Sat, 3 Feb 2024 00:19:58 +0300 Subject: [PATCH 14/22] minor-fix --- src/context/editor.tsx | 19 +++++-------------- src/graphql/client/core.ts | 10 +++++----- src/graphql/mutation/core/article-update.ts | 4 ++-- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/src/context/editor.tsx b/src/context/editor.tsx index 83992474..7db797e2 100644 --- a/src/context/editor.tsx +++ b/src/context/editor.tsx @@ -122,20 +122,11 @@ export const EditorProvider = (props: { children: JSX.Element }) => { const updateShout = async (formToUpdate: ShoutForm, { publish }: { publish: boolean }) => { return await apiClient.updateArticle({ - shoutId: formToUpdate.shoutId, - shoutInput: { - body: formToUpdate.body, + shout_id: formToUpdate.shoutId, + shout_input: { + ...formToUpdate, topics: formToUpdate.selectedTopics.map((topic) => topic2topicInput(topic)), // NOTE: first is main - // authors?: InputMaybe>> - // community?: InputMaybe - // mainTopic: topic2topicInput(formToUpdate.mainTopic), - slug: formToUpdate.slug, - subtitle: formToUpdate.subtitle, - title: formToUpdate.title, - lead: formToUpdate.lead, - description: formToUpdate.description, cover: formToUpdate.coverImageUrl, - media: formToUpdate.media, }, publish, }) @@ -204,10 +195,10 @@ export const EditorProvider = (props: { children: JSX.Element }) => { } } - const publishShoutById = async (shoutId: number) => { + const publishShoutById = async (shout_id: number) => { try { await apiClient.updateArticle({ - shoutId, + shout_id, publish: true, }) diff --git a/src/graphql/client/core.ts b/src/graphql/client/core.ts index 04e8acf6..54a39ed3 100644 --- a/src/graphql/client/core.ts +++ b/src/graphql/client/core.ts @@ -149,16 +149,16 @@ export const apiClient = { return response.data.create_shout.shout }, updateArticle: async ({ - shoutId, - shoutInput, + shout_id, + shout_input, publish, }: { - shoutId: number - shoutInput?: ShoutInput + shout_id: number + shout_input?: ShoutInput publish: boolean }): Promise => { const response = await apiClient.private - .mutation(updateArticle, { shoutId, shoutInput, publish }) + .mutation(updateArticle, { shout_id, shout_input, publish }) .toPromise() console.debug('[graphql.client.core] updateArticle:', response.data) return response.data.update_shout.shout diff --git a/src/graphql/mutation/core/article-update.ts b/src/graphql/mutation/core/article-update.ts index ca455bc5..24629b07 100644 --- a/src/graphql/mutation/core/article-update.ts +++ b/src/graphql/mutation/core/article-update.ts @@ -1,8 +1,8 @@ import { gql } from '@urql/core' export default gql` - mutation UpdateShoutMutation($shoutId: Int!, $shoutInput: ShoutInput, $publish: Boolean) { - update_shout(shout_id: $shoutId, shout_input: $shoutInput, publish: $publish) { + mutation UpdateShoutMutation($shout_id: Int!, $shout_input: ShoutInput, $publish: Boolean) { + update_shout(shout_id: $shout_id, shout_input: $shout_input, publish: $publish) { error shout { id From c158532cc1ce35e0ec6bedc3f7142380388970fa Mon Sep 17 00:00:00 2001 From: Untone Date: Sat, 3 Feb 2024 00:52:04 +0300 Subject: [PATCH 15/22] draft-remove-fix --- src/components/Views/DraftsView/DraftsView.tsx | 8 +++++--- src/context/editor.tsx | 6 +++--- src/stores/zine/articles.ts | 6 ++++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/components/Views/DraftsView/DraftsView.tsx b/src/components/Views/DraftsView/DraftsView.tsx index 1aed1a8e..16d977ec 100644 --- a/src/components/Views/DraftsView/DraftsView.tsx +++ b/src/components/Views/DraftsView/DraftsView.tsx @@ -22,8 +22,8 @@ export const DraftsView = () => { } } - createEffect(async () => { - if (isSessionLoaded()) await loadDrafts() + createEffect(() => { + if (isSessionLoaded()) loadDrafts() }) const { @@ -32,7 +32,9 @@ export const DraftsView = () => { const handleDraftDelete = async (shout: Shout) => { const result = deleteShout(shout.id) - if (result) await loadDrafts() + if (result) { + setDrafts((ddd) => ddd.filter((d) => d.id !== shout.id)) + } } const handleDraftPublish = (shout: Shout) => { diff --git a/src/context/editor.tsx b/src/context/editor.tsx index c630518d..824d9d78 100644 --- a/src/context/editor.tsx +++ b/src/context/editor.tsx @@ -9,7 +9,7 @@ import { apiClient } from '../graphql/client/core' import { Topic, TopicInput } from '../graphql/schema/core.gen' import { router, useRouter } from '../stores/router' import { slugify } from '../utils/slugify' - +import { addArticles } from '../stores/zine/articles' import { useLocalize } from './localize' import { useSnackbar } from './snackbar' @@ -197,11 +197,11 @@ export const EditorProvider = (props: { children: JSX.Element }) => { const publishShoutById = async (shout_id: number) => { try { - await apiClient.updateArticle({ + const newShout = await apiClient.updateArticle({ shout_id, publish: true, }) - + addArticles([newShout]) openPage(router, 'feed') } catch (error) { console.error('[publishShoutById]', error) diff --git a/src/stores/zine/articles.ts b/src/stores/zine/articles.ts index c126000d..6fdbea71 100644 --- a/src/stores/zine/articles.ts +++ b/src/stores/zine/articles.ts @@ -64,12 +64,14 @@ const topCommentedArticles = createLazyMemo(() => { }) // eslint-disable-next-line sonarjs/cognitive-complexity -const addArticles = (...args: Shout[][]) => { +export const addArticles = (...args: Shout[][]) => { const allArticles = args.flatMap((articles) => articles || []) const newArticleEntities = allArticles.reduce( (acc, article) => { - acc[article.slug] = article + if (!acc[article.slug]) { + acc[article.slug] = article + } return acc }, {} as { [articleSLug: string]: Shout }, From 920c6de8de9b753bcb140ad64ca23bd2325b1804 Mon Sep 17 00:00:00 2001 From: Untone Date: Sat, 3 Feb 2024 08:19:15 +0300 Subject: [PATCH 16/22] modal-fix --- src/components/Views/Edit.tsx | 6 +++++- src/components/Views/Feed/Feed.tsx | 6 +++++- src/components/Views/Inbox/Inbox.tsx | 5 ++++- src/components/_shared/InviteMembers/InviteMembers.tsx | 2 +- src/graphql/query/core/reactions-load-by.ts | 1 - 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/components/Views/Edit.tsx b/src/components/Views/Edit.tsx index e3779df8..9803ee78 100644 --- a/src/components/Views/Edit.tsx +++ b/src/components/Views/Edit.tsx @@ -26,6 +26,7 @@ import { TableOfContents } from '../TableOfContents' import { PublishSettings } from './PublishSettings' import styles from './Edit.module.scss' +import { Modal } from '../Nav/Modal' const SimplifiedEditor = lazy(() => import('../Editor/SimplifiedEditor')) const GrowingTextarea = lazy(() => import('../_shared/GrowingTextarea/GrowingTextarea')) @@ -413,7 +414,10 @@ export const EditView = (props: Props) => { - + + + + ) } diff --git a/src/components/Views/Feed/Feed.tsx b/src/components/Views/Feed/Feed.tsx index 07c46e50..84646e85 100644 --- a/src/components/Views/Feed/Feed.tsx +++ b/src/components/Views/Feed/Feed.tsx @@ -34,6 +34,7 @@ import { Sidebar } from '../../Feed/Sidebar' import styles from './Feed.module.scss' import stylesBeside from '../../Feed/Beside.module.scss' import stylesTopic from '../../Feed/CardTopic.module.scss' +import { Modal } from '../../Nav/Modal' export const FEED_PAGE_SIZE = 20 const UNRATED_ARTICLES_COUNT = 5 @@ -439,7 +440,10 @@ export const FeedView = (props: Props) => { shareUrl={getShareUrl({ pathname: `/${shareData().slug}` })} /> - + + + + ) } diff --git a/src/components/Views/Inbox/Inbox.tsx b/src/components/Views/Inbox/Inbox.tsx index 593df862..fd47e06d 100644 --- a/src/components/Views/Inbox/Inbox.tsx +++ b/src/components/Views/Inbox/Inbox.tsx @@ -21,6 +21,7 @@ import MessagesFallback from '../../Inbox/MessagesFallback' import Search from '../../Inbox/Search' import styles from './Inbox.module.scss' +import { Modal } from '../../Nav/Modal' type InboxSearchParams = { by?: string @@ -181,7 +182,9 @@ export const InboxView = (props: Props) => { return (
- + + + {/**/}
diff --git a/src/components/_shared/InviteMembers/InviteMembers.tsx b/src/components/_shared/InviteMembers/InviteMembers.tsx index a1563d0e..1d2aadef 100644 --- a/src/components/_shared/InviteMembers/InviteMembers.tsx +++ b/src/components/_shared/InviteMembers/InviteMembers.tsx @@ -8,7 +8,7 @@ import { Author } from '../../../graphql/schema/core.gen' import { hideModal } from '../../../stores/ui' import { useAuthorsStore } from '../../../stores/zine/authors' import { AuthorBadge } from '../../Author/AuthorBadge' -import { Modal } from '../../Nav/Modal' +// import { Modal } from '../../Nav/Modal' import { Button } from '../Button' import { DropdownSelect } from '../DropdownSelect' import { Loading } from '../Loading' diff --git a/src/graphql/query/core/reactions-load-by.ts b/src/graphql/query/core/reactions-load-by.ts index 02aff493..c0700f07 100644 --- a/src/graphql/query/core/reactions-load-by.ts +++ b/src/graphql/query/core/reactions-load-by.ts @@ -6,7 +6,6 @@ export default gql` id kind body - range reply_to shout { id From 44801d58ecbd31736131db31db30631eda83bd7a Mon Sep 17 00:00:00 2001 From: Untone Date: Sat, 3 Feb 2024 11:16:47 +0300 Subject: [PATCH 17/22] postfixes --- src/components/Author/AuthorBadge/AuthorBadge.tsx | 1 - src/components/Nav/AuthModal/ForgotPasswordForm.tsx | 1 - src/components/Nav/AuthModal/LoginForm.tsx | 3 +-- src/components/Views/Author/Author.tsx | 2 +- src/components/Views/Edit.tsx | 2 +- src/components/Views/Feed/Feed.tsx | 2 +- src/components/Views/Home.tsx | 3 +-- src/components/Views/Inbox/Inbox.tsx | 2 +- src/context/editor.tsx | 3 ++- 9 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/components/Author/AuthorBadge/AuthorBadge.tsx b/src/components/Author/AuthorBadge/AuthorBadge.tsx index a8456166..24e885e7 100644 --- a/src/components/Author/AuthorBadge/AuthorBadge.tsx +++ b/src/components/Author/AuthorBadge/AuthorBadge.tsx @@ -8,7 +8,6 @@ import { useMediaQuery } from '../../../context/mediaQuery' import { useSession } from '../../../context/session' import { Author, FollowingEntity } from '../../../graphql/schema/core.gen' import { router, useRouter } from '../../../stores/router' -import { resetSortedArticles } from '../../../stores/zine/articles' import { isCyrillic } from '../../../utils/cyrillic' import { translit } from '../../../utils/ru2en' import { Button } from '../../_shared/Button' diff --git a/src/components/Nav/AuthModal/ForgotPasswordForm.tsx b/src/components/Nav/AuthModal/ForgotPasswordForm.tsx index 493bd64a..01cc6187 100644 --- a/src/components/Nav/AuthModal/ForgotPasswordForm.tsx +++ b/src/components/Nav/AuthModal/ForgotPasswordForm.tsx @@ -1,6 +1,5 @@ import type { AuthModalSearchParams } from './types' -import { ApiResponse, ForgotPasswordResponse } from '@authorizerdev/authorizer-js' import { clsx } from 'clsx' import { createSignal, JSX, Show } from 'solid-js' diff --git a/src/components/Nav/AuthModal/LoginForm.tsx b/src/components/Nav/AuthModal/LoginForm.tsx index b4b54cda..c8c7bd5f 100644 --- a/src/components/Nav/AuthModal/LoginForm.tsx +++ b/src/components/Nav/AuthModal/LoginForm.tsx @@ -1,12 +1,11 @@ import type { AuthModalSearchParams } from './types' import { clsx } from 'clsx' -import { createEffect, createSignal, Show } from 'solid-js' +import { createSignal, Show } from 'solid-js' import { useLocalize } from '../../../context/localize' import { useSession } from '../../../context/session' import { useSnackbar } from '../../../context/snackbar' -import { ApiError } from '../../../graphql/error' import { useRouter } from '../../../stores/router' import { hideModal } from '../../../stores/ui' import { validateEmail } from '../../../utils/validateEmail' diff --git a/src/components/Views/Author/Author.tsx b/src/components/Views/Author/Author.tsx index 97b796f8..f299109a 100644 --- a/src/components/Views/Author/Author.tsx +++ b/src/components/Views/Author/Author.tsx @@ -3,7 +3,7 @@ import type { Author, Reaction, Shout, Topic } from '../../../graphql/schema/cor import { getPagePath } from '@nanostores/router' import { Meta } from '@solidjs/meta' import { clsx } from 'clsx' -import { Show, createMemo, createSignal, Switch, onMount, For, Match, createEffect, on } from 'solid-js' +import { Show, createMemo, createSignal, Switch, onMount, For, Match, createEffect } from 'solid-js' import { useFollowing } from '../../../context/following' import { useLocalize } from '../../../context/localize' diff --git a/src/components/Views/Edit.tsx b/src/components/Views/Edit.tsx index 9803ee78..f7ca7f4a 100644 --- a/src/components/Views/Edit.tsx +++ b/src/components/Views/Edit.tsx @@ -21,12 +21,12 @@ import { Editor, Panel } from '../Editor' import { AudioUploader } from '../Editor/AudioUploader' import { AutoSaveNotice } from '../Editor/AutoSaveNotice' import { VideoUploader } from '../Editor/VideoUploader' +import { Modal } from '../Nav/Modal' import { TableOfContents } from '../TableOfContents' import { PublishSettings } from './PublishSettings' import styles from './Edit.module.scss' -import { Modal } from '../Nav/Modal' const SimplifiedEditor = lazy(() => import('../Editor/SimplifiedEditor')) const GrowingTextarea = lazy(() => import('../_shared/GrowingTextarea/GrowingTextarea')) diff --git a/src/components/Views/Feed/Feed.tsx b/src/components/Views/Feed/Feed.tsx index 84646e85..bfd76067 100644 --- a/src/components/Views/Feed/Feed.tsx +++ b/src/components/Views/Feed/Feed.tsx @@ -30,11 +30,11 @@ import { AuthorBadge } from '../../Author/AuthorBadge' import { AuthorLink } from '../../Author/AuthorLink' import { ArticleCard } from '../../Feed/ArticleCard' import { Sidebar } from '../../Feed/Sidebar' +import { Modal } from '../../Nav/Modal' import styles from './Feed.module.scss' import stylesBeside from '../../Feed/Beside.module.scss' import stylesTopic from '../../Feed/CardTopic.module.scss' -import { Modal } from '../../Nav/Modal' export const FEED_PAGE_SIZE = 20 const UNRATED_ARTICLES_COUNT = 5 diff --git a/src/components/Views/Home.tsx b/src/components/Views/Home.tsx index 2f03cc0f..ac1d3b2b 100644 --- a/src/components/Views/Home.tsx +++ b/src/components/Views/Home.tsx @@ -1,7 +1,6 @@ import { getPagePath } from '@nanostores/router' -import { batch, createEffect, createMemo, createSignal, For, onMount, Show } from 'solid-js' +import { batch, createMemo, createSignal, For, onMount, Show } from 'solid-js' -import { useFollowing } from '../../context/following' import { useLocalize } from '../../context/localize' import { apiClient } from '../../graphql/client/core' import { Shout, Topic } from '../../graphql/schema/core.gen' diff --git a/src/components/Views/Inbox/Inbox.tsx b/src/components/Views/Inbox/Inbox.tsx index fd47e06d..4d8cd014 100644 --- a/src/components/Views/Inbox/Inbox.tsx +++ b/src/components/Views/Inbox/Inbox.tsx @@ -19,9 +19,9 @@ import DialogHeader from '../../Inbox/DialogHeader' import { Message } from '../../Inbox/Message' import MessagesFallback from '../../Inbox/MessagesFallback' import Search from '../../Inbox/Search' +import { Modal } from '../../Nav/Modal' import styles from './Inbox.module.scss' -import { Modal } from '../../Nav/Modal' type InboxSearchParams = { by?: string diff --git a/src/context/editor.tsx b/src/context/editor.tsx index 824d9d78..049a7e84 100644 --- a/src/context/editor.tsx +++ b/src/context/editor.tsx @@ -8,8 +8,9 @@ import { createStore, SetStoreFunction } from 'solid-js/store' import { apiClient } from '../graphql/client/core' import { Topic, TopicInput } from '../graphql/schema/core.gen' import { router, useRouter } from '../stores/router' -import { slugify } from '../utils/slugify' import { addArticles } from '../stores/zine/articles' +import { slugify } from '../utils/slugify' + import { useLocalize } from './localize' import { useSnackbar } from './snackbar' From b4c8b4a88282f100d8ceb1817b46fd01bc01b84b Mon Sep 17 00:00:00 2001 From: Untone Date: Sat, 3 Feb 2024 11:30:01 +0300 Subject: [PATCH 18/22] warning-tails-fix --- src/components/Nav/AuthModal/ForgotPasswordForm.tsx | 1 + src/components/Nav/SearchModal/SearchModal.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/src/components/Nav/AuthModal/ForgotPasswordForm.tsx b/src/components/Nav/AuthModal/ForgotPasswordForm.tsx index 01cc6187..babd8f8b 100644 --- a/src/components/Nav/AuthModal/ForgotPasswordForm.tsx +++ b/src/components/Nav/AuthModal/ForgotPasswordForm.tsx @@ -66,6 +66,7 @@ export const ForgotPasswordForm = () => { if (errors && errors.some((error) => error.message.includes('bad user credentials'))) { setIsUserNotFound(true) } + if (data.message) setMessage(data.message) } catch (error) { console.error(error) } finally { diff --git a/src/components/Nav/SearchModal/SearchModal.tsx b/src/components/Nav/SearchModal/SearchModal.tsx index 9fdb03df..64faaee7 100644 --- a/src/components/Nav/SearchModal/SearchModal.tsx +++ b/src/components/Nav/SearchModal/SearchModal.tsx @@ -55,6 +55,7 @@ export const SearchModal = () => { >( async () => { setIsLoading(true) + saveScrollPosition() const { hasMore, newShouts } = await loadShoutsSearch({ limit: FEED_PAGE_SIZE, text: inputValue(), From a02f24d862f3d4a157e7d631c2ae67a1c7f15b0b Mon Sep 17 00:00:00 2001 From: Untone Date: Sat, 3 Feb 2024 11:31:13 +0300 Subject: [PATCH 19/22] -- --- src/components/_shared/InviteMembers/InviteMembers.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/_shared/InviteMembers/InviteMembers.tsx b/src/components/_shared/InviteMembers/InviteMembers.tsx index 1d2aadef..75431db0 100644 --- a/src/components/_shared/InviteMembers/InviteMembers.tsx +++ b/src/components/_shared/InviteMembers/InviteMembers.tsx @@ -8,7 +8,6 @@ import { Author } from '../../../graphql/schema/core.gen' import { hideModal } from '../../../stores/ui' import { useAuthorsStore } from '../../../stores/zine/authors' import { AuthorBadge } from '../../Author/AuthorBadge' -// import { Modal } from '../../Nav/Modal' import { Button } from '../Button' import { DropdownSelect } from '../DropdownSelect' import { Loading } from '../Loading' From e3347bd9236de8ca49c312e5578c9d39518a5dde Mon Sep 17 00:00:00 2001 From: Untone Date: Sat, 3 Feb 2024 11:42:49 +0300 Subject: [PATCH 20/22] debug-comments-log --- src/components/Views/Author/Author.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Views/Author/Author.tsx b/src/components/Views/Author/Author.tsx index f299109a..8291b776 100644 --- a/src/components/Views/Author/Author.tsx +++ b/src/components/Views/Author/Author.tsx @@ -127,7 +127,7 @@ export const AuthorView = (props: Props) => { const data = await apiClient.getReactionsBy({ by: { comment: true, created_by: commenter.id }, }) - console.debug(`[components.Author] fetched ${data.length} comments`) + console.debug(`[components.Author] fetched comments`, data) setCommented(data) } From ebec141b77e8e2d1c1763ed46b01dc14e121f828 Mon Sep 17 00:00:00 2001 From: Untone Date: Sat, 3 Feb 2024 11:52:13 +0300 Subject: [PATCH 21/22] author-name-fix --- src/components/Views/Author/Author.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/Views/Author/Author.tsx b/src/components/Views/Author/Author.tsx index 8291b776..353d7da5 100644 --- a/src/components/Views/Author/Author.tsx +++ b/src/components/Views/Author/Author.tsx @@ -136,6 +136,7 @@ export const AuthorView = (props: Props) => { const a = author() if (a) { fetchComments(a) + document.title = a.name } }) From 62250ba239fe8564f256e6df65624c2d23bd28d4 Mon Sep 17 00:00:00 2001 From: Untone Date: Sat, 3 Feb 2024 11:58:10 +0300 Subject: [PATCH 22/22] expect-meta --- src/components/Views/Author/Author.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/Views/Author/Author.tsx b/src/components/Views/Author/Author.tsx index 353d7da5..8291b776 100644 --- a/src/components/Views/Author/Author.tsx +++ b/src/components/Views/Author/Author.tsx @@ -136,7 +136,6 @@ export const AuthorView = (props: Props) => { const a = author() if (a) { fetchComments(a) - document.title = a.name } })