From e16265a0c314aea7bd1fe62b68e79d488ae2de20 Mon Sep 17 00:00:00 2001 From: tonyrewin Date: Tue, 4 Oct 2022 02:43:08 +0300 Subject: [PATCH] fixes-inbox-topics-authors --- resolvers/inbox.py | 2 +- resolvers/zine.py | 2 ++ schema.graphql | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/resolvers/inbox.py b/resolvers/inbox.py index 2b2f2200..164b7793 100644 --- a/resolvers/inbox.py +++ b/resolvers/inbox.py @@ -74,7 +74,7 @@ async def add_user_to_chat(user_slug, chat_id, chat=None): await redis.execute("SET", f"chats/{chat_id}", json.dumps(chat)) -@mutation.query("inviteChat") +@mutation.field("inviteChat") async def invite_to_chat(_, info, invited, chat_id): user = info.context["request"].user chat = await redis.execute("GET", f"chats/{chat_id}") diff --git a/resolvers/zine.py b/resolvers/zine.py index 06d986ff..9ac1ac8a 100644 --- a/resolvers/zine.py +++ b/resolvers/zine.py @@ -130,6 +130,7 @@ async def shouts_by_authors(_, _info, slugs, offset, limit): for a in s.authors: a.caption = await ShoutAuthorStorage.get_author_caption(s.slug, a.slug) shouts_prepared.append(s) + shouts_prepared = list(set(shouts_prepared)) shouts_prepared.sort(key=lambda s: s.publishedAt, reverse=True) return shouts_prepared[offset : offset + limit] @@ -146,6 +147,7 @@ async def shouts_by_topics(_, _info, slugs, offset, limit): for a in s.authors: a.caption = await ShoutAuthorStorage.get_author_caption(s.slug, a.slug) shouts_prepared.append(s) + shouts_prepared = list(set(shouts_prepared)) shouts_prepared.sort(key=lambda s: s.publishedAt, reverse=True) return shouts_prepared[offset : offset + limit] diff --git a/schema.graphql b/schema.graphql index 584e8795..858b0331 100644 --- a/schema.graphql +++ b/schema.graphql @@ -146,6 +146,7 @@ enum FollowingEntity { type Mutation { # inbox createChat(description: String): CreateChatResult! + inviteChat(chatId: String!, userslug: String!): Result! createMessage(chatId: String!, body: String!, replyTo: Int): MessageResult! updateMessage(chatId: String!, id: Int!, body: String!): MessageResult! deleteMessage(chatId: String!, id: Int!): Result! @@ -210,7 +211,6 @@ type Query { myChats: [ChatResult]! enterChat(chatId: String!): ChatResult! loadChat(chatId: String!, size: Int!, page: Int!): [Message]! - inviteChat(chatId: String!, userslug: String!): Result! # auth isEmailUsed(email: String!): Boolean! @@ -503,7 +503,7 @@ type Chat { createdAt: DateTime! createdBy: User! updatedAt: DateTime! - title: string + title: String description: String users: [User]! messages: [Message]