mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-15 21:57:22 +01:00
* Added initial bailey api
* wip
* implement new panel header
* Fixed lint
* add ability to mark notification as seen
* add notification count, remove top badge from user and add ability to mark multiple notifications as seen
* add support dismissall and mark all as read
* do not dismiss actionable notif
* mark as seen when menu is opened instead of closed
* implement ordering, list of actionable notifications
* add groups messages and fix badges count
* add notifications for received cards
* send card received notification to target not sender
* rename notificaion field
* fix integration tests
* mark cards notifications as read and update tests
* add mystery items notifications
* add unallocated stats points notifications
* fix linting
* simplify code
* refactoring and fixes
* fix dropdown opening
* start splitting notifications into their own component
* add notifications for inbox messages
* fix unit tests
* fix default buttons styles
* add initial bailey support
* add title and tests to new stuff notification
* add notification if a group task needs more work
* add tests and fixes for marking a task as needing more work
* make sure user._v is updated
* remove console.log
* notification: hover status and margins
* start styling notifications, add separate files and basic functionalities
* fix tests
* start adding mystery items notification
* wip card notification
* fix cards text
* initial implementation inbox messages
* initial implementation group messages
* disable inbox notifications until mobile is ready
* wip group chat messages
* finish mystery and card notifications
* add bailey notification and fix a lot of stuff
* start adding guilds and parties invitations
* misc invitation fixes
* fix lint issues
* remove old code and add key to notifications
* fix tests
* remove unused code
* add link for public guilds invite
* starts to implement needs work notification design and feature
* fixes to needs work, add group task approved notification
* finish needs work feature
* lots of fixes
* implement quest notification
* bailey fixes and static page
* routing fixes
* fixes # this.$store.dispatch(guilds:join, {groupId: group.id, type: party});
* read notifications on click
* chat notifications
* fix tests for chat notifications
* fix chat notification test
* fix tests
* fix tests (again)
* try awaiting
* remove only
* more sleep
* add bailey tests
* fix icons alignment
* fix issue with multiple points notifications
* remove merge code
* fix rejecting guild invitation
* make remove area bigger
* fix error with notifications and add migration
* fix migration
* fix typos
* add cleanup migration too
* notifications empty state, new counter color, fix marking messages as seen in guilds
* fixes
* add image and install correct packages
* fix mongoose version
* update bailey
* typo
* make sure chat is marked as read after other requests
141 lines
4.3 KiB
Vue
141 lines
4.3 KiB
Vue
<template lang="pug">
|
|
div
|
|
approval-modal(:task='task')
|
|
.claim-bottom-message.col-12
|
|
.task-unclaimed.d-flex.justify-content-between(v-if='!approvalRequested && !multipleApprovalsRequested')
|
|
span {{ message }}
|
|
a.text-right(@click='claim()', v-if='!userIsAssigned') {{ $t('claim') }}
|
|
a.text-right(@click='unassign()', v-if='userIsAssigned') {{ $t('removeClaim') }}
|
|
.row.task-single-approval(v-if='approvalRequested')
|
|
.col-6.text-center
|
|
a(@click='approve()') {{ $t('approveTask') }}
|
|
.col-6.text-center
|
|
a(@click='needsWork()') {{ $t('needsWork') }}
|
|
.text-center.task-multi-approval(v-if='multipleApprovalsRequested')
|
|
a(@click='showRequests()') {{ $t('viewRequests') }}
|
|
</template>
|
|
|
|
<style lang="scss", scoped>
|
|
.claim-bottom-message {
|
|
z-index: 9;
|
|
}
|
|
|
|
.task-unclaimed {
|
|
span {
|
|
margin-right: 0.25rem;
|
|
}
|
|
|
|
a {
|
|
display: inline-block;
|
|
}
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
import findIndex from 'lodash/findIndex';
|
|
import { mapState } from 'client/libs/store';
|
|
import approvalModal from './approvalModal';
|
|
|
|
export default {
|
|
props: ['task', 'group'],
|
|
components: {
|
|
approvalModal,
|
|
},
|
|
computed: {
|
|
...mapState({user: 'user.data'}),
|
|
userIsAssigned () {
|
|
return this.task.group.assignedUsers && this.task.group.assignedUsers.indexOf(this.user._id) !== -1;
|
|
},
|
|
message () {
|
|
let assignedUsers = this.task.group.assignedUsers;
|
|
let assignedUsersNames = [];
|
|
let assignedUsersLength = assignedUsers.length;
|
|
|
|
// @TODO: Eh, I think we only ever display one user name
|
|
if (this.group && this.group.members) {
|
|
assignedUsers.forEach(userId => {
|
|
let index = findIndex(this.group.members, (member) => {
|
|
return member._id === userId;
|
|
});
|
|
let assignedMember = this.group.members[index];
|
|
assignedUsersNames.push(assignedMember.profile.name);
|
|
});
|
|
}
|
|
|
|
if (assignedUsersLength === 1 && !this.userIsAssigned) {
|
|
return this.$t('assignedToUser', {userName: assignedUsersNames[0]});
|
|
} else if (assignedUsersLength > 1 && !this.userIsAssigned) {
|
|
return this.$t('assignedToMembers', {userCount: assignedUsersLength});
|
|
} else if (assignedUsersLength > 1 && this.userIsAssigned) {
|
|
return this.$t('assignedToYouAndMembers', {userCount: assignedUsersLength});
|
|
} else if (this.userIsAssigned) {
|
|
return this.$t('youAreAssigned');
|
|
} else if (assignedUsersLength === 0) {
|
|
return this.$t('taskIsUnassigned');
|
|
}
|
|
},
|
|
approvalRequested () {
|
|
if (this.task.approvals && this.task.approvals.length === 1) return true;
|
|
},
|
|
multipleApprovalsRequested () {
|
|
if (this.task.approvals && this.task.approvals.length > 1) return true;
|
|
},
|
|
},
|
|
methods: {
|
|
async claim () {
|
|
if (!confirm(this.$t('confirmClaim'))) return;
|
|
|
|
let taskId = this.task._id;
|
|
// If we are on the user task
|
|
if (this.task.userId) {
|
|
taskId = this.task.group.taskId;
|
|
}
|
|
|
|
this.$store.dispatch('tasks:assignTask', {
|
|
taskId,
|
|
userId: this.user._id,
|
|
});
|
|
this.task.group.assignedUsers.push(this.user._id);
|
|
},
|
|
async unassign () {
|
|
if (!confirm(this.$t('confirmUnClaim'))) return;
|
|
|
|
let taskId = this.task._id;
|
|
// If we are on the user task
|
|
if (this.task.userId) {
|
|
taskId = this.task.group.taskId;
|
|
}
|
|
|
|
this.$store.dispatch('tasks:unassignTask', {
|
|
taskId,
|
|
userId: this.user._id,
|
|
});
|
|
let index = this.task.group.assignedUsers.indexOf(this.user._id);
|
|
this.task.group.assignedUsers.splice(index, 1);
|
|
},
|
|
approve () {
|
|
if (!confirm(this.$t('confirmApproval'))) return;
|
|
let userIdToApprove = this.task.group.assignedUsers[0];
|
|
this.$store.dispatch('tasks:approve', {
|
|
taskId: this.task._id,
|
|
userId: userIdToApprove,
|
|
});
|
|
this.task.group.assignedUsers.splice(0, 1);
|
|
this.task.approvals.splice(0, 1);
|
|
},
|
|
needsWork () {
|
|
if (!confirm(this.$t('confirmNeedsWork'))) return;
|
|
let userIdNeedsMoreWork = this.task.group.assignedUsers[0];
|
|
this.$store.dispatch('tasks:needsWork', {
|
|
taskId: this.task._id,
|
|
userId: userIdNeedsMoreWork,
|
|
});
|
|
this.task.approvals.splice(0, 1);
|
|
},
|
|
showRequests () {
|
|
this.$root.$emit('bv::show::modal', 'approval-modal');
|
|
},
|
|
},
|
|
};
|
|
</script>
|