@@ -26,6 +26,8 @@ import {
2626 PROJECT_ASSETS_SHARED_WITH_ALL_MEMBERS ,
2727 PROJECT_ASSETS_SHARED_WITH_ADMIN ,
2828 EVENT_TYPE ,
29+ ATTACHMENT_TYPE_LINK ,
30+ ATTACHMENT_TYPE_FILE ,
2931} from '../../../config/constants'
3032import AddLink from '../../../components/AssetsLibrary/AddLink'
3133import PERMISSIONS from '../../../config/permissions'
@@ -58,9 +60,8 @@ class AssetsInfoContainer extends React.Component {
5860 }
5961 }
6062 this . onAddNewLink = this . onAddNewLink . bind ( this )
61- this . onDeleteLink = this . onDeleteLink . bind ( this )
6263 this . onEditLink = this . onEditLink . bind ( this )
63- this . onEditAttachment = this . onEditAttachment . bind ( this )
64+ this . onEditFileAttachment = this . onEditFileAttachment . bind ( this )
6465 this . onAddFile = this . onAddFile . bind ( this )
6566 this . onUploadAttachment = this . onUploadAttachment . bind ( this )
6667 this . removeAttachment = this . removeAttachment . bind ( this )
@@ -192,16 +193,11 @@ class AssetsInfoContainer extends React.Component {
192193 addProjectAttachment ( project . id , {
193194 title : link . title ,
194195 tags : link . tags ,
195- type : 'link' ,
196+ type : ATTACHMENT_TYPE_LINK ,
196197 path : link . address
197198 } )
198199 }
199200
200- onDeleteLink ( id ) {
201- const { project, removeProjectAttachment } = this . props
202- removeProjectAttachment ( project . id , id )
203- }
204-
205201 onEditLink ( id , title , address , tags ) {
206202 const { project, updateProjectAttachment } = this . props
207203
@@ -212,7 +208,7 @@ class AssetsInfoContainer extends React.Component {
212208 } )
213209 }
214210
215- onEditAttachment ( originalAttachment , title , allowedUsers , tags ) {
211+ onEditFileAttachment ( originalAttachment , title , allowedUsers , tags ) {
216212 const { project, updateProjectAttachment, phases, updateProductAttachment } = this . props
217213 const updatedAttachment = {
218214 title,
@@ -501,7 +497,7 @@ class AssetsInfoContainer extends React.Component {
501497 const { project, isSuperUser, phases, feeds,
502498 isManageUser, phasesTopics, canAccessPrivatePosts } = this . props
503499
504- let attachments = _ . filter ( project . attachments , a => a . type === 'file' )
500+ let attachments = _ . filter ( project . attachments , a => a . type === ATTACHMENT_TYPE_FILE )
505501 // merges the product attachments to show in the links menu
506502 if ( phases && phases . length > 0 ) {
507503 phases . forEach ( phase => {
@@ -555,7 +551,7 @@ class AssetsInfoContainer extends React.Component {
555551 const privateTopicLinks = topicLinks . filter ( link => link . tag === PROJECT_FEED_TYPE_MESSAGES )
556552 const phaseLinks = this . extractLinksFromPosts ( phaseFeeds )
557553
558- let links = _ . filter ( project . attachments , a => a . type === 'link' )
554+ let links = _ . filter ( project . attachments , a => a . type === ATTACHMENT_TYPE_LINK )
559555 links = links . concat ( publicTopicLinks )
560556 if ( canAccessPrivatePosts ) {
561557 links = links . concat ( privateTopicLinks )
@@ -763,7 +759,7 @@ class AssetsInfoContainer extends React.Component {
763759 category,
764760 size : f . size ,
765761 path : f . key ,
766- type : 'file' ,
762+ type : ATTACHMENT_TYPE_FILE ,
767763 contentType : f . mimetype || 'application/unknown'
768764 }
769765 attachments . push ( attachment )
@@ -862,7 +858,7 @@ class AssetsInfoContainer extends React.Component {
862858 links = { attachments }
863859 title = "Files"
864860 onDelete = { this . removeAttachment }
865- onEdit = { this . onEditAttachment }
861+ onEdit = { this . onEditFileAttachment }
866862 onAddAttachment = { addProjectAttachment }
867863 onUploadAttachment = { this . onUploadAttachment }
868864 isSharingAttachment = { isSharingAttachment }
@@ -898,7 +894,7 @@ class AssetsInfoContainer extends React.Component {
898894 assetsMembers = { assetsMembers }
899895 canDelete = { canManageLinks }
900896 canEdit = { canManageLinks }
901- onDelete = { this . onDeleteLink }
897+ onDelete = { this . removeAttachment }
902898 onEdit = { this . onEditLink }
903899 formatModifyDate = { formatModifyDate }
904900 formatFolderTitle = { formatFolderTitle }
0 commit comments