mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-08 10:22:46 +00:00
fix activities link (#2705)
This commit is contained in:
@@ -2,6 +2,7 @@ import React, { Component, Fragment } from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import { gettext, siteRoot } from '../../utils/constants';
|
import { gettext, siteRoot } from '../../utils/constants';
|
||||||
|
import { Utils } from '../../utils/utils';
|
||||||
|
|
||||||
const contentPropTypes = {
|
const contentPropTypes = {
|
||||||
data: PropTypes.object.isRequired,
|
data: PropTypes.object.isRequired,
|
||||||
@@ -47,21 +48,12 @@ const tablePropTypes = {
|
|||||||
|
|
||||||
class TableBody extends Component {
|
class TableBody extends Component {
|
||||||
|
|
||||||
encodePath(path) {
|
|
||||||
let path_arr = path.split('/');
|
|
||||||
let path_arr_ = [];
|
|
||||||
for (let i = 0, len = path_arr.length; i < len; i++) {
|
|
||||||
path_arr_.push(encodeURIComponent(path_arr[i]));
|
|
||||||
}
|
|
||||||
return path_arr_.join('/');
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let listFilesActivities = this.props.items.map(function(item, index) {
|
let listFilesActivities = this.props.items.map(function(item, index) {
|
||||||
let op, details;
|
let op, details;
|
||||||
let userProfileURL = `${siteRoot}profile/${encodeURIComponent(item.author_email)}/`;
|
let userProfileURL = `${siteRoot}profile/${encodeURIComponent(item.author_email)}/`;
|
||||||
|
|
||||||
let libURL = `${siteRoot}#common/lib/${item.repo_id}`;
|
let libURL = siteRoot + 'library/' + item.repo_id + '/' + encodeURIComponent(item.repo_name) + '/';
|
||||||
let libLink = <a href={libURL}>{item.repo_name}</a>;
|
let libLink = <a href={libURL}>{item.repo_name}</a>;
|
||||||
let smallLibLink = <a className="small text-secondary" href={libURL}>{item.repo_name}</a>;
|
let smallLibLink = <a className="small text-secondary" href={libURL}>{item.repo_name}</a>;
|
||||||
|
|
||||||
@@ -93,7 +85,7 @@ class TableBody extends Component {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (item.obj_type == 'file') {
|
} else if (item.obj_type == 'file') {
|
||||||
let fileURL = `${siteRoot}lib/${item.repo_id}/file${this.encodePath(item.path)}`;
|
let fileURL = `${siteRoot}lib/${item.repo_id}/file${Utils.encodePath(item.path)}`;
|
||||||
let fileLink = <a href={fileURL}>{item.name}</a>;
|
let fileLink = <a href={fileURL}>{item.name}</a>;
|
||||||
switch(item.op_type) {
|
switch(item.op_type) {
|
||||||
case 'create':
|
case 'create':
|
||||||
@@ -123,7 +115,7 @@ class TableBody extends Component {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else { // dir
|
} else { // dir
|
||||||
let dirURL = `${siteRoot}#common/lib/${item.repo_id}${this.encodePath(item.path)}`;
|
let dirURL = siteRoot + 'library/' + item.repo_id + '/' + encodeURIComponent(item.repo_name) + Utils.encodePath(item.path);
|
||||||
let dirLink = <a href={dirURL}>{item.name}</a>;
|
let dirLink = <a href={dirURL}>{item.name}</a>;
|
||||||
switch(item.op_type) {
|
switch(item.op_type) {
|
||||||
case 'create':
|
case 'create':
|
||||||
|
Reference in New Issue
Block a user