CaptainFact / captain-fact

📚 Documentation, wiki and community discussions
https://captainfact.io
67 stars 7 forks source link

Show unread moderations entries count on sidebar #95

Closed Betree closed 3 years ago

Betree commented 5 years ago

image

steelstyle commented 4 years ago

How should this look like ? Just a plain number ?

Miragide commented 4 years ago

How should this look like ? Just a plain number ?

@steelstyle i suggest this:

steelstyle commented 3 years ago

Great, sorry for the late reply.

@Betree as I'm not sure what is the convention to transit such information in this app. Can you tell me if a vanilla rpc would be okay, of if there is another way you wrap this kind of data ? Would like to have an idea to know how much of an effort this is.

Betree commented 3 years ago

The moderation feature is unfortunately still plugged on the legacy REST endpoints.

The new way to communicate between frontend & API is through GraphQL. You can try it there: https://graphql.staging.captainfact.io/graphiql

Because there's no REST endpoint to get the total number of pending moderation items, I would recommend to implement it directly on GraphQL. Here's a suggestion on how that can be done:

On the frontend, you'll then be able to fetch this field with a useQuery (see Apollo's documentation)

Betree commented 3 years ago

Edit: just saw your PR @steelstyle, sounds like you found the solution by yourself :wink: I'll review now!

Miragide commented 3 years ago

Merci beaucoup @steelstyle @Betree ! Cela va énormément faciliter la vie des modérateurs :)