-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
daf9443
commit 2414f0a
Showing
23 changed files
with
1,369 additions
and
946 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"env": { | ||
"test": { | ||
"plugins": ["transform-object-rest-spread"], | ||
"presets": [ | ||
["env", { "targets": { "node": "current" }}] | ||
] | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ module.exports = { | |
sourceType: 'module' | ||
}, | ||
env: { | ||
jest: true, | ||
browser: true, | ||
node: true | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<template> | ||
<div class="columns is-mobile field has-text-centered"> | ||
<div class="column control has-text-centered"> | ||
<hc-button color="button" | ||
:disabled="isPending" | ||
:isLoading="isPending" | ||
@click="click"> | ||
<template v-if="isBlacklisted()"> | ||
<hc-icon icon="ban" :class="['icon-left', 'is-danger']" /> {{ $t('component.blacklist.buttonLabelUnblock') }} | ||
</template> | ||
<template v-else> | ||
<hc-icon icon="ban" class="icon-left" /> {{ $t('component.blacklist.buttonLabelBlock') }} | ||
</template> | ||
</hc-button> | ||
</div> | ||
</div> | ||
</template> | ||
<script> | ||
import Icon from '~/components/Global/Elements/Icon/Icon.vue' | ||
import Button from '~/components/Global/Elements/Button/Button.vue' | ||
import { mapGetters } from 'vuex' | ||
export default { | ||
name: 'hc-block-button', | ||
components: { | ||
'hc-button': Button, | ||
'hc-icon': Icon | ||
}, | ||
props: { | ||
foreignEntity: { | ||
type: Object, | ||
required: true | ||
}, | ||
confirmation: { | ||
type: Function | ||
} | ||
}, | ||
computed: { | ||
...mapGetters({ | ||
isPending: 'feathers-vuex-usersettings/isPending', | ||
currentUserSettings: 'feathers-vuex-usersettings/current' | ||
}) | ||
}, | ||
methods: { | ||
isBlacklisted () { | ||
let { blacklist } = this.currentUserSettings || {} | ||
return blacklist && blacklist.includes(this.foreignEntity._id) | ||
}, | ||
async click(){ | ||
if (this.confirmation && !this.isBlacklisted()) { | ||
return await this.confirmation(this.toggleBlacklist) | ||
} else return await this.toggleBlacklist() | ||
}, | ||
async toggleBlacklist() { | ||
let message | ||
try { | ||
await this.$store.dispatch('feathers-vuex-usersettings/toggleBlacklist', this.foreignEntity) | ||
const translationKey = `component.blacklist.${this.isBlacklisted() ? 'blockSuccess' : 'unblockSuccess'}` | ||
message = this.$t(translationKey, { | ||
name: this.foreignEntity.name || this.$t('component.contribution.creatorUnknown') | ||
}) | ||
} catch (error) { | ||
message = this.$t('component.error.general') | ||
throw (error) | ||
} finally { | ||
this.$snackbar.open({ message }) | ||
} | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
@import "assets/styles/utilities"; | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,8 @@ | |
"copy403": "Sorry, access to this resource on the server is denied. <br />Either check the URL, <a href=\"/auth/login\">login</a> or <a href=\"/\">go home</a>.", | ||
"copy404": "Sorry, the page you're looking for cannot be found. <br />Either check the URL, <a href=\"/\">go home</a>, or feel free to <a href=\"mailto:[email protected]\">report this issue.</a>", | ||
"copy500": "An error ocurred and your request couldn’t be completed. <br />Either check the URL, <a href=\"/\">go home</a>, or feel free to <a href=\"mailto:[email protected]\">report this issue.</a>", | ||
"copy503": "We are currently working on it, <br />so take a coffee brake and come back a bit later." | ||
"copy503": "We are currently working on it, <br />so take a coffee brake and come back a bit later.", | ||
"general": "Oops, something went terribly wrong" | ||
}, | ||
"badges": { | ||
"user_role_moderator": "Moderator", | ||
|
@@ -60,6 +61,14 @@ | |
"messageFollowSuccess": "You now follow {name}", | ||
"messageUnFollowSuccess": "You not longer follow {name}" | ||
}, | ||
"blacklist": { | ||
"buttonLabelBlock": "Block", | ||
"buttonLabelUnblock": "Blocked", | ||
"confirmUnfollowTitle": "Unfollow", | ||
"confirmUnfollowMessage": "Do you want to unfollow and block any content by {name}?", | ||
"blockSuccess": "You will no longer see any content by {name}", | ||
"unblockSuccess": "You will see content by {name} again" | ||
}, | ||
"admin": { | ||
"activate": "Activate", | ||
"addCategory": "add category", | ||
|
@@ -166,6 +175,8 @@ | |
"actionReport": "report post", | ||
"actionDisable": "disable post", | ||
"actionEnable": "enable post", | ||
"actionBlockAuthor": "block author", | ||
"actionUnblockAuthor": "unblock author", | ||
"bestList": "Bestlist", | ||
"canDos": "Can Do’s", | ||
"canDoAdd": "Start Can Do", | ||
|
@@ -623,7 +634,9 @@ | |
"organizationStreet": "Street", | ||
"organizationZipCode": "Zip Code", | ||
"organizationCity": "City", | ||
"organizationCountry": "Country" | ||
"organizationCountry": "Country", | ||
"blacklist": "Blacklist", | ||
"blacklistSubtitle": "Users whose content you no longer see" | ||
} | ||
}, | ||
"ressource": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<template> | ||
<div class="info-text"> | ||
<h2 class="title is-3"> | ||
{{ $t('auth.settings.blacklist') }} | ||
</h2> | ||
<p class="subtitle is-6">{{ $t('auth.settings.blacklistSubtitle') }}</p> | ||
<author | ||
v-for="(user, index) in blacklistedUsers" | ||
:key="user._id" | ||
:user="user" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import Author from '~/components/Author/Author.vue' | ||
export default { | ||
components: { | ||
Author | ||
}, | ||
data() { | ||
return { | ||
blacklistedUsers: [], | ||
} | ||
}, | ||
async asyncData ({store}) { | ||
const { blacklist } = store.getters['feathers-vuex-usersettings/current']; | ||
if (!blacklist) return {} | ||
const res = await store.dispatch('feathers-vuex-users/find', { query: {_id: { $in: blacklist } } } ); | ||
return { | ||
blacklistedUsers: res.data | ||
} | ||
} | ||
}; | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.