Skip to content

Commit 0edc6a4

Browse files
authored
fix: followee permission error as moderator to follow and unfollow (#374)
* update * fix: update * update * update * fix: permission issue for moderator when following other user * fix: shift on user card when loading or empty * update
1 parent 980f5e6 commit 0edc6a4

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

apps/hasura/metadata/databases/masterbots/tables/public_social_following.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ insert_permissions:
1616
permission:
1717
check:
1818
_and:
19-
- followee_id:
20-
_eq: X-Hasura-User-Id
2119
- follower_id:
2220
_eq: X-Hasura-User-Id
21+
- followee_id:
22+
_neq: X-Hasura-User-Id
2323
columns:
2424
- followee_id
2525
- followee_id_chatbot
@@ -78,8 +78,11 @@ update_permissions:
7878
- followee_id_chatbot
7979
- follower_id
8080
filter:
81-
follower_id:
82-
_eq: X-Hasura-User-Id
81+
_and:
82+
- follower_id:
83+
_eq: X-Hasura-User-Id
84+
- followee_id:
85+
_neq: X-Hasura-User-Id
8386
check: null
8487
comment: ""
8588
- role: user

apps/masterbots.ai/components/routes/profile/user-card.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ export function UserCard({ user, loading }: UserCardProps) {
211211
})
212212
if (!success) {
213213
console.error('Failed to follow/Unfollow user:', error)
214-
customSonner({ type: 'error', text: error || 'Failed to follow/Unfollow user' })
214+
customSonner({ type: 'error', text: `Failed to process your request, try again!` })
215215
return
216216
}
217217

@@ -266,13 +266,13 @@ export function UserCard({ user, loading }: UserCardProps) {
266266

267267
return (
268268
<div className="bg-background relative rounded-lg w-full max-w-[600px] md:h-[320px] flex flex-col gap-1 mx-auto font-geist space-y-1">
269-
{loading || !user && (
270-
<div className="relative w-full h-full max-h-[330px] z-10">
269+
{loading && (
270+
<div className="relative w-full h-[300px] z-10">
271271
<ChatChatbotDetailsSkeleton />
272272
</div>
273273
)}
274274
{!user && !loading && <EmptyState />}
275-
{user && (
275+
{user && !loading &&(
276276
<>
277277
{/* Profile Name */}
278278
<div className="px-5 pb-2 pt-7 flex flex-col gap-2.5">

apps/masterbots.ai/components/shared/skeletons/chat-chatbot-details-skeleton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Skeleton } from "@/components/ui/skeleton"
22

33
export function ChatChatbotDetailsSkeleton() {
44
return (
5-
<div className="h-[calc(100vh-196px)] flex items-center justify-center -translate-y-8">
5+
<div className="flex items-center justify-center -translate-y-8">
66
<div className="dark:bg-[#09090B] bg-white w-[85%] md:w-[600px] rounded-xl text-white relative">
77
{/* Card Header */}
88
<div className="px-4 pt-4 md:px-6 md:pt-6">

0 commit comments

Comments
 (0)