From bce32fb11d5d8cddc7da5c7bcdd99890c4ce4f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E9=A1=BA=E5=BC=BA?= Date: Wed, 4 Sep 2019 15:52:24 +0800 Subject: [PATCH] repair group-settings show bug (#4052) * repair group-settings show bug * optimized code --- frontend/src/pages/groups/group-view.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/groups/group-view.js b/frontend/src/pages/groups/group-view.js index e8c2d81e81..55d9f037c7 100644 --- a/frontend/src/pages/groups/group-view.js +++ b/frontend/src/pages/groups/group-view.js @@ -392,7 +392,16 @@ class GroupView extends React.Component { render() { let { errMessage, emptyTip, currentGroup, isDepartmentGroup, isStaff } = this.state; - let isShowSettingIcon = !(currentGroup && currentGroup.parent_group_id !== 0 && currentGroup.admins.indexOf(username) === -1); + let isShowSettingIcon = false; + if (currentGroup) { // group message is loaded + if (currentGroup.parent_group_id === 0) { + isShowSettingIcon = true; + } else { + if (currentGroup.admins.indexOf(username) > -1) { + isShowSettingIcon = true; + } + } + } let useRate = 0; if (isDepartmentGroup && currentGroup.group_quota) { useRate = currentGroup.group_quota_usage / currentGroup.group_quota * 100 + '%';