Mirror of https://github.com/roostorg/coop github.com/roostorg/coop
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Show comments from deleted users on manual reviews (#407)

* fix comments from deleted users

* undo

* regenerate

* revert formatting changes

authored by

Dom Rettig and committed by
GitHub
93e30cc5 ea3fce08

+23 -17
+7 -7
client/src/graphql/generated.ts
··· 2066 2066 2067 2067 export type GQLManualReviewJobComment = { 2068 2068 readonly __typename: 'ManualReviewJobComment'; 2069 - readonly author: GQLUser; 2069 + readonly author?: Maybe<GQLUser>; 2070 2070 readonly commentText: Scalars['String']['output']; 2071 2071 readonly createdAt: Scalars['DateTime']['output']; 2072 2072 readonly id: Scalars['ID']['output']; ··· 16130 16130 readonly id: string; 16131 16131 readonly createdAt: Date | string; 16132 16132 readonly commentText: string; 16133 - readonly author: { 16133 + readonly author?: { 16134 16134 readonly __typename: 'User'; 16135 16135 readonly id: string; 16136 16136 readonly firstName: string; 16137 16137 readonly lastName: string; 16138 - }; 16138 + } | null; 16139 16139 }; 16140 16140 16141 16141 export type GQLGetCommentsForJobQueryVariables = Exact<{ ··· 16149 16149 readonly id: string; 16150 16150 readonly createdAt: Date | string; 16151 16151 readonly commentText: string; 16152 - readonly author: { 16152 + readonly author?: { 16153 16153 readonly __typename: 'User'; 16154 16154 readonly id: string; 16155 16155 readonly firstName: string; 16156 16156 readonly lastName: string; 16157 - }; 16157 + } | null; 16158 16158 }>; 16159 16159 }; 16160 16160 ··· 16172 16172 readonly id: string; 16173 16173 readonly createdAt: Date | string; 16174 16174 readonly commentText: string; 16175 - readonly author: { 16175 + readonly author?: { 16176 16176 readonly __typename: 'User'; 16177 16177 readonly id: string; 16178 16178 readonly firstName: string; 16179 16179 readonly lastName: string; 16180 - }; 16180 + } | null; 16181 16181 }; 16182 16182 } 16183 16183 | { readonly __typename: 'NotFoundError'; readonly title: string };
+5 -3
client/src/webpages/dashboard/mrt/manual_review_job/v2/ManualReviewJobCommentSection.tsx
··· 62 62 63 63 type ManualReviewJobCommentData = { 64 64 id: string; 65 - author: { id: string; firstName: string; lastName: string }; 65 + author?: { id: string; firstName: string; lastName: string } | null; 66 66 createdAt: Date | string; 67 67 commentText: string; 68 68 }; ··· 90 90 isBeingDeleted ? 'text-gray-400' : 'text-gray-900' 91 91 }`} 92 92 > 93 - {comment.author.firstName} {comment.author.lastName} 93 + {comment.author 94 + ? `${comment.author.firstName} ${comment.author.lastName}` 95 + : 'Deleted User'} 94 96 </div> 95 97 <div 96 98 className={`text-sm font-normal ${ ··· 108 110 {comment.commentText} 109 111 </div> 110 112 </div> 111 - {currentUserId === comment.author.id && ( 113 + {currentUserId === comment.author?.id && ( 112 114 <Button 113 115 className="self-start w-6 h-6 text-red-600 border-none" 114 116 icon={<DeleteOutlined className="text-xs" />}
+2 -2
server/graphql/generated.ts
··· 2131 2131 2132 2132 export type GQLManualReviewJobComment = { 2133 2133 readonly __typename?: 'ManualReviewJobComment'; 2134 - readonly author: GQLUser; 2134 + readonly author?: Maybe<GQLUser>; 2135 2135 readonly commentText: Scalars['String']['output']; 2136 2136 readonly createdAt: Scalars['DateTime']['output']; 2137 2137 readonly id: Scalars['ID']['output']; ··· 9860 9860 ParentType extends GQLResolversParentTypes['ManualReviewJobComment'] = 9861 9861 GQLResolversParentTypes['ManualReviewJobComment'], 9862 9862 > = { 9863 - author?: Resolver<GQLResolversTypes['User'], ParentType, ContextType>; 9863 + author?: Resolver<Maybe<GQLResolversTypes['User']>, ParentType, ContextType>; 9864 9864 commentText?: Resolver<GQLResolversTypes['String'], ParentType, ContextType>; 9865 9865 createdAt?: Resolver<GQLResolversTypes['DateTime'], ParentType, ContextType>; 9866 9866 id?: Resolver<GQLResolversTypes['ID'], ParentType, ContextType>;
+9 -5
server/graphql/modules/manualReviewTool.ts
··· 828 828 829 829 type ManualReviewJobComment { 830 830 id: ID! 831 - author: User! 831 + author: User 832 832 commentText: String! 833 833 createdAt: DateTime! 834 834 } ··· 1703 1703 throw new Error('No user found on context'); 1704 1704 } 1705 1705 1706 - return context.dataSources.userAPI.getGraphQLUserFromId({ 1707 - id: comment.authorId, 1708 - orgId: user.orgId, 1709 - }); 1706 + try { 1707 + return await context.dataSources.userAPI.getGraphQLUserFromId({ 1708 + id: comment.authorId, 1709 + orgId: user.orgId, 1710 + }); 1711 + } catch { 1712 + return null; 1713 + } 1710 1714 }, 1711 1715 }; 1712 1716