aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/components/Thread.js
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-08-29 17:47:52 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:53 +0300
commit1d5311af882fe51274160470381f6f5518beeb12 (patch)
treec32a90c07f51dc1810dfd68e7bd9e6bdb6a0fce2 /vnext/src/components/Thread.js
parent9542cb91f7298c8b708cd6bb92bccfe41ecca1f4 (diff)
shadow banned users from recommendations list
Diffstat (limited to 'vnext/src/components/Thread.js')
-rw-r--r--vnext/src/components/Thread.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/vnext/src/components/Thread.js b/vnext/src/components/Thread.js
index 23654d86..b0e73b40 100644
--- a/vnext/src/components/Thread.js
+++ b/vnext/src/components/Thread.js
@@ -86,7 +86,7 @@ export default class Thread extends React.Component {
msg.mid ? (
<Message data={msg} visitor={this.props.visitor}>
{this.state.active === (msg.rid || 0) && <MessageInput data={msg} onSend={this.postComment}>Write a comment...</MessageInput>}
- <Recommendations src={msg.recommendations || []} />
+ <Recommendations forMessage={msg} />
</Message>
) : (
<Spinner />
@@ -170,14 +170,18 @@ Thread.propTypes = {
visitor: UserType.isRequired
};
-function Recommendations({src, ...rest}) {
- return src.length > 0 && (
- <div className="msg-recomms">{`Recommended by (${src.length}): `}
+function Recommendations({forMessage, ...rest}) {
+ const { likes, recommendations } = forMessage;
+ return recommendations && recommendations.length > 0 && (
+ <div className="msg-recomms">{'Recommended by '}
{
- src.map(it => (
+ recommendations.map(it => (
<Link key={it} to={`/${it}/`}>{it}</Link>
)).reduce((prev, curr) => [prev, ', ', curr])
}
+ {
+ likes > recommendations.length && (<span>&nbsp;and {likes - recommendations.length} others</span>)
+ }
</div>
) || null;
}