mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
Sept 22 fixes (#9065)
* Removed lingering checklist * Added another party data check * Added move cursor on hover * Removed task locally * Prevented user from being able to delete an active challenge task * Reset tasks when viewing member progress * Prevented challenge owners from adding checklists * Hide challenges columns with no tasks * Add error translations * Added markdown to challenge description * Allowed leader to rejoin challenge * Replaced description with summary * Fixed delete logic * Added author * Added loading message * Added load more * Added default sub * Fixed remove all * Added lint
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
h1 {{challenge.name}}
|
h1 {{challenge.name}}
|
||||||
div
|
div
|
||||||
strong(v-once) {{$t('createdBy')}}:
|
strong(v-once) {{$t('createdBy')}}:
|
||||||
span {{challenge.author}}
|
span {{challenge.leader.profile.name}}
|
||||||
// @TODO: make challenge.author a variable inside the createdBy string (helps with RTL languages)
|
// @TODO: make challenge.author a variable inside the createdBy string (helps with RTL languages)
|
||||||
// @TODO: Implement in V2 strong.margin-left(v-once)
|
// @TODO: Implement in V2 strong.margin-left(v-once)
|
||||||
.svg-icon.calendar-icon(v-html="icons.calendarIcon")
|
.svg-icon.calendar-icon(v-html="icons.calendarIcon")
|
||||||
@@ -42,10 +42,11 @@
|
|||||||
:type="column",
|
:type="column",
|
||||||
:key="column",
|
:key="column",
|
||||||
:taskListOverride='tasksByType[column]',
|
:taskListOverride='tasksByType[column]',
|
||||||
v-on:editTask="editTask")
|
v-on:editTask="editTask",
|
||||||
|
v-if='tasksByType[column].length > 0')
|
||||||
.col-4.sidebar.standard-page
|
.col-4.sidebar.standard-page
|
||||||
.acitons
|
.acitons
|
||||||
div(v-if='!isMember && !isLeader')
|
div(v-if='canJoin')
|
||||||
button.btn.btn-success(v-once, @click='joinChallenge()') {{$t('joinChallenge')}}
|
button.btn.btn-success(v-once, @click='joinChallenge()') {{$t('joinChallenge')}}
|
||||||
div(v-if='isMember')
|
div(v-if='isMember')
|
||||||
button.btn.btn-danger(v-once, @click='leaveChallenge()') {{$t('leaveChallenge')}}
|
button.btn.btn-danger(v-once, @click='leaveChallenge()') {{$t('leaveChallenge')}}
|
||||||
@@ -61,6 +62,7 @@
|
|||||||
:challengeId="challengeId",
|
:challengeId="challengeId",
|
||||||
v-on:taskCreated='taskCreated',
|
v-on:taskCreated='taskCreated',
|
||||||
v-on:taskEdited='taskEdited',
|
v-on:taskEdited='taskEdited',
|
||||||
|
@taskDestroyed='taskDestroyed'
|
||||||
)
|
)
|
||||||
div(v-if='isLeader')
|
div(v-if='isLeader')
|
||||||
button.btn.btn-secondary(v-once, @click='edit()') {{$t('editChallenge')}}
|
button.btn.btn-secondary(v-once, @click='edit()') {{$t('editChallenge')}}
|
||||||
@@ -74,7 +76,7 @@
|
|||||||
h2 {{$t('challengeSummary')}}
|
h2 {{$t('challengeSummary')}}
|
||||||
p {{challenge.summary}}
|
p {{challenge.summary}}
|
||||||
h2 {{$t('challengeDescription')}}
|
h2 {{$t('challengeDescription')}}
|
||||||
p {{challenge.description}}
|
p(v-markdown='challenge.description')
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
@@ -178,6 +180,7 @@ import { mapState } from 'client/libs/store';
|
|||||||
import closeChallengeModal from './closeChallengeModal';
|
import closeChallengeModal from './closeChallengeModal';
|
||||||
import Column from '../tasks/column';
|
import Column from '../tasks/column';
|
||||||
import TaskModal from '../tasks/taskModal';
|
import TaskModal from '../tasks/taskModal';
|
||||||
|
import markdownDirective from 'client/directives/markdown';
|
||||||
import challengeModal from './challengeModal';
|
import challengeModal from './challengeModal';
|
||||||
import challengeMemberProgressModal from './challengeMemberProgressModal';
|
import challengeMemberProgressModal from './challengeMemberProgressModal';
|
||||||
|
|
||||||
@@ -189,6 +192,9 @@ import calendarIcon from 'assets/svg/calendar.svg';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['challengeId'],
|
props: ['challengeId'],
|
||||||
|
directives: {
|
||||||
|
markdown: markdownDirective,
|
||||||
|
},
|
||||||
components: {
|
components: {
|
||||||
closeChallengeModal,
|
closeChallengeModal,
|
||||||
challengeModal,
|
challengeModal,
|
||||||
@@ -232,6 +238,9 @@ export default {
|
|||||||
if (!this.challenge.leader) return false;
|
if (!this.challenge.leader) return false;
|
||||||
return this.user._id === this.challenge.leader._id;
|
return this.user._id === this.challenge.leader._id;
|
||||||
},
|
},
|
||||||
|
canJoin () {
|
||||||
|
return !this.isMember;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
if (!this.searchId) this.searchId = this.challengeId;
|
if (!this.searchId) this.searchId = this.challengeId;
|
||||||
@@ -327,7 +336,14 @@ export default {
|
|||||||
});
|
});
|
||||||
this.tasksByType[task.type].splice(index, 1, task);
|
this.tasksByType[task.type].splice(index, 1, task);
|
||||||
},
|
},
|
||||||
|
taskDestroyed (task) {
|
||||||
|
let index = findIndex(this.tasksByType[task.type], (taskItem) => {
|
||||||
|
return taskItem._id === task._id;
|
||||||
|
});
|
||||||
|
this.tasksByType[task.type].splice(index, 1);
|
||||||
|
},
|
||||||
showMemberModal () {
|
showMemberModal () {
|
||||||
|
this.$store.state.memberModalOptions.challengeId = this.challenge._id;
|
||||||
this.$store.state.memberModalOptions.groupId = 'challenge'; // @TODO: change these terrible settings
|
this.$store.state.memberModalOptions.groupId = 'challenge'; // @TODO: change these terrible settings
|
||||||
this.$store.state.memberModalOptions.group = this.group;
|
this.$store.state.memberModalOptions.group = this.group;
|
||||||
this.$store.state.memberModalOptions.viewingMembers = this.members;
|
this.$store.state.memberModalOptions.viewingMembers = this.members;
|
||||||
|
|||||||
@@ -33,6 +33,13 @@ export default {
|
|||||||
watch: {
|
watch: {
|
||||||
async memberId (id) {
|
async memberId (id) {
|
||||||
if (!id) return;
|
if (!id) return;
|
||||||
|
this.tasksByType = {
|
||||||
|
habit: [],
|
||||||
|
daily: [],
|
||||||
|
todo: [],
|
||||||
|
reward: [],
|
||||||
|
};
|
||||||
|
|
||||||
let response = await axios.get(`/api/v3/challenges/${this.challengeId}/members/${this.memberId}`);
|
let response = await axios.get(`/api/v3/challenges/${this.challengeId}/members/${this.memberId}`);
|
||||||
let tasks = response.data.data.tasks;
|
let tasks = response.data.data.tasks;
|
||||||
tasks.forEach((task) => {
|
tasks.forEach((task) => {
|
||||||
|
|||||||
@@ -360,41 +360,44 @@ export default {
|
|||||||
},
|
},
|
||||||
async createChallenge () {
|
async createChallenge () {
|
||||||
// @TODO: improve error handling, add it to updateChallenge, make errors translatable. Suggestion: `<% fieldName %> is required` where possible, where `fieldName` is inserted as the translatable string that's used for the field header.
|
// @TODO: improve error handling, add it to updateChallenge, make errors translatable. Suggestion: `<% fieldName %> is required` where possible, where `fieldName` is inserted as the translatable string that's used for the field header.
|
||||||
let errors = '';
|
let errors = [];
|
||||||
if (!this.workingChallenge.name) errors += 'Name is required\n';
|
|
||||||
if (this.workingChallenge.shortName.length < MIN_SHORTNAME_SIZE_FOR_CHALLENGES) errors += 'Tag name is too short\n';
|
|
||||||
if (!this.workingChallenge.summary) errors += 'Summary is required\n';
|
|
||||||
if (this.workingChallenge.summary.length > MAX_SUMMARY_SIZE_FOR_CHALLENGES) errors += 'Summary is too long\n';
|
|
||||||
if (!this.workingChallenge.description) errors += 'Description is required\n';
|
|
||||||
if (!this.workingChallenge.group) errors += 'Location of challenge is required ("Add to")\n';
|
|
||||||
if (!this.workingChallenge.categories || this.workingChallenge.categories.length === 0) errors += 'One or more categories must be selected\n';
|
|
||||||
if (errors) {
|
|
||||||
alert(errors);
|
|
||||||
} else {
|
|
||||||
this.workingChallenge.timestamp = new Date().getTime();
|
|
||||||
let categoryKeys = this.workingChallenge.categories;
|
|
||||||
let serverCategories = [];
|
|
||||||
categoryKeys.forEach(key => {
|
|
||||||
let catName = this.categoriesHashByKey[key];
|
|
||||||
serverCategories.push({
|
|
||||||
slug: key,
|
|
||||||
name: catName,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
this.workingChallenge.categories = serverCategories;
|
|
||||||
|
|
||||||
let challenge = await this.$store.dispatch('challenges:createChallenge', {challenge: this.workingChallenge});
|
if (!this.workingChallenge.name) errors.push(this.$t('nameRequired'));
|
||||||
// @TODO: When to remove from guild instead?
|
if (this.workingChallenge.shortName.length < MIN_SHORTNAME_SIZE_FOR_CHALLENGES) errors.push(this.$t('tagTooShort'));
|
||||||
this.user.balance -= this.workingChallenge.prize / 4;
|
if (!this.workingChallenge.summary) errors.push(this.$t('summaryRequired'));
|
||||||
|
if (this.workingChallenge.summary.length > MAX_SUMMARY_SIZE_FOR_CHALLENGES) errors.push(this.$t('summaryTooLong'));
|
||||||
|
if (!this.workingChallenge.description) errors.push(this.$t('descriptionRequired'));
|
||||||
|
if (!this.workingChallenge.group) errors.push(this.$t('locationRequired'));
|
||||||
|
if (!this.workingChallenge.categories || this.workingChallenge.categories.length === 0) errors.push(this.$t('categoiresRequired'));
|
||||||
|
|
||||||
this.$emit('createChallenge', challenge);
|
if (errors.length > 0) {
|
||||||
this.resetWorkingChallenge();
|
alert(errors.join('\n'));
|
||||||
|
return;
|
||||||
if (this.cloning) this.$store.state.challengeOptions.cloning = true;
|
|
||||||
|
|
||||||
this.$root.$emit('hide::modal', 'challenge-modal');
|
|
||||||
this.$router.push(`/challenges/${challenge._id}`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.workingChallenge.timestamp = new Date().getTime();
|
||||||
|
let categoryKeys = this.workingChallenge.categories;
|
||||||
|
let serverCategories = [];
|
||||||
|
categoryKeys.forEach(key => {
|
||||||
|
let catName = this.categoriesHashByKey[key];
|
||||||
|
serverCategories.push({
|
||||||
|
slug: key,
|
||||||
|
name: catName,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
this.workingChallenge.categories = serverCategories;
|
||||||
|
|
||||||
|
let challenge = await this.$store.dispatch('challenges:createChallenge', {challenge: this.workingChallenge});
|
||||||
|
// @TODO: When to remove from guild instead?
|
||||||
|
this.user.balance -= this.workingChallenge.prize / 4;
|
||||||
|
|
||||||
|
this.$emit('createChallenge', challenge);
|
||||||
|
this.resetWorkingChallenge();
|
||||||
|
|
||||||
|
if (this.cloning) this.$store.state.challengeOptions.cloning = true;
|
||||||
|
|
||||||
|
this.$root.$emit('hide::modal', 'challenge-modal');
|
||||||
|
this.$router.push(`/challenges/${challenge._id}`);
|
||||||
},
|
},
|
||||||
updateChallenge () {
|
updateChallenge () {
|
||||||
let categoryKeys = this.workingChallenge.categories;
|
let categoryKeys = this.workingChallenge.categories;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
.row.header-row
|
.row.header-row
|
||||||
.col-md-8.text-left
|
.col-md-8.text-left
|
||||||
h1(v-once) {{$t('findChallenges')}}
|
h1(v-once) {{$t('findChallenges')}}
|
||||||
|
h2(v-if='loading') {{ $t('loading') }}
|
||||||
.col-md-4
|
.col-md-4
|
||||||
// @TODO: implement sorting span.dropdown-label {{ $t('sortBy') }}
|
// @TODO: implement sorting span.dropdown-label {{ $t('sortBy') }}
|
||||||
b-dropdown(:text="$t('sort')", right=true)
|
b-dropdown(:text="$t('sort')", right=true)
|
||||||
@@ -63,6 +64,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
loading: true,
|
||||||
icons: Object.freeze({
|
icons: Object.freeze({
|
||||||
positiveIcon,
|
positiveIcon,
|
||||||
}),
|
}),
|
||||||
@@ -125,7 +127,9 @@ export default {
|
|||||||
this.$root.$emit('show::modal', 'challenge-modal');
|
this.$root.$emit('show::modal', 'challenge-modal');
|
||||||
},
|
},
|
||||||
async loadchallanges () {
|
async loadchallanges () {
|
||||||
|
this.loading = true;
|
||||||
this.challenges = await this.$store.dispatch('challenges:getUserChallenges');
|
this.challenges = await this.$store.dispatch('challenges:getUserChallenges');
|
||||||
|
this.loading = false;
|
||||||
},
|
},
|
||||||
challengeCreated (challenge) {
|
challengeCreated (challenge) {
|
||||||
this.challenges.push(challenge);
|
this.challenges.push(challenge);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ div
|
|||||||
.col-9
|
.col-9
|
||||||
router-link.title(:to="{ name: 'challenge', params: { challengeId: challenge._id } }")
|
router-link.title(:to="{ name: 'challenge', params: { challengeId: challenge._id } }")
|
||||||
strong {{challenge.name}}
|
strong {{challenge.name}}
|
||||||
p {{challenge.description}}
|
p {{challenge.summary || challenge.name}}
|
||||||
div
|
div
|
||||||
.svg-icon.member-icon(v-html="icons.memberIcon")
|
.svg-icon.member-icon(v-html="icons.memberIcon")
|
||||||
.member-count {{challenge.memberCount}}
|
.member-count {{challenge.memberCount}}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
|
// @TODO: Move this to a member directory
|
||||||
div
|
div
|
||||||
b-modal#members-modal(:title="$t('createGuild')", size='md')
|
b-modal#members-modal(:title="$t('createGuild')", size='md')
|
||||||
.header-wrap(slot="modal-header")
|
.header-wrap(slot="modal-header")
|
||||||
@@ -41,6 +42,9 @@ div
|
|||||||
span.dropdown-icon-item
|
span.dropdown-icon-item
|
||||||
.svg-icon.inline(v-html="icons.removeIcon")
|
.svg-icon.inline(v-html="icons.removeIcon")
|
||||||
span.text {{$t('removeManager2')}}
|
span.text {{$t('removeManager2')}}
|
||||||
|
.row(v-if='groupId === "challenge"')
|
||||||
|
.col-12.text-center
|
||||||
|
button.btn.btn-secondary(@click='loadMoreMembers()') {{ $t('loadMore') }}
|
||||||
.row.gradient(v-if='members.length > 3')
|
.row.gradient(v-if='members.length > 3')
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -203,6 +207,9 @@ export default {
|
|||||||
groupId () {
|
groupId () {
|
||||||
return this.$store.state.memberModalOptions.groupId || this.group._id;
|
return this.$store.state.memberModalOptions.groupId || this.group._id;
|
||||||
},
|
},
|
||||||
|
challengeId () {
|
||||||
|
return this.$store.state.memberModalOptions.challengeId;
|
||||||
|
},
|
||||||
sortedMembers () {
|
sortedMembers () {
|
||||||
let sortedMembers = this.members;
|
let sortedMembers = this.members;
|
||||||
if (!this.sortOption) return sortedMembers;
|
if (!this.sortOption) return sortedMembers;
|
||||||
@@ -312,6 +319,17 @@ export default {
|
|||||||
sort (option) {
|
sort (option) {
|
||||||
this.sortOption = option;
|
this.sortOption = option;
|
||||||
},
|
},
|
||||||
|
async loadMoreMembers () {
|
||||||
|
const lastMember = this.members[this.members.length - 1];
|
||||||
|
if (!lastMember) return;
|
||||||
|
|
||||||
|
let newMembers = await this.$store.dispatch('members:getChallengeMembers', {
|
||||||
|
challengeId: this.challengeId,
|
||||||
|
lastMemberId: lastMember._id,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.members = this.members.concat(newMembers);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,16 +1,7 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
form(
|
form(v-if="task", @submit.stop.prevent="submit()")
|
||||||
v-if="task",
|
b-modal#task-modal(size="sm", @hidden="onClose()")
|
||||||
@submit.stop.prevent="submit()",
|
.task-modal-header(slot="modal-header", :class="[cssClass]")
|
||||||
)
|
|
||||||
b-modal#task-modal(
|
|
||||||
size="sm",
|
|
||||||
@hidden="onClose()",
|
|
||||||
)
|
|
||||||
.task-modal-header(
|
|
||||||
slot="modal-header",
|
|
||||||
:class="[cssClass]",
|
|
||||||
)
|
|
||||||
.clearfix
|
.clearfix
|
||||||
h1.float-left {{ title }}
|
h1.float-left {{ title }}
|
||||||
.float-right.d-flex.align-items-center
|
.float-right.d-flex.align-items-center
|
||||||
@@ -27,10 +18,9 @@
|
|||||||
label(v-once) {{ $t('cost') }}
|
label(v-once) {{ $t('cost') }}
|
||||||
input(type="number", v-model="task.value", required, min="0")
|
input(type="number", v-model="task.value", required, min="0")
|
||||||
.svg-icon.gold(v-html="icons.gold")
|
.svg-icon.gold(v-html="icons.gold")
|
||||||
.option(v-if="['daily', 'todo'].indexOf(task.type) > -1")
|
.option(v-if="checklistEnabled")
|
||||||
label(v-once) {{ $t('checklist') }}
|
label(v-once) {{ $t('checklist') }}
|
||||||
br
|
br
|
||||||
| {{checklist}}
|
|
||||||
div(v-sortable='', @onsort='sortedChecklist')
|
div(v-sortable='', @onsort='sortedChecklist')
|
||||||
.inline-edit-input-group.checklist-group.input-group(v-for="(item, $index) in checklist")
|
.inline-edit-input-group.checklist-group.input-group(v-for="(item, $index) in checklist")
|
||||||
input.inline-edit-input.checklist-item.form-control(type="text", v-model="item.text")
|
input.inline-edit-input.checklist-item.form-control(type="text", v-model="item.text")
|
||||||
@@ -178,7 +168,7 @@
|
|||||||
|
|
||||||
.task-modal-footer(slot="modal-footer")
|
.task-modal-footer(slot="modal-footer")
|
||||||
span.cancel-task-btn(v-once, v-if="purpose === 'create'", @click="cancel()") {{ $t('cancel') }}
|
span.cancel-task-btn(v-once, v-if="purpose === 'create'", @click="cancel()") {{ $t('cancel') }}
|
||||||
span.delete-task-btn(v-once, v-else, @click="destroy()") {{ $t('delete') }}
|
span.delete-task-btn(v-once, v-if='canDelete', @click="destroy()") {{ $t('delete') }}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@@ -354,6 +344,10 @@
|
|||||||
background-size: 10px 10px;
|
background-size: 10px 10px;
|
||||||
background-image: url(~client/assets/svg/for-css/positive.svg);
|
background-image: url(~client/assets/svg/for-css/positive.svg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
cursor: move;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.delete-task-btn, .cancel-task-btn {
|
.delete-task-btn, .cancel-task-btn {
|
||||||
@@ -486,6 +480,18 @@ export default {
|
|||||||
user: 'user.data',
|
user: 'user.data',
|
||||||
dayMapping: 'constants.DAY_MAPPING',
|
dayMapping: 'constants.DAY_MAPPING',
|
||||||
}),
|
}),
|
||||||
|
checklistEnabled () {
|
||||||
|
return ['daily', 'todo'].indexOf(this.task.type) > -1 && !this.isOriginalChallengeTask;
|
||||||
|
},
|
||||||
|
isOriginalChallengeTask () {
|
||||||
|
let isUserChallenge = Boolean(this.task.userId);
|
||||||
|
return !isUserChallenge && (this.challengeId || this.task.challenge && this.task.challenge.id);
|
||||||
|
},
|
||||||
|
canDelete () {
|
||||||
|
let isUserChallenge = Boolean(this.task.userId);
|
||||||
|
let activeChallenge = isUserChallenge && this.task.challenge && this.task.challenge.id && !this.task.challenge.broken;
|
||||||
|
return this.purpose !== 'create' && !activeChallenge;
|
||||||
|
},
|
||||||
title () {
|
title () {
|
||||||
const type = this.$t(this.task.type);
|
const type = this.$t(this.task.type);
|
||||||
return this.$t(this.purpose === 'edit' ? 'editATask' : 'createTask', {type});
|
return this.$t(this.purpose === 'edit' ? 'editATask' : 'createTask', {type});
|
||||||
@@ -620,6 +626,7 @@ export default {
|
|||||||
destroy () {
|
destroy () {
|
||||||
if (!confirm('Are you sure you want to delete this task?')) return;
|
if (!confirm('Are you sure you want to delete this task?')) return;
|
||||||
this.destroyTask(this.task);
|
this.destroyTask(this.task);
|
||||||
|
this.$emit('taskDestroyed', this.task);
|
||||||
this.$root.$emit('hide::modal', 'task-modal');
|
this.$root.$emit('hide::modal', 'task-modal');
|
||||||
},
|
},
|
||||||
cancel () {
|
cancel () {
|
||||||
|
|||||||
@@ -21,7 +21,11 @@ export default {
|
|||||||
return `/paypal/subscribe?_id=${this.credentials.API_ID}&apiToken=${this.credentials.API_TOKEN}&sub=${this.subscriptionPlan}`;
|
return `/paypal/subscribe?_id=${this.credentials.API_ID}&apiToken=${this.credentials.API_TOKEN}&sub=${this.subscriptionPlan}`;
|
||||||
},
|
},
|
||||||
paypalPurchaseLink () {
|
paypalPurchaseLink () {
|
||||||
if (!this.subscription) return '';
|
if (!this.subscription) {
|
||||||
|
this.subscription = {
|
||||||
|
key: 'basic_earned',
|
||||||
|
};
|
||||||
|
}
|
||||||
let couponString = '';
|
let couponString = '';
|
||||||
if (this.subscription.coupon) couponString = `&coupon=${this.subscription.coupon}`;
|
if (this.subscription.coupon) couponString = `&coupon=${this.subscription.coupon}`;
|
||||||
return `/paypal/subscribe?_id=${this.credentials.API_ID}&apiToken=${this.credentials.API_TOKEN}&sub=${this.subscription.key}${couponString}`;
|
return `/paypal/subscribe?_id=${this.credentials.API_ID}&apiToken=${this.credentials.API_TOKEN}&sub=${this.subscription.key}${couponString}`;
|
||||||
|
|||||||
@@ -17,10 +17,9 @@ export async function joinChallenge (store, payload) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function leaveChallenge (store, payload) {
|
export async function leaveChallenge (store, payload) {
|
||||||
let response = await axios.post(`/api/v3/challenges/${payload.challengeId}/leave`, {
|
let url = `/api/v3/challenges/${payload.challengeId}/leave`;
|
||||||
data: {
|
let response = await axios.post(url, {
|
||||||
keep: payload.keep,
|
keep: payload.keep,
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return response.data.data;
|
return response.data.data;
|
||||||
|
|||||||
@@ -27,6 +27,11 @@ export async function getGroupInvites (store, payload) {
|
|||||||
|
|
||||||
export async function getChallengeMembers (store, payload) {
|
export async function getChallengeMembers (store, payload) {
|
||||||
let url = `${apiV3Prefix}/challenges/${payload.challengeId}/members?includeAllPublicFields=true`;
|
let url = `${apiV3Prefix}/challenges/${payload.challengeId}/members?includeAllPublicFields=true`;
|
||||||
|
|
||||||
|
if (payload.lastMemberId) {
|
||||||
|
url += `&lastId=${payload.lastMemberId}`;
|
||||||
|
}
|
||||||
|
|
||||||
let response = await axios.get(url);
|
let response = await axios.get(url);
|
||||||
return response.data.data;
|
return response.data.data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export async function sendAction (store, payload) {
|
|||||||
partySize: store.state.party.members.data.length,
|
partySize: store.state.party.members.data.length,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (store.state.party) {
|
if (store.state.party && store.state.party.data) {
|
||||||
partyData = {
|
partyData = {
|
||||||
partyID: store.state.party.data._id,
|
partyID: store.state.party.data._id,
|
||||||
partySize: store.state.party.data.memberCount,
|
partySize: store.state.party.data.memberCount,
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ export default function () {
|
|||||||
memberModalOptions: {
|
memberModalOptions: {
|
||||||
viewingMembers: [],
|
viewingMembers: [],
|
||||||
groupId: '',
|
groupId: '',
|
||||||
|
challengeId: '',
|
||||||
group: {},
|
group: {},
|
||||||
},
|
},
|
||||||
openedItemRows: [],
|
openedItemRows: [],
|
||||||
|
|||||||
@@ -116,5 +116,12 @@
|
|||||||
"haveNoChallenges": "You don't have any Challenges",
|
"haveNoChallenges": "You don't have any Challenges",
|
||||||
"loadMore": "Load More",
|
"loadMore": "Load More",
|
||||||
"exportChallengeCsv": "Export Challenge",
|
"exportChallengeCsv": "Export Challenge",
|
||||||
"editingChallenge": "Editing Challenge"
|
"editingChallenge": "Editing Challenge",
|
||||||
|
"nameRequired": "Name is required",
|
||||||
|
"tagTooShort": "Tag name is too short",
|
||||||
|
"summaryRequired": "Summary is required",
|
||||||
|
"summaryTooLong": "Summary is too long",
|
||||||
|
"descriptionRequired": "Description is required",
|
||||||
|
"locationRequired": "Location of challenge is required ('Add to')",
|
||||||
|
"categoiresRequired": "One or more categories must be selected"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user