From de58b17c3a44ecb51613e13713b3f88941c0f88d Mon Sep 17 00:00:00 2001 From: Michael An <2331806369@qq.com> Date: Thu, 30 May 2024 17:49:47 +0800 Subject: [PATCH] fix old wiki avatar --- frontend/src/components/wiki-card-view/wiki-card-group.js | 1 + frontend/src/components/wiki-card-view/wiki-card-item.js | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/wiki-card-view/wiki-card-group.js b/frontend/src/components/wiki-card-view/wiki-card-group.js index c5f5f4e35a..7817e6fcd7 100644 --- a/frontend/src/components/wiki-card-view/wiki-card-group.js +++ b/frontend/src/components/wiki-card-view/wiki-card-group.js @@ -25,6 +25,7 @@ class WikiCardGroup extends Component { key={index} wiki={wiki} deleteWiki={this.props.deleteWiki} + isDepartment={isDepartment} /> ); })} diff --git a/frontend/src/components/wiki-card-view/wiki-card-item.js b/frontend/src/components/wiki-card-view/wiki-card-item.js index 472396e5a5..8f833ca648 100644 --- a/frontend/src/components/wiki-card-view/wiki-card-item.js +++ b/frontend/src/components/wiki-card-view/wiki-card-item.js @@ -2,13 +2,14 @@ import React, { Component } from 'react'; import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap'; import PropTypes from 'prop-types'; import moment from 'moment'; -import { siteRoot, gettext, appAvatarURL, username } from '../../utils/constants'; +import { siteRoot, gettext, appAvatarURL } from '../../utils/constants'; import ModalPortal from '../modal-portal'; import WikiDeleteDialog from '../dialog/wiki-delete-dialog'; const propTypes = { wiki: PropTypes.object.isRequired, deleteWiki: PropTypes.func.isRequired, + isDepartment: PropTypes.bool.isRequired, }; class WikiCardItem extends Component { @@ -75,7 +76,7 @@ class WikiCardItem extends Component { }; render() { - const { wiki } = this.props; + const { wiki, isDepartment } = this.props; let isOldVersion = wiki.version !== 'v2'; let publishedUrl = `${siteRoot}published/${encodeURIComponent(wiki.slug)}/`; let editUrl = `${siteRoot}wikis/${wiki.id}/`; @@ -108,7 +109,7 @@ class WikiCardItem extends Component {
- {wiki.owner === username ? this.renderAvatar() : this.renderDept()} + {isDepartment ? this.renderDept() : this.renderAvatar()} {moment(wiki.updated_at).fromNow()}