# 일반 사용자의 리뷰를 렌더링하는 방법

**URL:** https://meta.discourse.org/t/how-to-render-the-reviews-for-common-user/324004
**Category:** Development
**Created:** [8월 29, 2024, 4:12오후 UTC](https://meta.discourse.org/t/how-to-render-the-reviews-for-common-user/324004 "2024-08-29T16:12:54Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Harshit\_Dave](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/harshit_dave/32/379059_2.png) [@Harshit\_Dave](https://meta.discourse.org/u/Harshit_Dave)
#### Post date: [8월 29, 2024, 4:12오후 UTC](https://meta.discourse.org/t/how-to-render-the-reviews-for-common-user/324004/1 "2024-08-29T16:12:54Z")

</div>

안녕하세요,

누구든 리뷰를 일반 사용자도 표시하는 방법을 알려주실 수 있나요?

플러그인 커스터마이징 작업을 하고 있습니다.

기본적으로, 일반 사용자와 관리자/모더레이터 모두 사이드바에 리뷰 링크를 표시하려고 합니다. 관리자/모더레이터의 경우 이미 표시되고 있으므로 아무것도 할 필요가 없지만, 일반 사용자에게도 표시하고, 일반 사용자는 대기 상태(pending status)인 주제만 보이도록 하고 싶습니다.

코드를 찾아보았는데 리뷰를 표시하는 데 사용되는 파일을 찾았습니다.  
[review-index.js](https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/routes/review-index.js) 와 [review-index.hbs](https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/templates/review-index.hbs) 입니다. 라우트 파일에서 [이 라인](https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/routes/review-index.js#L16) 에서 데이터를 가져오고 있는데, 쿼리를 어떻게 수정해야 대기 상태인 주제를 가져올 수 있는지 모르겠습니다.

아래 두 가지에 대해 조언을 주실 수 있나요?

1. 일반 사용자에게 사이드바에 리뷰 링크를 표시하는 방법?
2. 쿼리를 어떻게 수정해야 대기 상태인 주제만 가져올 수 있는지?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [8월 29, 2024, 4:41오후 UTC](https://meta.discourse.org/t/how-to-render-the-reviews-for-common-user/324004/2 "2024-08-29T16:41:13Z")

</div>

일반 사용자는 그 링크를 사용할 수 없죠?

첫 단계로 그 링크를 직렬화기에 추가하는 것이 적절할 것 같습니다.

---

<div class="post-metadata">

### Author: ![Harshit\_Dave](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/harshit_dave/32/379059_2.png) [@Harshit\_Dave](https://meta.discourse.org/u/Harshit_Dave)
#### Post date: [8월 30, 2024, 8:05오전 UTC](https://meta.discourse.org/t/how-to-render-the-reviews-for-common-user/324004/4 "2024-08-30T08:05:44Z")

</div>

@pfaffman 님, 메시지 감사합니다.

네, 일반 사용자는 리뷰 링크를 볼 수 없지만, 대기 중인 주제 목록을 표시하는 위치에 일반 사용자에게도 리뷰 링크를 표시하고 싶습니다.

시리얼라이저에 리뷰 링크를 추가하는 방법을 예제로 보여줄 수 있을까요?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [8월 30, 2024, 9:06오전 UTC](https://meta.discourse.org/t/how-to-render-the-reviews-for-common-user/324004/5 "2024-08-30T09:06:47Z")

</div>

여기서 또는 [github.org/discourse/all-the-plugins에서](http://github.org/discourse/all-the-plugins%EC%97%90%EC%84%9C) add-to-serializer를 검색하세요

---

<div class="post-metadata">

### Author: ![Harshit\_Dave](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/harshit_dave/32/379059_2.png) [@Harshit\_Dave](https://meta.discourse.org/u/Harshit_Dave)
#### Post date: [8월 30, 2024, 11:47오전 UTC](https://meta.discourse.org/t/how-to-render-the-reviews-for-common-user/324004/6 "2024-08-30T11:47:30Z")

</div>

안녕하세요, add\_to\_serializer를 찾아봤는데 코드가 루비로 작성되어 있어서 잘 이해가 되지 않습니다. 다만, 다음과 같은 것을 사용해야 한다는 것은 파악했습니다:

`add_to_serializer(:site, ...)`

하지만 두 번째 매개변수로 어떤 메서드를 사용해야 하는지 모르겠습니다.

사이드바에 리뷰 링크를 렌더링하려면 어떻게 해야 하는지 알려 주실 수 있을까요?

---

<div class="post-metadata">

### Author: ![Firepup650](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firepup650/32/465200_2.png) [@Firepup650](https://meta.discourse.org/u/Firepup650)
#### Post date: [8월 30, 2024, 12:59오후 UTC](https://meta.discourse.org/t/how-to-render-the-reviews-for-common-user/324004/7 "2024-08-30T12:59:50Z")

</div>

링크만 표시하고 싶다면 사이드바에 추가할 수 있습니다. 하지만 일반 사용자는 리뷰 페이지를 볼 수 없으므로, 해당 페이지가 정상적으로 작동하려면 플러그인을 만들어야 합니다.

---

<div class="post-metadata">

### Author: ![Harshit\_Dave](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/harshit_dave/32/379059_2.png) [@Harshit\_Dave](https://meta.discourse.org/u/Harshit_Dave)
#### Post date: [8월 30, 2024, 1:05오후 UTC](https://meta.discourse.org/t/how-to-render-the-reviews-for-common-user/324004/8 "2024-08-30T13:05:58Z")

</div>

플러그인을 작업 중인데 사이드바에 링크를 추가하는 방법을 모르겠어요.

---

<div class="post-metadata">

### Author: ![Harshit\_Dave](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/harshit_dave/32/379059_2.png) [@Harshit\_Dave](https://meta.discourse.org/u/Harshit_Dave)
#### Post date: [8월 30, 2024, 2:42오후 UTC](https://meta.discourse.org/t/how-to-render-the-reviews-for-common-user/324004/9 "2024-08-30T14:42:30Z")

</div>

현재 이 블로그에서 리뷰 링크에 대한 우회 방법을 찾았습니다. 필요할 때 누구나 사용할 수 있도록 여기에 공유합니다. 물론 제가 원했던 방식은 아니지만, 커뮤니티 섹션에 링크를 추가할 수는 있습니다. 저는 이 링크를 ‘더 보기’ 버튼 바로 위, 메인 커뮤니티 섹션에 표시하고 싶습니다.

> [@사이드바 버튼과 스크립트 연결](https://meta.discourse.org/t/link-sidebar-buttons-and-scripts/313541/5?u=harshit_dave):
>
> \<script type="text/discourse-plugin" version="0.8"\> api.addCommunitySectionLink({ name: "install", route: "/install", title: "install", text: "install", icon: "download" }); \</script\> I tried to add the above code to the sidebar’s view, but it did not work, so I wrote it in the format below, referring to the existing path. However, when the button appears and I press it, the script does not seem to work properly. Oddly enough, the script works when I pres…

---

<div class="post-metadata">

### Author: ![Harshit\_Dave](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/harshit_dave/32/379059_2.png) [@Harshit\_Dave](https://meta.discourse.org/u/Harshit_Dave)
#### Post date: [8월 30, 2024, 2:46오후 UTC](https://meta.discourse.org/t/how-to-render-the-reviews-for-common-user/324004/10 "2024-08-30T14:46:32Z")

</div>

일반 사용자에게 리뷰 페이지 보기 권한을 부여하는 방법에 대해 안내해 주실 수 있나요?

일반 사용자 프로필에서 리뷰 링크를 클릭하면, 일반 사용자에게 리뷰 페이지를 볼 수 있는 권한이 없어서 API 응답에서 **접근 거부(access denied)** 오류가 발생하고 있습니다.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [8월 30, 2024, 3:21오후 UTC](https://meta.discourse.org/t/how-to-render-the-reviews-for-common-user/324004/11 "2024-08-30T15:21:26Z")

</div>

> [@Harshit\_Dave](#):
>
> 누군가 일반 사용자에게 리뷰 페이지를 볼 수 있는 권한을 부여하는 방법을 알려주실 수 있나요?

그것이 제가 처음에 말씀드린 내용입니다. 일반 사용자는 модератор(모더레이터)가 아니기 때문에 리뷰 페이지를 볼 수 없습니다.

이를 위해서는 권한을 오버라이드(overriding)해야 합니다. 이는 다소 복잡한 변경 사항이며, 특히 Ruby에 익숙하지 않다면 더 그렇습니다.

무엇을 해야 하는지 대략적인 방향을 잡고 있는 사람에게는 1~3시간 정도 걸리는 작업이라고 생각합니다. 반면 Ruby나 Discourse 개발에 대해 잘 모르는 사람에게는 10~20시간 정도 걸릴 수 있다고 봅니다.
