Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Commit f752fe9

Browse files
authored
Merge pull request #4327 from withspectrum/2.4.75
2.4.75
2 parents 1941778 + 4ede2f3 commit f752fe9

File tree

8 files changed

+16
-176
lines changed

8 files changed

+16
-176
lines changed

api/models/usersCommunities.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ export const getUsersTotalReputation = (userIds: Array<string>): Promise<Array<n
693693
.getAll(...userIds.map(userId => ([userId, true])), { index: 'userIdAndIsMember' })
694694
.group('userId')
695695
.map(rec => rec('reputation'))
696-
.count()
696+
.reduce((l, r) => l.add(r))
697697
.default(0)
698698
.run()
699699
.then(res =>

hyperion/renderer/browser-shim.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@ global.navigator = {
2020
global.CSS = {
2121
escape: require('css.escape'),
2222
};
23-
global.IS_SERVER = true;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Spectrum",
3-
"version": "2.4.74",
3+
"version": "2.4.75",
44
"license": "BSD-3-Clause",
55
"devDependencies": {
66
"@babel/preset-flow": "^7.0.0",

src/components/reputation/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// @flow
22
import * as React from 'react';
33
import { connect } from 'react-redux';
4-
import { openModal } from '../../actions/modals';
5-
import { truncateNumber } from '../../helpers/utils';
6-
import Icon from '../icons';
4+
import { openModal } from 'src/actions/modals';
5+
import { truncateNumber } from 'src/helpers/utils';
6+
import Icon from 'src/components/icons';
77
import { ReputationWrapper, ReputationLabel } from './style';
88
import type { Dispatch } from 'redux';
99

src/helpers/p-queue.js

Lines changed: 0 additions & 101 deletions
This file was deleted.

src/routes.js

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// @flow
22
import * as React from 'react';
33
import compose from 'recompose/compose';
4-
import PromiseQueue from './helpers/p-queue';
54
import { Route, Switch, Redirect } from 'react-router';
65
import styled, { ThemeProvider } from 'styled-components';
76
import Loadable from 'react-loadable';
@@ -154,47 +153,6 @@ const ComposerFallback = signedOutFallback(Composer, () => (
154153
<Login redirectPath={`${CLIENT_URL}/new/thread`} />
155154
));
156155

157-
// On the client, preload the important routes when browser is idle and users has been using the app
158-
// for > 5s (i.e. all the data should hopefully have been loaded)
159-
if (!global || global.IS_SERVER !== true) {
160-
const preload = [
161-
FullscreenThreadView,
162-
CommunityView,
163-
CommunityLoginView,
164-
UserView,
165-
ChannelView,
166-
Dashboard,
167-
Notifications,
168-
];
169-
170-
requestAnimationFrame(() => {
171-
// Fallback to setTimeout for older browsers with no requestIdleCallback support
172-
const idle = window.requestIdleCallback || window.setTimeout;
173-
const queue = new PromiseQueue({
174-
concurrency: 2,
175-
});
176-
idle(() => {
177-
// Wait 5 seconds to make sure the data has loaded
178-
setTimeout(() => {
179-
preload.forEach(bundle => {
180-
queue
181-
.add(() => {
182-
return new Promise(res => {
183-
idle(() => {
184-
bundle
185-
.preload()
186-
.then(res)
187-
.catch(err => console.error(err));
188-
});
189-
});
190-
})
191-
.catch(err => console.error(err));
192-
});
193-
}, 5000);
194-
});
195-
});
196-
}
197-
198156
type Props = {
199157
currentUser: ?GetUserType,
200158
isLoadingCurrentUser: boolean,

src/views/dashboard/components/threadFeed.js

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -94,28 +94,6 @@ class ThreadFeed extends React.Component<Props, State> {
9494
}
9595
};
9696

97-
// Select the first thread on SSR if none is selected
98-
componentWillMount() {
99-
const { mountedWithActiveThread } = this.props;
100-
101-
if (
102-
mountedWithActiveThread ||
103-
this.props.selectedId ||
104-
!this.props.data.threads
105-
)
106-
return;
107-
108-
const threadNodes = this.props.data.threads
109-
.slice()
110-
.map(thread => thread && thread.node);
111-
const sortedThreadNodes = sortByDate(threadNodes, 'lastActive', 'desc');
112-
const hasFirstThread = sortedThreadNodes.length > 0;
113-
const firstThreadId = hasFirstThread ? sortedThreadNodes[0].id : '';
114-
if (hasFirstThread) {
115-
this.props.history.replace(`/?t=${firstThreadId}`);
116-
}
117-
}
118-
11997
componentDidUpdate(prevProps) {
12098
const isDesktop = window.innerWidth > 768;
12199
const { scrollElement } = this.state;

src/views/navbar/index.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import NotificationsTab from './components/notificationsTab';
1010
import Head from 'src/components/head';
1111
import { withCurrentUser } from 'src/components/withCurrentUser';
1212
import type { GetUserType } from 'shared/graphql/queries/user/getUser';
13+
import { truncateNumber } from 'src/helpers/utils';
1314
import {
1415
Nav,
1516
Logo,
@@ -233,11 +234,16 @@ class Navbar extends React.Component<Props, State> {
233234
to={currentUser ? `/users/${currentUser.username}` : '/'}
234235
onClick={() => this.trackNavigationClick('profile')}
235236
>
236-
{currentUser && (
237-
<Reputation>
238-
<Icon glyph="rep" /> {currentUser.totalReputation}
239-
</Reputation>
240-
)}
237+
{currentUser &&
238+
typeof currentUser.totalReputation === 'number' && (
239+
<Reputation>
240+
<Icon glyph="rep" />{' '}
241+
{truncateNumber(
242+
parseInt(currentUser.totalReputation, 10),
243+
1
244+
)}
245+
</Reputation>
246+
)}
241247
<Navatar
242248
style={{ gridArea: 'label' }}
243249
user={currentUser}

0 commit comments

Comments
 (0)