Skip to content

feat: 커뮤니티 회원 전용으로 전환#466

Merged
manNomi merged 1 commit intomainfrom
feature/community-members-only
Mar 11, 2026
Merged

feat: 커뮤니티 회원 전용으로 전환#466
manNomi merged 1 commit intomainfrom
feature/community-members-only

Conversation

@wibaek
Copy link
Member

@wibaek wibaek commented Mar 10, 2026

작업 내용

  • 커뮤니티 전체 경로를 회원 전용으로 전환했습니다.
  • 비로그인 사용자가 /community 및 하위 경로에 접근하면 로그인 페이지로 리다이렉트되도록 변경했습니다.
  • 커뮤니티 접근 차단으로 로그인 페이지에 진입한 경우, 커뮤니티는 회원 전용입니다. 로그인 후 이용해주세요. 안내 토스트가 1회 표시되도록 추가했습니다.
  • 인증 문서를 현재 동작 기준으로 정리해 커뮤니티 전체 보호 정책과 로그인 안내 방식을 반영했습니다.

특이 사항

  • 로그인 성공 후 이동 경로는 기존과 동일하게 /를 유지합니다.
  • 커뮤니티 회원 전용 보호는 NEXT_PUBLIC_COOKIE_LOGIN_ENABLED=true일 때만 미들웨어에서 동작합니다.
  • 백엔드 권한 정책은 이번 변경 범위에 포함되지 않았고, 프론트 라우트 접근 제어 기준으로 적용했습니다.

@wibaek wibaek self-assigned this Mar 10, 2026
@github-actions github-actions bot added the web label Mar 10, 2026
@vercel
Copy link

vercel bot commented Mar 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
solid-connection-web Ready Ready Preview, Comment Mar 10, 2026 4:56pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
solid-connect-web-admin Skipped Skipped Mar 10, 2026 4:56pm

@coderabbitai
Copy link

coderabbitai bot commented Mar 10, 2026

Walkthrough

이 변경사항은 커뮤니티 페이지를 인증된 경로로 추가하고 관련된 인증 흐름을 재구성합니다. 미들웨어에서 "/community" 경로를 로그인 필수 페이지 목록에 포함시키고, 커뮤니티 경로로의 리다이렉트 시 고정된 reason 매개변수(community-members-only)를 설정합니다. LoginContent 컴포넌트는 이 reason 매개변수를 감지하여 한 번의 토스트 메시지를 표시한 후 현재 경로로 리다이렉트합니다. 로그인 후 최종 목적지는 원래 URL 대신 항상 "/"로 변경되었습니다.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes


상세 변경 사항

  1. 문서화 및 아키텍처 정의

    • AUTHENTICATION.md에서 보호된 페이지 목록에 "/community" 추가
    • 커뮤니티 경로에 대한 리다이렉트 로직 및 이유 매개변수 명시
  2. 미들웨어 기능 확장

    • 로그인이 필요한 페이지 배열에 "/community" 포함
    • 특수 경로 검사 로직(isCommunitySubRoute) 제거로 코드 단순화
    • "/community" 경로와 그 하위 경로에 대해서만 reason 매개변수 설정
  3. 클라이언트 측 토스트 처리

    • usePathname, useSearchParams 훅을 활용한 URL 모니터링
    • reason=community-members-only 감지 시 토스트 표시
    • useRef를 사용한 중복 토스트 방지 메커니즘 구현
  4. 로그인 후 리다이렉트 동작 변경

    • 원래 대상 URL로의 복귀에서 고정 경로("/")로의 리다이렉트로 변경
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 변경의 주요 내용인 '커뮤니티 회원 전용 전환'을 명확하게 요약하고 있습니다.
Description check ✅ Passed PR 설명이 필수 섹션(작업 내용, 특이 사항)을 포함하고 있으며, 변경 사항과 영향 범위를 충분히 기술하고 있습니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/community-members-only

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@wibaek
Copy link
Member Author

wibaek commented Mar 10, 2026

@codex

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
apps/web/AUTHENTICATION.md (1)

51-60: 1. 코드 예시와 실제 구현 불일치

문서의 코드 예시가 실제 구현과 약간 다릅니다. 실제 LoginContent.tsx에서는 hasShownCommunityOnlyToast ref를 사용하여 토스트 중복 표시를 방지하는데, 문서에는 이 가드가 생략되어 있습니다.

문서의 목적이 개략적인 흐름 설명이라면 현재 상태도 괜찮지만, 정확한 구현을 반영하려면 ref 가드도 포함하는 것이 좋습니다.

📝 더 정확한 코드 예시 제안
 ```typescript
 // apps/web/src/app/login/LoginContent.tsx
+const hasShownCommunityOnlyToast = useRef(false);
+
 useEffect(() => {
   const reason = searchParams.get("reason");
-  if (reason === "community-members-only") {
+  if (reason === "community-members-only" && !hasShownCommunityOnlyToast.current) {
+    hasShownCommunityOnlyToast.current = true;
     toast.info("커뮤니티는 회원 전용입니다. 로그인 후 이용해주세요.");
     router.replace(pathname);
   }
 }, [pathname, router, searchParams]);
 ```
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/AUTHENTICATION.md` around lines 51 - 60, Update the example in
LoginContent.tsx to match the real implementation by adding the
hasShownCommunityOnlyToast ref guard: declare hasShownCommunityOnlyToast
(useRef(false)) above the useEffect, and inside the useEffect check reason ===
"community-members-only" && !hasShownCommunityOnlyToast.current, set
hasShownCommunityOnlyToast.current = true before calling toast.info and
router.replace(pathname) so the toast is shown only once; keep the rest of the
logic using searchParams, toast.info, router.replace, and pathname unchanged.
apps/web/src/app/login/LoginContent.tsx (1)

24-24: 1. 상수 중복 정의 문제

COMMUNITY_LOGIN_REASON 상수가 middleware.tsLoginContent.tsx 두 파일에서 각각 독립적으로 정의되어 있습니다. 한 파일에서 값이 변경되면 다른 파일과의 동기화가 깨질 수 있어 유지보수 위험이 있습니다.

공유 상수 파일로 추출하는 것을 권장드립니다:

  • 예: apps/web/src/constants/auth.ts에 정의 후 양쪽에서 import
♻️ 공유 상수 파일 생성 제안

새 파일 apps/web/src/constants/auth.ts 생성:

export const COMMUNITY_LOGIN_REASON = "community-members-only";

그 후 양쪽 파일에서 import:

-const COMMUNITY_LOGIN_REASON = "community-members-only";
+import { COMMUNITY_LOGIN_REASON } from "@/constants/auth";
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/src/app/login/LoginContent.tsx` at line 24, COMMUNITY_LOGIN_REASON
is defined in both LoginContent.tsx and middleware.ts causing duplication;
extract it into a single shared constant (e.g., create a new constant file like
constants/auth.ts exporting COMMUNITY_LOGIN_REASON) and update both
LoginContent.tsx and middleware.ts to import COMMUNITY_LOGIN_REASON from that
module so both files reference the same source of truth.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@apps/web/AUTHENTICATION.md`:
- Around line 51-60: Update the example in LoginContent.tsx to match the real
implementation by adding the hasShownCommunityOnlyToast ref guard: declare
hasShownCommunityOnlyToast (useRef(false)) above the useEffect, and inside the
useEffect check reason === "community-members-only" &&
!hasShownCommunityOnlyToast.current, set hasShownCommunityOnlyToast.current =
true before calling toast.info and router.replace(pathname) so the toast is
shown only once; keep the rest of the logic using searchParams, toast.info,
router.replace, and pathname unchanged.

In `@apps/web/src/app/login/LoginContent.tsx`:
- Line 24: COMMUNITY_LOGIN_REASON is defined in both LoginContent.tsx and
middleware.ts causing duplication; extract it into a single shared constant
(e.g., create a new constant file like constants/auth.ts exporting
COMMUNITY_LOGIN_REASON) and update both LoginContent.tsx and middleware.ts to
import COMMUNITY_LOGIN_REASON from that module so both files reference the same
source of truth.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 94e49dcc-56a9-4336-9bb6-5da96a05c351

📥 Commits

Reviewing files that changed from the base of the PR and between 422b45c and 5ef8461.

📒 Files selected for processing (3)
  • apps/web/AUTHENTICATION.md
  • apps/web/src/app/login/LoginContent.tsx
  • apps/web/src/middleware.ts

@manNomi manNomi merged commit 57b1a1a into main Mar 11, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants