Restrict work item list to admin only
This commit is contained in:
@@ -31,6 +31,7 @@ import KeyboardSpacer from "react-native-keyboard-spacer"
|
||||
import hardhatPinImage from "./images/hardhat-pin.png"
|
||||
import clipboardPinImage from "./images/clipboard-pin.png"
|
||||
import questionPinImage from "./images/question-pin.png"
|
||||
import moment from "moment"
|
||||
|
||||
const neverAskForLocationPermissionKeyName = "NeverAskForLocationPermission"
|
||||
const neverAskForCameraKeyName = "NeverAskForCameraPermission"
|
||||
@@ -92,8 +93,19 @@ export class Home extends React.Component {
|
||||
)
|
||||
|
||||
api
|
||||
.listWorkItemActivities()
|
||||
.listTeams()
|
||||
.then((list) => {
|
||||
this.teams = list.items
|
||||
return api.listWorkItemActivities()
|
||||
})
|
||||
.then((list) => {
|
||||
list.items.forEach((item) => {
|
||||
item.data.forEach((datum) => {
|
||||
const team = this.teams.find((team) => team._id === datum.team)
|
||||
|
||||
datum.teamName = team ? team.name : "???"
|
||||
})
|
||||
})
|
||||
this.setState({
|
||||
sections: list.items,
|
||||
region:
|
||||
@@ -104,7 +116,13 @@ export class Home extends React.Component {
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
this.setState({
|
||||
messageModal: {
|
||||
icon: "hand",
|
||||
message: "Unable to get a list of work items, activities and teams",
|
||||
detail: err.message,
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -440,7 +458,9 @@ export class Home extends React.Component {
|
||||
{activity.resolution}
|
||||
</Text>
|
||||
<Text style={{ fontSize: 14, color: "gray" }}>
|
||||
{activity.when}
|
||||
{activity.teamName +
|
||||
" | " +
|
||||
dotify(moment(activity.createdAt).format())}
|
||||
</Text>
|
||||
</View>
|
||||
<Icon
|
||||
@@ -482,7 +502,11 @@ export class Home extends React.Component {
|
||||
<Icon
|
||||
name="settings"
|
||||
size={24}
|
||||
style={{ marginRight: 15, tintColor: "gray" }}
|
||||
style={{
|
||||
display: api.loggedInUser.administrator ? "flex" : "none",
|
||||
marginRight: 15,
|
||||
tintColor: "gray",
|
||||
}}
|
||||
/>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user