feat(phase5): inline review comments, credentials write, deploy keys, org create, profile edit
- inline (line-level) review comments: list per review + reply API/hook, rendered under each review on the PR detail screen - credentials: SSH key/GPG key/token create+delete endpoints and hooks; deploy keys (repo keys) management screen - user profile edit (GET/PATCH /user/settings) screen - organization creation screen; wired into Settings and Organizations - endpoints.test.ts extended to 120 tests
This commit is contained in:
1 parent
6d0b536009
commit
b810292b1f
6 files changed
+164
No files matched your search
@@ -35,7 +35,9 @@ import {
|
||||
listRepoIssues,
|
||||
listRepoLabels,
|
||||
listPulls,
|
||||
listReviewComments,
|
||||
mergePull,
|
||||
replyToReviewComment,
|
||||
searchIssues,
|
||||
updateIssue,
|
||||
updateIssueComment,
|
||||
@@ -56,6 +58,7 @@ import type {
|
||||
Milestone,
|
||||
PullRequest,
|
||||
PullReview,
|
||||
PullReviewComment,
|
||||
User,
|
||||
} from '@/core/api/types';
|
||||
import { useSession } from '@/features/accounts/use-session';
|
||||
@@ -392,6 +395,38 @@ export function usePullReviews(owner: string, name: string, index: number) {
|
||||
});
|
||||
}
|
||||
|
||||
export function useReviewComments(
|
||||
owner: string,
|
||||
name: string,
|
||||
index: number,
|
||||
reviewId: number,
|
||||
enabled = true,
|
||||
) {
|
||||
const { client, account } = useSession();
|
||||
const accountId = account?.id ?? '';
|
||||
|
||||
return useQuery<PullReviewComment[]>({
|
||||
queryKey: queryKeys.pullReviewComments(accountId, owner, name, index, reviewId),
|
||||
enabled: Boolean(client) && Boolean(accountId) && enabled && reviewId > 0,
|
||||
queryFn: ({ signal }) => listReviewComments(client!, owner, name, index, reviewId, { signal }),
|
||||
staleTime: 60_000,
|
||||
});
|
||||
}
|
||||
|
||||
export function useReplyReviewComment(owner: string, name: string, index: number) {
|
||||
const { client, account } = useSession();
|
||||
const queryClient = useQueryClient();
|
||||
const accountId = account?.id ?? '';
|
||||
|
||||
return useMutation({
|
||||
mutationFn: ({ commentId, body }: { commentId: number; body: string }) =>
|
||||
replyToReviewComment(client!, owner, name, index, commentId, body),
|
||||
onSuccess: () => {
|
||||
void queryClient.invalidateQueries({ queryKey: queryKeys.pull(accountId, owner, name, index) });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useCreatePullReview(owner: string, name: string, index: number) {
|
||||
const { client, account } = useSession();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useTranslation } from 'react-i18next';
|
||||
import { CommentItem } from '@/components/git/comment';
|
||||
import { CommentComposer } from '@/components/git/comment-composer';
|
||||
import { Markdown } from '@/components/git/markdown';
|
||||
import { ReviewComments } from '@/components/git/review-comments';
|
||||
import { StatusChecks } from '@/components/git/status-checks';
|
||||
import { Screen } from '@/components/layout/screen';
|
||||
import { AppText } from '@/components/ui/app-text';
|
||||
@@ -272,6 +273,15 @@ export function PullDetailScreen({ navigation, route }: Props) {
|
||||
{review.body && review.body.trim().length > 0 ? (
|
||||
<Markdown content={review.body} baseUrl={instance?.baseUrl} />
|
||||
) : null}
|
||||
{review.id && (review.comments_count ?? 0) > 0 ? (
|
||||
<ReviewComments
|
||||
owner={owner}
|
||||
name={name}
|
||||
index={index}
|
||||
reviewId={review.id}
|
||||
baseUrl={instance?.baseUrl}
|
||||
/>
|
||||
) : null}
|
||||
</Card>
|
||||
))}
|
||||
</>
|
||||
|
||||
Reference in new issue
Block a user