Skip to content

Commit

Permalink
Fix bugs and better error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
roschaefer committed Aug 23, 2018
1 parent b27da6b commit 82a264a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
7 changes: 4 additions & 3 deletions components/mixins/blacklistable.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ export default {
name: this.author().name || this.$t('component.contribution.creatorUnknown')
})
} catch (error) {
console.log(error)
message = String(error)
message = this.$t('component.error.general')
throw (error)
} finally {
this.$snackbar.open({ message })
}
this.$snackbar.open({ message })
}
}
}
3 changes: 2 additions & 1 deletion locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"copy403": "Tut uns leid, der Zugang zu dieser Seite bleibt dir verwehrt. <br />Überprüfe die Adresse, <a href=\"/auth/login\">melde dich an</a> oder <a href=\"/\">geh auf Anfang</a>.",
"copy404": "Tut uns leid, wir haben diese Seite nicht gefunden. <br />Überprüfe die Adresse, <a href=\"/\">geh auf Anfang</a> oder <a href=\"mailto:[email protected]\">melde uns diesen Fehler.</a>",
"copy500": "Oh nein, es ist irgend ein Fehler aufgetreten und wir mussten aufgeben. <br />Überprüfe die Adresse, <a href=\"/\">geh auf Anfang</a> oder <a href=\"mailto:[email protected]\">melde uns diesen Fehler.</a>",
"copy503": "Wir arbeiten gerade dran, <br />nimm dir nen Kaffee und versuchs danach gleich nochmal."
"copy503": "Wir arbeiten gerade dran, <br />nimm dir nen Kaffee und versuchs danach gleich nochmal.",
"general": "Ups, da ist etwas schief gelaufen."
},
"badges": {
"user_role_moderator": "Moderator",
Expand Down
3 changes: 2 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,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",
Expand Down
11 changes: 8 additions & 3 deletions store/services/usersettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ let servicePlugin = (feathersClient) => {
const servicePath = 'usersettings'
const servicePlugin = service(servicePath, {
namespace: 'feathers-vuex-usersettings',
instanceDefaults: {
blacklist: []
},
getters: {
isPending: (state) => {
return (
Expand All @@ -30,12 +33,14 @@ let servicePlugin = (feathersClient) => {
},
async toggleBlacklist ({commit, dispatch, state}, author) {
let current = state.copy
let blacklist = current.blacklist
let userId = author._id
if (current.blacklist.includes(userId)) {
current.blacklist = current.blacklist.filter(id => id !== userId)
if (blacklist.includes(userId)) {
blacklist = blacklist.filter(id => id !== userId)
} else {
current.blacklist.push(userId)
blacklist.push(userId)
}
current.blacklist = blacklist
await commit('commitCopy')
return dispatch('patch', [current._id, current, {}])
}
Expand Down

0 comments on commit 82a264a

Please sign in to comment.