1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-04 08:28:11 +00:00

click draft file from activities (#3153)

This commit is contained in:
陈钦亮
2019-03-21 14:29:09 +08:00
committed by Daniel Pan
parent d038b6a8a0
commit e9ce192502
4 changed files with 34 additions and 3 deletions

View File

@@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import moment from 'moment';
import { Button, Modal, ModalHeader, ModalBody, ModalFooter, Table } from 'reactstrap';
import { gettext, siteRoot } from '../../utils/constants';
import { gettext, siteRoot, serviceURL } from '../../utils/constants';
import { Utils } from '../../utils/utils';
const propTypes = {
@@ -33,9 +33,16 @@ class ListCreatedFileDialog extends React.Component {
{
activity.createdFilesList.map((item, index) => {
let fileURL = `${siteRoot}lib/${item.repo_id}/file${Utils.encodePath(item.path)}`;
if (item.name.endsWith('(draft).md')) {
fileURL = serviceURL + '/drafts/' + item.draft_id + '/';
}
let fileLink = <a href={fileURL} target='_blank'>{item.name}</a>
if (item.name.endsWith('(draft).md') && !item.draft_id) {
fileLink = item.name;
}
return (
<tr key={index}>
<td><a href={fileURL} target='_blank'>{item.name}</a></td>
<td>{fileLink}</td>
<td>{moment(item.time).fromNow()}</td>
</tr>
);