fix some lint warnings (#12488)

* prevent some lint warnings by turning off some rules we don't seem to care about

require-prop-types has 167 violations

require-default-prop has 93 violations

* fix some lint warnings by adding eslint-disable-line comments

* prevent lint warnings by moving vue hooks to a different order

* apply some automatic lint fixes

* fix lint error by making line shorter

* prevent lint warnings from whitespace and @input, @click positioning

* revert 723fa38271173c8c005e0e8a2520292b9dd7e738

Reenables vue/require-prop-types and vue/require-default-prop
This commit is contained in:
Alys 2020-08-26 02:06:39 +10:00 committed by GitHub
parent 9caacc8f6c
commit 5165d491b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 148 additions and 148 deletions

View file

@ -216,7 +216,7 @@ export default {
this.$root.$emit('bv::hide::modal', 'choose-class');
},
clickSelectClass (heroClass) {
if (this.user.flags.classSelected && !window.confirm(this.$t('changeClassConfirmCost'))) return;
if (this.user.flags.classSelected && !window.confirm(this.$t('changeClassConfirmCost'))) return; // eslint-disable-line no-alert
this.$store.dispatch('user:changeClass', { query: { class: heroClass } });
},
clickDisableClasses () {

View file

@ -530,7 +530,7 @@ export default {
});
},
async addMissedDay (numberOfDays) {
if (!window.confirm(`Are you sure you want to reset the day by ${numberOfDays} day(s)?`)) return;
if (!window.confirm(`Are you sure you want to reset the day by ${numberOfDays} day(s)?`)) return; // eslint-disable-line no-alert
const date = moment(this.user.lastCron).subtract(numberOfDays, 'days').toDate();

View file

@ -360,12 +360,12 @@ export default {
},
async register () {
if (!this.email) {
window.alert(this.$t('missingEmail'));
window.alert(this.$t('missingEmail')); // eslint-disable-line no-alert
return;
}
if (this.password !== this.passwordConfirm) {
window.alert(this.$t('passwordConfirmationMatch'));
window.alert(this.$t('passwordConfirmationMatch')); // eslint-disable-line no-alert
return;
}
@ -381,7 +381,7 @@ export default {
} catch (e) {
if (e.response.data.data && e.response.data.data.errors) {
const message = e.response.data.data.errors.map(error => `${error.message}\n`);
window.alert(message);
window.alert(message); // eslint-disable-line no-alert
}
}
},

View file

@ -750,13 +750,13 @@ export default {
const { code } = query;
const hasError = query.hasError === 'true';
if (hasError) {
window.alert(query.message);
window.alert(query.message); // eslint-disable-line no-alert
this.$router.push({ name: 'login' });
return;
}
if (!code) {
window.alert(this.$t('invalidPasswordResetCode'));
window.alert(this.$t('invalidPasswordResetCode')); // eslint-disable-line no-alert
this.$router.push({ name: 'login' });
return;
}
@ -797,12 +797,12 @@ export default {
async register () {
// @TODO do not use alert
if (!this.email) {
window.alert(this.$t('missingEmail'));
window.alert(this.$t('missingEmail')); // eslint-disable-line no-alert
return;
}
if (this.password !== this.passwordConfirm) {
window.alert(this.$t('passwordConfirmationMatch'));
window.alert(this.$t('passwordConfirmationMatch')); // eslint-disable-line no-alert
return;
}
@ -918,7 +918,7 @@ export default {
},
async forgotPasswordLink () {
if (!this.username) {
window.alert(this.$t('missingEmail'));
window.alert(this.$t('missingEmail')); // eslint-disable-line no-alert
return;
}
@ -926,17 +926,17 @@ export default {
email: this.username,
});
window.alert(this.$t('newPassSent'));
window.alert(this.$t('newPassSent')); // eslint-disable-line no-alert
},
async resetPasswordSetNewOneLink () {
if (!this.password) {
window.alert(this.$t('missingNewPassword'));
window.alert(this.$t('missingNewPassword')); // eslint-disable-line no-alert
return;
}
if (this.password !== this.passwordConfirm) {
// @TODO i18n and don't use alerts
window.alert(this.$t('passwordConfirmationMatch'));
window.alert(this.$t('passwordConfirmationMatch')); // eslint-disable-line no-alert
return;
}
@ -947,7 +947,7 @@ export default {
});
if (res.data.message) {
window.alert(res.data.message);
window.alert(res.data.message); // eslint-disable-line no-alert
}
this.password = '';

View file

@ -545,7 +545,7 @@ export default {
if (this.workingChallenge.prize > this.maxPrize) errors.push(this.$t('cantAfford'));
if (errors.length > 0) {
window.alert(errors.join('\n'));
window.alert(errors.join('\n')); // eslint-disable-line no-alert
this.loading = false;
return;
}

View file

@ -148,7 +148,7 @@ export default {
this.$router.push('/challenges/myChallenges');
},
async deleteChallenge () {
if (!window.confirm(this.$t('sureDelCha'))) return;
if (!window.confirm(this.$t('sureDelCha'))) return; // eslint-disable-line no-alert
this.challenge = await this.$store.dispatch('challenges:deleteChallenge', {
challengeId: this.challengeId,
prize: this.prize,

View file

@ -329,7 +329,7 @@ export default {
});
},
async remove () {
if (!window.confirm(this.$t('areYouSureDeleteMessage'))) return;
if (!window.confirm(this.$t('areYouSureDeleteMessage'))) return; // eslint-disable-line no-alert
const message = this.msg;
this.$emit('message-removed', message);

View file

@ -599,7 +599,7 @@ export default {
return this.user.notifications.some(n => n.type === 'NEW_CHAT_MESSAGE' && n.data.group.id === groupId);
},
async join () {
if (this.group.cancelledPlan && !window.confirm(this.$t('aboutToJoinCancelledGroupPlan'))) {
if (this.group.cancelledPlan && !window.confirm(this.$t('aboutToJoinCancelledGroupPlan'))) { // eslint-disable-line no-alert
return;
}
await this.$store.dispatch('guilds:join', { groupId: this.group._id, type: 'guild' });
@ -613,7 +613,7 @@ export default {
});
// @TODO: Get challenges and ask to keep or remove
if (!window.confirm('Are you sure you want to leave?')) return;
if (!window.confirm('Are you sure you want to leave?')) return; // eslint-disable-line no-alert
const keep = true;
this.leave(keep);
},

View file

@ -531,7 +531,7 @@ export default {
async submit () {
if (this.$store.state.user.data.balance < 1 && !this.workingGroup.id) {
// @TODO: Add proper notifications
window.alert(this.$t('notEnoughGems'));
window.alert(this.$t('notEnoughGems')); // eslint-disable-line no-alert
return;
// @TODO return $rootScope.openModal('buyGems', {track:"Gems > Gems > Create Group"});
}
@ -545,12 +545,12 @@ export default {
if (!this.isParty && (!this.workingGroup.categories || this.workingGroup.categories.length === 0)) errors.push(this.$t('categoiresRequired'));
if (errors.length > 0) {
window.alert(errors.join('\n'));
window.alert(errors.join('\n')); // eslint-disable-line no-alert
return;
}
// @TODO: Add proper notifications
if (!this.workingGroup.id && !window.confirm(this.$t('confirmGuild'))) return;
if (!this.workingGroup.id && !window.confirm(this.$t('confirmGuild'))) return; // eslint-disable-line no-alert
if (!this.workingGroup.privateGuild) {
this.workingGroup.privacy = 'public';

View file

@ -607,14 +607,14 @@ export default {
groupId: this.groupId,
memberId,
});
window.alert(this.$t('managerAdded'));
window.alert(this.$t('managerAdded')); // eslint-disable-line no-alert
},
async removeManager (memberId) {
await this.$store.dispatch('guilds:removeManager', {
groupId: this.groupId,
memberId,
});
window.alert(this.$t('managerRemoved'));
window.alert(this.$t('managerRemoved')); // eslint-disable-line no-alert
},
close () {
this.$root.$emit('bv::hide::modal', 'members-modal');
@ -672,7 +672,7 @@ export default {
groupData.leader = member._id;
await this.$store.dispatch('guilds:update', { group: groupData });
window.alert(this.$t('leaderChanged'));
window.alert(this.$t('leaderChanged')); // eslint-disable-line no-alert
groupData.leader = member;
this.$root.$emit('updatedGroup', groupData);

View file

@ -261,7 +261,7 @@ export default {
},
async join () {
// @TODO: This needs to be in the notifications where users will now accept invites
if (this.guild.cancelledPlan && !window.confirm(window.env.t('aboutToJoinCancelledGroupPlan'))) {
if (this.guild.cancelledPlan && !window.confirm(window.env.t('aboutToJoinCancelledGroupPlan'))) { // eslint-disable-line no-alert
return;
}
await this.$store.dispatch('guilds:join', { groupId: this.guild._id, type: 'guild' });

View file

@ -262,7 +262,7 @@ export default {
for (const uuid in this.group.quest.members) {
if (this.group.quest.members[uuid]) count += 1;
}
if (!window.confirm(this.$t('questConfirm', {
if (!window.confirm(this.$t('questConfirm', { // eslint-disable-line no-alert
questmembers: count,
totalmembers: this.group.memberCount,
}))) return;
@ -274,7 +274,7 @@ export default {
this.close();
},
async questCancel () {
if (!window.confirm(this.$t('sureCancel'))) return;
if (!window.confirm(this.$t('sureCancel'))) return; // eslint-disable-line no-alert
const quest = await this.$store.dispatch('quests:sendAction', { groupId: this.group._id, action: 'quests/cancel' });
this.group.quest = quest;
this.close();

View file

@ -412,13 +412,13 @@ export default {
this.$root.$emit('bv::show::modal', 'participant-list');
},
async questAbort () {
if (!window.confirm(this.$t('sureAbort'))) return;
if (!window.confirm(this.$t('doubleSureAbort'))) return;
if (!window.confirm(this.$t('sureAbort'))) return; // eslint-disable-line no-alert
if (!window.confirm(this.$t('doubleSureAbort'))) return; // eslint-disable-line no-alert
const quest = await this.$store.dispatch('quests:sendAction', { groupId: this.group._id, action: 'quests/abort' });
this.group.quest = quest;
},
async questLeave () {
if (!window.confirm(this.$t('sureLeave'))) return;
if (!window.confirm(this.$t('sureLeave'))) return; // eslint-disable-line no-alert
const quest = await this.$store.dispatch('quests:sendAction', { groupId: this.group._id, action: 'quests/leave' });
this.group.quest = quest;
},

View file

@ -147,15 +147,6 @@ export default {
inviteModalGroupType: undefined,
};
},
watch: {
hideHeader () {
this.$nextTick(() => {
if (this.$refs.partyMembersDiv) {
this.setPartyMembersWidth({ width: this.$refs.partyMembersDiv.clientWidth });
}
});
},
},
computed: {
...mapGetters({
user: 'user:data',
@ -202,6 +193,15 @@ export default {
return ['groupPlan', 'privateMessages'].includes(this.$route.name);
},
},
watch: {
hideHeader () {
this.$nextTick(() => {
if (this.$refs.partyMembersDiv) {
this.setPartyMembersWidth({ width: this.$refs.partyMembersDiv.clientWidth });
}
});
},
},
created () {
if (this.user.party && this.user.party._id) {
this.$store.state.memberModalOptions.groupId = this.user.party._id;

View file

@ -80,7 +80,7 @@ export default {
return;
}
if (!window.confirm(this.$t('confirmNeedsWork'))) return;
if (!window.confirm(this.$t('confirmNeedsWork'))) return; // eslint-disable-line no-alert
await this.$store.dispatch('tasks:needsWork', {
taskId: this.notification.data.groupTaskId,

View file

@ -60,7 +60,7 @@ export default {
async accept () {
const group = this.notification.data;
if (group.cancelledPlan && !window.confirm(this.$t('aboutToJoinCancelledGroupPlan'))) {
if (group.cancelledPlan && !window.confirm(this.$t('aboutToJoinCancelledGroupPlan'))) { // eslint-disable-line no-alert
return;
}

View file

@ -40,7 +40,7 @@ export default {
async accept () {
const group = this.notification.data;
if (group.cancelledPlan && !window.confirm(this.$t('aboutToJoinCancelledGroupPlan'))) {
if (group.cancelledPlan && !window.confirm(this.$t('aboutToJoinCancelledGroupPlan'))) { // eslint-disable-line no-alert
return;
}

View file

@ -73,19 +73,16 @@ export default {
components: {
userLabel,
},
filters: {
timeAgo (value) {
return moment(value).fromNow();
},
},
props: [
'activeKey', 'uuid', 'backer', 'displayName',
'username', 'contributor', 'lastMessageText',
'lastMessageDate',
],
computed: {
...mapState({
userLoggedIn: 'user.data',
}),
isBlocked () {
return this.userLoggedIn.inbox.blocks.includes(this.uuid);
},
},
data () {
return {
icons: Object.freeze({
@ -94,9 +91,12 @@ export default {
}),
};
},
filters: {
timeAgo (value) {
return moment(value).fromNow();
computed: {
...mapState({
userLoggedIn: 'user.data',
}),
isBlocked () {
return this.userLoggedIn.inbox.blocks.includes(this.uuid);
},
},
methods: {

View file

@ -195,7 +195,7 @@ export default {
});
},
async remove () {
if (!window.confirm(this.$t('areYouSureDeleteMessage'))) return;
if (!window.confirm(this.$t('areYouSureDeleteMessage'))) return; // eslint-disable-line no-alert
const message = this.msg;
this.$emit('message-removed', message);

View file

@ -216,6 +216,14 @@ export default {
disablePerfectScroll: false,
};
},
computed: {
...mapState({ user: 'user.data' }),
// @TODO: We need a different lazy load mechnism.
// But honestly, adding a paging route to chat would solve this
messages () {
return this.chat;
},
},
mounted () {
this.$el.addEventListener('selectstart', () => this.handleSelectStart());
this.$el.addEventListener('mouseup', () => this.handleSelectChange());
@ -228,14 +236,6 @@ export default {
this.$el.removeEventListener('mouseup', () => this.handleSelectChange());
window.removeEventListener('scroll', this.handleScroll);
},
computed: {
...mapState({ user: 'user.data' }),
// @TODO: We need a different lazy load mechnism.
// But honestly, adding a paging route to chat would solve this
messages () {
return this.chat;
},
},
methods: {
async triggerLoad () {
const { container } = this.$refs;

View file

@ -102,11 +102,11 @@ export default {
scope: 'payments:widget',
popup: true,
}, response => {
if (response.error) return window.alert(response.error);
if (response.error) return window.alert(response.error); // eslint-disable-line
const url = '/amazon/verifyAccessToken';
return axios.post(url, response).catch(e => {
window.alert(e.message);
window.alert(e.message); // eslint-disable-line no-alert
});
});
},

View file

@ -122,7 +122,7 @@ export default {
this.amazonPayments.orderReferenceId = response.data.data.orderReferenceId;
this.amazonInitWidgets();
} else {
window.alert(response.message);
window.alert(response.message); // eslint-disable-line no-alert
}
}
});

View file

@ -781,7 +781,7 @@ export default {
openDayStartModal () {
const nextCron = this.calculateNextCron();
// @TODO: Add generic modal
if (!window.confirm(this.$t('sureChangeCustomDayStartTime', { time: nextCron }))) return;
if (!window.confirm(this.$t('sureChangeCustomDayStartTime', { time: nextCron }))) return; // eslint-disable-line no-alert
this.saveDayStart();
// $rootScope.openModal('change-day-start', { scope: $scope });
},
@ -807,12 +807,12 @@ export default {
this.user.flags.verifiedUsername = true;
} else if (attribute === 'email') {
this.user.auth.local.email = updates.newEmail;
window.alert(this.$t('emailSuccess'));
window.alert(this.$t('emailSuccess')); // eslint-disable-line no-alert
}
},
async changeDisplayName (newName) {
await axios.put('/api/v4/user/', { 'profile.name': newName });
window.alert(this.$t('displayNameSuccess'));
window.alert(this.$t('displayNameSuccess')); // eslint-disable-line no-alert
this.user.profile.name = newName;
this.temporaryDisplayName = newName;
},
@ -844,17 +844,17 @@ export default {
}
},
async changeClassForUser (confirmationNeeded) {
if (confirmationNeeded && !window.confirm(this.$t('changeClassConfirmCost'))) return;
if (confirmationNeeded && !window.confirm(this.$t('changeClassConfirmCost'))) return; // eslint-disable-line no-alert
try {
changeClass(this.user);
await axios.post('/api/v4/user/change-class');
} catch (e) {
window.alert(e.message);
window.alert(e.message); // eslint-disable-line no-alert
}
},
async addLocalAuth () {
await axios.post('/api/v4/user/auth/local/register', this.localAuth);
window.alert(this.$t('addedLocalAuth'));
window.alert(this.$t('addedLocalAuth')); // eslint-disable-line no-alert
},
restoreEmptyUsername () {
if (this.usernameUpdates.username.length < 1) {

View file

@ -577,7 +577,7 @@ export default {
if (
petsRemaining < 0
&& !window.confirm(this.$t('purchasePetItemConfirm', { itemText: this.item.text }))
&& !window.confirm(this.$t('purchasePetItemConfirm', { itemText: this.item.text })) // eslint-disable-line no-alert
) return;
}

View file

@ -85,7 +85,7 @@ export default {
purchaseType: 'keys',
pinType: 'keys',
buy: () => {
if (!window.confirm(this.$t('releasePetsConfirm'))) return;
if (!window.confirm(this.$t('releasePetsConfirm'))) return; // eslint-disable-line no-alert
try {
this.$store.dispatch('shops:releasePets', { user: this.user });
this.text(this.$t('releasePetsSuccess'));
@ -93,7 +93,7 @@ export default {
// Reload because achievement is set in user.save instead of common
window.location.reload(true);
} catch (err) {
window.alert(err.message);
window.alert(err.message); // eslint-disable-line no-alert
}
},
},
@ -108,7 +108,7 @@ export default {
purchaseType: 'keys',
pinType: 'keys',
buy: () => {
if (!window.confirm(this.$t('releaseMountsConfirm'))) return;
if (!window.confirm(this.$t('releaseMountsConfirm'))) return; // eslint-disable-line no-alert
try {
this.$store.dispatch('shops:releaseMounts', { user: this.user });
this.text(this.$t('releaseMountsSuccess'));
@ -116,7 +116,7 @@ export default {
// Reload because achievement is set in user.save instead of common
window.location.reload(true);
} catch (err) {
window.alert(err.message);
window.alert(err.message); // eslint-disable-line no-alert
}
},
},
@ -131,7 +131,7 @@ export default {
purchaseType: 'keys',
pinType: 'keys',
buy: () => {
if (!window.confirm(this.$t('releaseBothConfirm'))) return;
if (!window.confirm(this.$t('releaseBothConfirm'))) return; // eslint-disable-line no-alert
try {
this.$store.dispatch('shops:releaseBoth', { user: this.user });
this.text(this.$t('releaseBothSuccess'));
@ -139,7 +139,7 @@ export default {
// Reload because achievement is set in user.save instead of common
window.location.reload(true);
} catch (err) {
window.alert(err.message);
window.alert(err.message); // eslint-disable-line no-alert
}
},
},

View file

@ -2,9 +2,9 @@
<div>
<approval-modal :task="task" />
<div
class="claim-bottom-message d-flex align-items-center"
v-if="!(userIsAssigned && task.group.approval.approved
&& !task.completed && task.type !== 'habit')"
class="claim-bottom-message d-flex align-items-center"
>
<div
class="mr-auto ml-2"
@ -162,7 +162,7 @@ export default {
this.sync();
},
async unassign () {
if (!window.confirm(this.$t('confirmUnClaim'))) return;
if (!window.confirm(this.$t('confirmUnClaim'))) return; // eslint-disable-line no-alert
let taskId = this.task._id;
// If we are on the user task
@ -191,7 +191,7 @@ export default {
this.sync();
},
needsWork () {
if (!window.confirm(this.$t('confirmNeedsWork'))) return;
if (!window.confirm(this.$t('confirmNeedsWork'))) return; // eslint-disable-line no-alert
const userIdNeedsMoreWork = this.task.group.assignedUsers[0];
this.$store.dispatch('tasks:needsWork', {
taskId: this.task._id,

View file

@ -64,7 +64,7 @@ export default {
this.task.approvals.splice(index, 1);
},
needsWork (index) {
if (!window.confirm(this.$t('confirmNeedsWork'))) return;
if (!window.confirm(this.$t('confirmNeedsWork'))) return; // eslint-disable-line no-alert
const userIdNeedsMoreWork = this.task.group.assignedUsers[index];
this.$store.dispatch('tasks:needsWork', {
taskId: this.task._id,

View file

@ -130,7 +130,7 @@ export default {
this.close();
},
removeTask () {
if (!window.confirm('Are you sure you want to delete this task?')) return;
if (!window.confirm('Are you sure you want to delete this task?')) return; // eslint-disable-line no-alert
this.destroyTask(this.brokenChallengeTask);
this.close();
},

View file

@ -33,7 +33,7 @@
export default {
methods: {
clearTodos () {
if (!window.confirm(this.$t('clearCompletedConfirm'))) return;
if (!window.confirm(this.$t('clearCompletedConfirm'))) return; // eslint-disable-line no-alert
this.$store.dispatch('tasks:clearCompletedTodos');
},
},

View file

@ -1043,7 +1043,7 @@ export default {
},
destroy () {
const type = this.$t(this.task.type);
if (!window.confirm(this.$t('sureDeleteType', { type }))) return;
if (!window.confirm(this.$t('sureDeleteType', { type }))) return; // eslint-disable-line no-alert
this.destroyTask(this.task);
this.$emit('taskDestroyed', this.task);
},

View file

@ -134,7 +134,7 @@
</div>
<div
v-if="groupAccessRequiredAndOnPersonalPage
&& (task.type === 'daily' || task.type === 'todo')"
&& (task.type === 'daily' || task.type === 'todo')"
class="summary-sentence py-3 px-4"
v-html="summarySentence"
>
@ -1523,7 +1523,7 @@ export default {
},
destroy () {
const type = this.$t(this.task.type);
if (!window.confirm(this.$t('sureDeleteType', { type }))) return;
if (!window.confirm(this.$t('sureDeleteType', { type }))) return; // eslint-disable-line no-alert
this.destroyTask(this.task);
this.$emit('taskDestroyed', this.task);
this.$root.$emit('bv::hide::modal', 'task-modal');

View file

@ -1,7 +1,6 @@
<template>
<datepicker
v-model="value"
@input="upDate($event)"
:calendarButton="true"
:calendarButtonIconContent="icons.calendar"
:bootstrapStyling="true"
@ -11,22 +10,23 @@
:class="{disabled: disabled}"
:highlighted="highlighted"
calendar-class="calendar-padding"
@input="upDate($event)"
>
<div slot="beforeCalendarHeader">
<div class="datetime-buttons">
<button
<button
class="btn btn-flat"
@click="setToday()"
type="button"
@click="setToday()"
>
{{ $t('today') }}
</button>
<button
class="btn btn-flat"
@click="setTomorrow()"
type="button"
>
{{ $t('tomorrow') }}
class="btn btn-flat"
type="button"
@click="setTomorrow()"
>
{{ $t('tomorrow') }}
</button>
</div>
</div>

View file

@ -142,11 +142,11 @@ export const avatarEditorUtilies = { // eslint-disable-line import/prefer-defaul
if (loginIncentives.indexOf(path) === -1) {
if (fullSet) {
if (window.confirm(this.$t('purchaseFor', { cost: cost * 4 })) !== true) return;
if (window.confirm(this.$t('purchaseFor', { cost: cost * 4 })) !== true) return; // eslint-disable-line no-alert
// @TODO: implement gem modal
// if (this.user.balance < cost) return $rootScope.openModal('buyGems');
} else if (!get(this.user, `purchased.${path}`)) {
if (window.confirm(this.$t('purchaseFor', { cost: cost * 4 })) !== true) return;
if (window.confirm(this.$t('purchaseFor', { cost: cost * 4 })) !== true) return; // eslint-disable-line no-alert
// @TODO: implement gem modal
// if (this.user.balance < cost) return $rootScope.openModal('buyGems');
}
@ -161,7 +161,7 @@ export const avatarEditorUtilies = { // eslint-disable-line import/prefer-defaul
});
this.backgroundUpdate = new Date();
} catch (e) {
window.alert(e.message);
window.alert(e.message); // eslint-disable-line no-alert
}
},
async buy (item) {
@ -179,7 +179,7 @@ export const avatarEditorUtilies = { // eslint-disable-line import/prefer-defaul
});
this.backgroundUpdate = new Date();
} catch (e) {
window.alert(e.message);
window.alert(e.message); // eslint-disable-line no-alert
}
},
},

View file

@ -39,7 +39,7 @@ export default {
};
const purchaseForKey = currencyToPurchaseForKey[currency];
return window.confirm(this.$t(purchaseForKey, { cost }));
return window.confirm(this.$t(purchaseForKey, { cost })); // eslint-disable-line no-alert
},
},
};

View file

@ -136,7 +136,7 @@ export default {
// @TODO handle with normal notifications?
const responseStatus = response.status;
if (responseStatus >= 400) {
window.alert(`Error: ${response.message}`);
window.alert(`Error: ${response.message}`); // eslint-disable-line no-alert
return;
}
@ -217,7 +217,7 @@ export default {
// Success
window.location.reload(true);
// error
window.alert(response.message);
window.alert(response.message); // eslint-disable-line no-alert
},
});
},
@ -260,7 +260,7 @@ export default {
this.amazonPayments.type = data.type;
},
amazonOnError (error) {
window.alert(error.getErrorMessage());
window.alert(error.getErrorMessage()); // eslint-disable-line no-alert
this.reset();
},
// Make sure the amazon session is reset between different sessions and after each purchase
@ -336,7 +336,7 @@ export default {
this.loading = false;
} catch (e) {
window.alert(e.response.data.message);
window.alert(e.response.data.message); // eslint-disable-line no-alert
}
},
},

View file

@ -626,48 +626,6 @@ export default {
}
});
},
async mounted () {
// notification click to refresh
this.$root.$on(EVENTS.PM_REFRESH, async () => {
await this.reload();
this.selectFirstConversation();
});
// header sync button
this.$root.$on(EVENTS.RESYNC_COMPLETED, async () => {
await this.reload();
this.selectFirstConversation();
});
await this.reload();
// close members modal if the Private Messages page is opened in an existing tab
this.$root.$emit('bv::hide::modal', 'profile');
this.$root.$emit('bv::hide::modal', 'members-modal');
const data = this.$store.state.privateMessageOptions;
if (data && data.userIdToMessage) {
this.initiatedConversation = {
uuid: data.userIdToMessage,
user: data.displayName,
username: data.username,
backer: data.backer,
contributor: data.contributor,
userStyles: data.userStyles,
canReceive: true,
};
this.$store.state.privateMessageOptions = {};
this.selectConversation(this.initiatedConversation.uuid);
}
},
beforeDestroy () {
this.$root.$off(EVENTS.RESYNC_COMPLETED);
this.$root.$off(EVENTS.PM_REFRESH);
},
computed: {
...mapState({ user: 'user.data' }),
canLoadMore () {
@ -819,6 +777,48 @@ export default {
|| this.disabledTexts !== null;
},
},
async mounted () {
// notification click to refresh
this.$root.$on(EVENTS.PM_REFRESH, async () => {
await this.reload();
this.selectFirstConversation();
});
// header sync button
this.$root.$on(EVENTS.RESYNC_COMPLETED, async () => {
await this.reload();
this.selectFirstConversation();
});
await this.reload();
// close members modal if the Private Messages page is opened in an existing tab
this.$root.$emit('bv::hide::modal', 'profile');
this.$root.$emit('bv::hide::modal', 'members-modal');
const data = this.$store.state.privateMessageOptions;
if (data && data.userIdToMessage) {
this.initiatedConversation = {
uuid: data.userIdToMessage,
user: data.displayName,
username: data.username,
backer: data.backer,
contributor: data.contributor,
userStyles: data.userStyles,
canReceive: true,
};
this.$store.state.privateMessageOptions = {};
this.selectConversation(this.initiatedConversation.uuid);
}
},
beforeDestroy () {
this.$root.$off(EVENTS.RESYNC_COMPLETED);
this.$root.$off(EVENTS.PM_REFRESH);
},
methods: {
async reload () {

View file

@ -60,7 +60,7 @@ export async function join (store, payload) {
try {
response = await axios.post(`/api/v4/groups/${groupId}/join`);
} catch (err) {
window.alert(err.response.data.message);
window.alert(err.response.data.message); // eslint-disable-line no-alert
return null;
}