@@ -9,7 +9,7 @@ import moment from 'moment'
99import LinksGridView from '../../../components/AssetsLibrary/LinksGridView'
1010import FilesGridView from '../../../components/AssetsLibrary/FilesGridView'
1111import AssetsStatistics from '../../../components/AssetsLibrary/AssetsStatistics'
12- import { updateProject , deleteProject } from '../../actions/project'
12+ import { updateProject , deleteProject , loadAssetsMembers } from '../../actions/project'
1313import { loadDashboardFeeds , loadProjectMessages } from '../../actions/projectTopics'
1414import { loadTopic } from '../../../actions/topics'
1515import { loadProjectPlan } from '../../actions/projectPlan'
@@ -397,7 +397,7 @@ class AssetsInfoContainer extends React.Component {
397397 const { project, currentMemberRole, isSuperUser, phases, feeds,
398398 isManageUser, phasesTopics, projectTemplates, hideLinks,
399399 attachmentsAwaitingPermission, addProjectAttachment, discardAttachments, attachmentPermissions,
400- changeAttachmentPermission, projectMembers, loggedInUser, isSharingAttachment, canAccessPrivatePosts } = this . props
400+ changeAttachmentPermission, projectMembers, loggedInUser, isSharingAttachment, canAccessPrivatePosts, loadAssetsMembers , assetsMembers } = this . props
401401 const { ifModalOpen } = this . state
402402
403403 const canManageLinks = ! ! currentMemberRole || isSuperUser
@@ -486,6 +486,25 @@ class AssetsInfoContainer extends React.Component {
486486 ...this . extractAttachmentLinksFromPosts ( phaseFeeds )
487487 ]
488488
489+ let tmpUserIds = [ ]
490+ let userIds = [ ]
491+ _ . forEach ( links , link => {
492+ tmpUserIds = _ . union ( tmpUserIds , _ . map ( link . children , 'createdBy' ) )
493+ tmpUserIds = _ . union ( tmpUserIds , [ link . createdBy ] )
494+ tmpUserIds = _ . union ( tmpUserIds , [ link . updatedBy ] )
495+ } )
496+
497+ _ . forEach ( attachments , attachment => {
498+ tmpUserIds = _ . union ( tmpUserIds , _ . map ( attachment . children , 'createdBy' ) )
499+ tmpUserIds = _ . union ( tmpUserIds , [ attachment . createdBy ] )
500+ } )
501+
502+ _ . forEach ( tmpUserIds , userId => {
503+ userIds = _ . union ( userIds , [ _ . parseInt ( userId ) ] )
504+ } )
505+ _ . remove ( userIds , i => ! i )
506+ loadAssetsMembers ( userIds )
507+
489508 const assetsData = [ ]
490509 enableFileUpload && assetsData . push ( { name : 'Files' , total : _ . toString ( attachments . length ) } )
491510 ! hideLinks && assetsData . push ( { name : 'Links' , total : _ . toString ( links . length ) } )
@@ -608,6 +627,7 @@ class AssetsInfoContainer extends React.Component {
608627 onChangePermissions = { changeAttachmentPermission }
609628 selectedUsers = { attachmentPermissions }
610629 projectMembers = { projectMembers }
630+ assetsMembers = { assetsMembers }
611631 pendingAttachments = { attachmentsAwaitingPermission }
612632 loggedInUser = { loggedInUser }
613633 attachmentsStorePath = { attachmentsStorePath }
@@ -618,7 +638,7 @@ class AssetsInfoContainer extends React.Component {
618638 { ( ! hideLinks && activeAssetsType === 'Links' ) &&
619639 < LinksGridView
620640 links = { links }
621- projectMembers = { projectMembers }
641+ assetsMembers = { assetsMembers }
622642 canDelete = { canManageLinks }
623643 canEdit = { canManageLinks }
624644 onDelete = { this . onDeleteLink }
@@ -653,12 +673,13 @@ const mapStateToProps = ({ templates, projectState, members, loadUser }) => {
653673 attachmentPermissions : projectState . attachmentPermissions ,
654674 isSharingAttachment : projectState . processingAttachments ,
655675 projectMembers : _ . keyBy ( projectMembers , 'userId' ) ,
676+ assetsMembers : _ . keyBy ( projectState . assetsMembers , 'userId' ) ,
656677 loggedInUser : loadUser . user ,
657678 canAccessPrivatePosts
658679 } )
659680}
660681
661- const mapDispatchToProps = { updateProject, deleteProject, addProjectAttachment, updateProjectAttachment,
682+ const mapDispatchToProps = { updateProject, deleteProject, loadAssetsMembers , addProjectAttachment, updateProjectAttachment,
662683 loadProjectMessages, discardAttachments, uploadProjectAttachments, loadDashboardFeeds, loadTopic, changeAttachmentPermission,
663684 removeProjectAttachment, loadProjectPlan, saveFeedComment }
664685
0 commit comments