Skip to content

Commit 887c023

Browse files
committed
Handle optional avatarlUrl
1 parent 2b5f005 commit 887c023

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

app/lib/feed-item.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ export function FeedItem(props: {
187187
<a className="text-gray-400 hover:text-green-400 mr-3 inline-flex items-center text-sm pr-3 py-1 border-r-2 border-gray-200">
188188
<img
189189
className="inline-block h-4 w-4 rounded-full w-4 h-4 mr-1"
190-
src={props.post.profile?.avatarUrl}
190+
src={props.post.profile?.avatarUrl ?? ""}
191191
/>
192192
{props.post.profile?.username}
193193
</a>

app/pages/profile/[profileId].tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const Profile: NextPage = () => {
9494
</span>{" "}
9595
<img
9696
className="inline-block h-6 w-6 rounded-full"
97-
src={profile.avatarUrl}
97+
src={profile.avatarUrl ?? ""}
9898
/>
9999
</div>
100100
<div>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
schemaname,tablename,policyname,permissive,roles,cmd,qual,with_check
2+
public,Profile,Public profiles are viewable by everyone.,PERMISSIVE,{public},SELECT,true,
3+
public,Profile,Users can insert their own profile.,PERMISSIVE,{public},INSERT,,(auth.uid() = id)
4+
public,Profile,Users can update own profile.,PERMISSIVE,{public},UPDATE,(auth.uid() = id),
5+
storage,objects,Avatar images are publicly accessible.,PERMISSIVE,{public},SELECT,"(bucket_id = 'avatars'::text)",
6+
storage,objects,Anyone can upload an avatar.,PERMISSIVE,{public},INSERT,,"(bucket_id = 'avatars'::text)"
7+
storage,objects,Anyone can update an avatar.,PERMISSIVE,{public},UPDATE,,"(bucket_id = 'avatars'::text)"
8+
public,Post,All users can view posts,PERMISSIVE,{public},SELECT,true,
9+
public,Post,Only authenticated users can create posts,PERMISSIVE,{public},INSERT,,"(auth.role() = 'authenticated'::text)"
10+
public,Post,Users can delete their own posts,PERMISSIVE,{public},DELETE,"(auth.uid() = ""profileId"")",
11+
public,Post,Users can edit their own posts,PERMISSIVE,{public},UPDATE,"(auth.uid() = ""profileId"")","(auth.uid() = ""profileId"")"
12+
public,Comment,Everyone can view comments,PERMISSIVE,{public},SELECT,true,
13+
public,Comment,Only authenticated users can comment,PERMISSIVE,{public},INSERT,,"(auth.role() = 'authenticated'::text)"
14+
public,Comment,User can edit their own comments,PERMISSIVE,{public},UPDATE,"(auth.uid() = ""profileId"")","(auth.uid() = ""profileId"")"
15+
public,Comment,Users can delete their own comments,PERMISSIVE,{public},DELETE,"(auth.uid() = ""profileId"")",
16+
public,Vote,Everyone can view votes,PERMISSIVE,{public},SELECT,true,
17+
public,Vote,Only authenticated users can vote,PERMISSIVE,{public},INSERT,,"(auth.role() = 'authenticated'::text)"
18+
public,Vote,Users can change their vote,PERMISSIVE,{public},UPDATE,"(auth.uid() = ""profileId"")","(auth.uid() = ""profileId"")"
19+
public,Vote,Users can delete their own votes,PERMISSIVE,{public},DELETE,"(auth.uid() = ""profileId"")",

0 commit comments

Comments
 (0)