Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/models/usersCommunities.js
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ export const getUsersTotalReputation = (userIds: Array<string>): Promise<Array<n
.getAll(...userIds.map(userId => ([userId, true])), { index: 'userIdAndIsMember' })
.group('userId')
.map(rec => rec('reputation'))
.count()
.reduce((l, r) => l.add(r))
.default(0)
.run()
.then(res =>
Expand Down
6 changes: 3 additions & 3 deletions src/components/reputation/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// @flow
import * as React from 'react';
import { connect } from 'react-redux';
import { openModal } from '../../actions/modals';
import { truncateNumber } from '../../helpers/utils';
import Icon from '../icons';
import { openModal } from 'src/actions/modals';
import { truncateNumber } from 'src/helpers/utils';
import Icon from 'src/components/icons';
import { ReputationWrapper, ReputationLabel } from './style';
import type { Dispatch } from 'redux';

Expand Down
13 changes: 8 additions & 5 deletions src/views/navbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import NotificationsTab from './components/notificationsTab';
import Head from 'src/components/head';
import { withCurrentUser } from 'src/components/withCurrentUser';
import type { GetUserType } from 'shared/graphql/queries/user/getUser';
import { truncateNumber } from 'src/helpers/utils';
import {
Nav,
Logo,
Expand Down Expand Up @@ -233,11 +234,13 @@ class Navbar extends React.Component<Props, State> {
to={currentUser ? `/users/${currentUser.username}` : '/'}
onClick={() => this.trackNavigationClick('profile')}
>
{currentUser && (
<Reputation>
<Icon glyph="rep" /> {currentUser.totalReputation}
</Reputation>
)}
{currentUser &&
typeof currentUser.totalReputation === 'number' && (
<Reputation>
<Icon glyph="rep" />{' '}
{truncateNumber(parseInt(currentUser.totalReputation), 1)}
</Reputation>
)}
<Navatar
style={{ gridArea: 'label' }}
user={currentUser}
Expand Down