diff --git a/src/containers/PostsContainer.jsx b/src/containers/PostsContainer.jsx index 0efdc0c551a718013579cedbddf6daff544357df..25d968abd4b4c37682b4640b0e18ac3ddedce22c 100644 --- a/src/containers/PostsContainer.jsx +++ b/src/containers/PostsContainer.jsx @@ -146,6 +146,14 @@ const PostsContainer = ({ className }) => { const sliceStart = (window.page - 1) * window.perPage; const sliceEnd = window.page * window.perPage; + let windowItems = window.items.map((postId) => items[postId]); + + // Only display proposals verified by chairman to other users. + if (!user || user.role !== "chairman") { + windowItems = windowItems.filter( + (item) => item.type === "post" || item.state !== "pending" + ); + } return ( <> @@ -155,9 +163,7 @@ const PostsContainer = ({ className }) => { </ErrorMessage> )} <PostList - items={window.items - .slice(sliceStart, sliceEnd) - .map((postId) => items[postId])} + items={windowItems.slice(sliceStart, sliceEnd)} canThumb={isAuthenticated} canRunActions={isAuthenticated && user.role === "chairman"} onLike={like.run}