Skip to content

Commit 105b38f

Browse files
committed
issue #1985 - small fixes
1 parent 62b76ea commit 105b38f

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

src/projects/detail/containers/DashboardContainer.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
filterReadNotifications,
1313
filterNotificationsByProjectId,
1414
filterProjectNotifications,
15+
preRenderNotifications,
1516
} from '../../../routes/notifications/helpers/notifications'
1617
import { toggleNotificationRead, toggleBundledNotificationRead } from '../../../routes/notifications/actions'
1718
import {
@@ -111,7 +112,7 @@ class DashboardContainer extends React.Component {
111112
} = this.props
112113

113114
// system notifications
114-
const notReadNotifications = filterReadNotifications(notifications.notifications)
115+
const notReadNotifications = filterReadNotifications(notifications)
115116
const unreadProjectUpdate = filterProjectNotifications(filterNotificationsByProjectId(notReadNotifications, project.id))
116117
const sortedUnreadProjectUpdates = _.orderBy(unreadProjectUpdate, ['date'], ['desc'])
117118

@@ -205,7 +206,7 @@ class DashboardContainer extends React.Component {
205206
}
206207

207208
const mapStateToProps = ({ notifications, projectState, projectTopics, templates, phasesTopics }) => ({
208-
notifications,
209+
notifications: preRenderNotifications(notifications.notifications),
209210
productTemplates: templates.productTemplates,
210211
isProcessing: projectState.processing,
211212
phases: projectState.phases,

src/projects/detail/containers/FeedContainer.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ class FeedView extends React.Component {
8585
window.removeEventListener('beforeunload', this.onLeave)
8686
}
8787

88+
shouldComponentUpdate(nextProps) {
89+
console.warn('shouldComponentUpdate')
90+
}
91+
8892
// Notify user if they navigate away while the form is modified.
8993
onLeave(e = {}) {
9094
if (this.isChanged()) {
@@ -366,6 +370,7 @@ class FeedView extends React.Component {
366370
}
367371

368372
render () {
373+
console.warn('FeedContainer render')
369374
const {currentUser, currentMemberRole, isCreatingFeed, error, allMembers,
370375
toggleNotificationRead, notifications, project, isSuperUser } = this.props
371376
const { feeds, isNewPostMobileOpen, fullscreenFeedId } = this.state

src/routes/notifications/helpers/notifications.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,11 +435,18 @@ export const prepareNotifications = (rawNotifications) => {
435435
return notifications
436436
}
437437

438+
/**
439+
* Bundle notifications and renders notifications texts
440+
*
441+
* @param {Array} notifications notifications list
442+
*
443+
* @returns {Array} notifications list with rendered texts
444+
*/
438445
export const preRenderNotifications = (notifications) => {
439446
// we will only render notification which has rules
440447
const notificationsWithRules = _.compact(
441448
notifications.map((notification) => notification.rule ? {
442-
notification,
449+
notification: _.omit(notification, 'rule'),
443450
notificationRule: notification.rule,
444451
} : null)
445452
)

0 commit comments

Comments
 (0)