@@ -233,11 +233,11 @@ class AssetsInfoContainer extends React.Component {
233233 this . props . uploadProjectAttachments ( project . id , attachment )
234234 }
235235
236- extractHtmlLink ( str , userId ) {
236+ extractHtmlLink ( post ) {
237237 const links = [ ]
238238 const regex = / < a [ ^ > ] + h r e f = " ( .* ?) " [ ^ > ] * > ( [ \s \S ] * ?) < \/ a > / gm
239239 const urlRegex = / ^ (?: h t t p ( s ) ? : \/ \/ ) ? [ \w . - ] + (?: \. [ \w \. - ] + ) + [ \w \- \. _ ~ : / ? # [ \] @ ! \$ & ' \( \) \* \+ , ; = . ] + $ / gm // eslint-disable-line no-useless-escape
240- const rawLinks = regex . exec ( str )
240+ const rawLinks = regex . exec ( post . rawContent )
241241
242242 if ( Array . isArray ( rawLinks ) ) {
243243 let i = 0
@@ -249,7 +249,8 @@ class AssetsInfoContainer extends React.Component {
249249 links . push ( {
250250 title,
251251 address,
252- createdBy : userId
252+ createdAt : post . date ,
253+ createdBy : post . userId
253254 } )
254255 }
255256
@@ -260,11 +261,11 @@ class AssetsInfoContainer extends React.Component {
260261 return links
261262 }
262263
263- extractMarkdownLink ( str , userId ) {
264+ extractMarkdownLink ( post ) {
264265 const links = [ ]
265266 const regex = / (?: _ _ | [ * # ] ) | \[ ( .* ?) \] \( ( .* ?) \) / gm
266267 const urlRegex = / ^ (?: h t t p ( s ) ? : \/ \/ ) ? [ \w . - ] + (?: \. [ \w \. - ] + ) + [ \w \- \. _ ~ : / ? # [ \] @ ! \$ & ' \( \) \* \+ , ; = . ] + $ / gm // eslint-disable-line no-useless-escape
267- const rawLinks = regex . exec ( str )
268+ const rawLinks = regex . exec ( post . rawContent )
268269
269270 if ( Array . isArray ( rawLinks ) ) {
270271 let i = 0
@@ -276,7 +277,8 @@ class AssetsInfoContainer extends React.Component {
276277 links . push ( {
277278 title,
278279 address,
279- createdBy : userId
280+ createdAt : post . date ,
281+ createdBy : post . userId
280282 } )
281283 }
282284
@@ -287,10 +289,10 @@ class AssetsInfoContainer extends React.Component {
287289 return links
288290 }
289291
290- extractRawLink ( str , userId ) {
292+ extractRawLink ( post ) {
291293 let links = [ ]
292294 const regex = / ( \s | ^ ) ( h t t p s ? : \/ \/ (?: w w w \. | (? ! w w w ) ) [ a - z A - Z 0 - 9 ] [ a - z A - Z 0 - 9 - ] + [ a - z A - Z 0 - 9 ] \. [ ^ \s ] { 2 , } | w w w \. [ a - z A - Z 0 - 9 ] [ a - z A - Z 0 - 9 - ] + [ a - z A - Z 0 - 9 ] \. [ ^ \s ] { 2 , } | h t t p s ? : \/ \/ (?: w w w \. | (? ! w w w ) ) [ a - z A - Z 0 - 9 ] + \. [ ^ \s ] { 2 , } | w w w \. [ a - z A - Z 0 - 9 ] + \. [ ^ \s ] { 2 , } [ \s ] ) ( \s | $ ) / igm // eslint-disable-line no-useless-escape
293- const rawLinks = str . match ( regex )
295+ const rawLinks = post . rawContent . match ( regex )
294296
295297 if ( Array . isArray ( rawLinks ) ) {
296298 links = rawLinks
@@ -302,7 +304,8 @@ class AssetsInfoContainer extends React.Component {
302304 return {
303305 title : name ,
304306 address : url ,
305- createdBy : userId
307+ createdAt : post . date ,
308+ createdBy : post . userId
306309 }
307310 } )
308311 }
@@ -316,15 +319,16 @@ class AssetsInfoContainer extends React.Component {
316319 let childrenLinks = [ ]
317320 feed . posts . forEach ( post => {
318321 childrenLinks = childrenLinks . concat ( [
319- ...this . extractHtmlLink ( post . rawContent , post . userId ) ,
320- ...this . extractMarkdownLink ( post . rawContent , post . userId ) ,
321- ...this . extractRawLink ( post . rawContent , post . userId )
322+ ...this . extractHtmlLink ( post ) ,
323+ ...this . extractMarkdownLink ( post ) ,
324+ ...this . extractRawLink ( post )
322325 ] )
323326 } )
324327
325328 if ( childrenLinks . length > 0 ) {
326329 links . push ( {
327330 title : feed . title ,
331+ createdBy : feed . userId ,
328332 children : childrenLinks
329333 } )
330334 }
@@ -349,6 +353,7 @@ class AssetsInfoContainer extends React.Component {
349353 attachmentId : attachment . id ,
350354 attachment : true ,
351355 deletable : true ,
356+ createdAt : post . date ,
352357 createdBy : attachment . createdBy ,
353358 postId : post . id ,
354359 topicId : feed . id ,
@@ -361,6 +366,7 @@ class AssetsInfoContainer extends React.Component {
361366 if ( attachmentLinksPerFeed . length > 0 ) {
362367 attachmentLinks . push ( {
363368 title : feed . title ,
369+ createdBy : feed . userId ,
364370 children : attachmentLinksPerFeed
365371 } )
366372 }
0 commit comments