refactoring

This commit is contained in:
taehoon 2019-03-30 08:17:37 -04:00
parent 95bc2d727b
commit ab19669bf1

View File

@ -251,35 +251,25 @@ const UserSettings = {
} }
}) })
}, },
generateExportableUsersContent (users) {
// Get addresses
return users.map((user) => {
// check is it's a local user
if (user && user.is_local) {
// append the instance address
// eslint-disable-next-line no-undef
return user.screen_name + '@' + location.hostname
}
return user.screen_name
}).join('\n')
},
getFollowsContent () { getFollowsContent () {
return this.$store.state.api.backendInteractor.exportFriends({ id: this.$store.state.users.currentUser.id }) return this.$store.state.api.backendInteractor.exportFriends({ id: this.$store.state.users.currentUser.id })
.then((users) => { .then(this.generateExportableUsersContent)
// Get all the friends addresses
return users.map((user) => {
// check is it's a local user
if (user && user.is_local) {
// append the instance address
// eslint-disable-next-line no-undef
return user.screen_name + '@' + location.hostname
}
return user.screen_name
}).join('\n')
})
}, },
getBlocksContent () { getBlocksContent () {
return this.$store.state.api.backendInteractor.fetchBlocks() return this.$store.state.api.backendInteractor.fetchBlocks()
.then((users) => { .then(this.generateExportableUsersContent)
// Get all the friends addresses
return users.map((user) => {
// check is it's a local user
if (user && user.is_local) {
// append the instance address
// eslint-disable-next-line no-undef
return user.screen_name + '@' + location.hostname
}
return user.screen_name
}).join('\n')
})
}, },
confirmDelete () { confirmDelete () {
this.deletingAccount = true this.deletingAccount = true