mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
Teams Updates 201908 (#11347)
* fix(teams): no hover bg change for noninteractive checkboxes * feat(teams): send notification to managers on task claim Also fix client unit test broken by prev commit * feat(groups): don't penalize for tasks assigned since last activity * fix(tests): actually fix client unit * fix(teams): improve task styles * fix(teams): let people other than leader see relevant approvals Also more style fixes * fix(approvals): better filtering and task headings for approval data * fix(test): correct test expectations for new GET /approvals behavior * fix(groups): style tweaks * different border for group and normal tasks * fix(teams): remove extra click for claiming * fix(teams): leaders & managers can check off approval-required tasks * fix(teams): don't notify user of own claim * fix group task margin and z-index on hover * fix(menu): sporadic error in top bar * fix(teams): more approval header and footer adjustments * fix(tests): adjust expectations for self-approval * fix(teams): address PR comments * refactor(timestamps): date user activity on authenticated requests * refactor(timestamps): update local user instead of direct db update
This commit is contained in:
@@ -1,18 +1,27 @@
|
||||
<template lang="pug">
|
||||
.claim-bottom-message.col-12.text-center(v-if='task.approvals && task.approvals.length > 0', :class="{approval: userIsAdmin}")
|
||||
.task-unclaimed
|
||||
| {{ message }}
|
||||
.claim-top-message.d-flex.align-content-center(v-if='message', :class="{'approval-action': userIsAdmin, 'approval-pending': !userIsAdmin}")
|
||||
.m-auto(v-html='message')
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.claim-bottom-message {
|
||||
z-index: 9;
|
||||
}
|
||||
@import '~client/assets/scss/colors.scss';
|
||||
.claim-top-message {
|
||||
border-top-left-radius: 2px;
|
||||
border-top-right-radius: 2px;
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
padding-bottom: 0.25rem;
|
||||
padding-top: 0.25rem;
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
.approval {
|
||||
background: #24cc8f;
|
||||
color: #fff;
|
||||
}
|
||||
.approval-action {
|
||||
background: $green-100;
|
||||
}
|
||||
|
||||
.approval-pending {
|
||||
background: $gray-300;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
@@ -22,20 +31,22 @@ export default {
|
||||
computed: {
|
||||
...mapState({user: 'user.data'}),
|
||||
message () {
|
||||
let approvals = this.task.approvals;
|
||||
let approvals = this.task.approvals || [];
|
||||
let approvalsLength = approvals.length;
|
||||
let userIsRequesting = this.task.group.approvals && this.task.group.approvals.indexOf(this.user._id) !== -1;
|
||||
let userIsRequesting = approvals.findIndex((approval) => {
|
||||
return approval.userId.id === this.user._id;
|
||||
}) !== -1;
|
||||
|
||||
if (approvalsLength === 1 && !userIsRequesting) {
|
||||
return this.$t('userRequestsApproval', {userName: approvals[0].userId.profile.name});
|
||||
} else if (approvalsLength > 1 && !userIsRequesting) {
|
||||
return this.$t('userCountRequestsApproval', {userCount: approvalsLength});
|
||||
} else if (approvalsLength === 1 && userIsRequesting) {
|
||||
} else if (approvalsLength === 1 && userIsRequesting || this.task.group.approval && this.task.group.approval.requested && !this.task.group.approval.approved) {
|
||||
return this.$t('youAreRequestingApproval');
|
||||
}
|
||||
},
|
||||
userIsAdmin () {
|
||||
return this.group.leader.id === this.user._id;
|
||||
return this.group && (this.group.leader.id === this.user._id || this.group.managers[this.user._id]);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user