How to render the reviews for common user

Hello,

Can anyone help me figure out how can I display review to common user too!

I am working on customization in plugin,

Basically, I want to display the review link in sidebar for the common user as well as admins/ moderators. So, for admins/moderator I don’t need to do anything as it is displaying for these users. But, I want to display it for common user and, common user should only see the topics which are in pending status.

I tried looking in the code and found a file which is resposible to display the reviews.
review-index.js and review-index.hbs. In route file, this line is fetching data, I don’t know how to modify the query so I can fetch the topics with status pending.

If someone guide me for these two things:

  1. how to display the review link in sidebar for the common user?
  2. how can I modify the query so that I can only fetch the topics which is in pending status.

Regular users can’t use those links, can they?

I would think that the first step would be to add those links to the serializer.

1 Like

Thanks for the message @pfaffman,

Yes, regular users can not see the review link but I want to display the review link to normal user where I want to list pending topics.

can you please show me an example how can I add the review link in serializer?

Search add-to-serializer here or in the GitHub - discourse/all-the-plugins

2 Likes

Hi, I tried looking into add_to_serializer but the code is in ruby. which I don’t understand much. Though I have figured out that I have to use something like this:

add_to_serializer(:site, ...) but I don’t know which method to use in second param.

can you please guide me what should I do to render review link in sidebar?

If you just want to show the link, you could add to sidebar. However, you’d have to make a plug-in for the page to work for them because regular users are not allowed to see the review page.

1 Like

I am working on plugin but I dont’ know how can I add link in sidebar.

I found work around at the moment in this blog about the review links, adding it over here so anyone can use it in future when needed. Though, it is not what I wanted but atleast I am able to add link in community section. I want to display it in main community section just above the more button.

Can anyone guide me how can I assign permission to common user to view the review page?

When I click on review link in common user profile. I am getting an error of access denied in api response may be because regular user does have access to view the review page.

That’s the first thing I told you. Users can’t see the review page since they aren’t moderators.

You’ll need to override the permissions to do that. That’s a more complicated change, especially if you’re daunted by ruby.

I think it’s a 1-3 hour job for someone who has a pretty good idea what to do. I think it’s a 10-20 hour job for someone who doesn’t know ruby or discourse development.

1 Like