aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/conversation/conversation.vue2
-rw-r--r--src/components/user_settings/user_settings.js35
-rw-r--r--src/components/user_settings/user_settings.vue7
3 files changed, 41 insertions, 3 deletions
diff --git a/src/components/conversation/conversation.vue b/src/components/conversation/conversation.vue
index 308e5e7d..bfcd3fe7 100644
--- a/src/components/conversation/conversation.vue
+++ b/src/components/conversation/conversation.vue
@@ -3,7 +3,7 @@
<div class="panel-heading conversation-heading">
{{ $t('timeline.conversation') }}
<span v-if="collapsable" style="float:right;">
- <small><a href="#" @click.prevent="$emit('toggleExpanded')">Collapse</a></small>
+ <small><a href="#" @click.prevent="$emit('toggleExpanded')">{{ $t('timeline.collapse') }}</a></small>
</span>
</div>
<div class="panel-body">
diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js
index 5ef38848..1e7b9b12 100644
--- a/src/components/user_settings/user_settings.js
+++ b/src/components/user_settings/user_settings.js
@@ -8,6 +8,7 @@ const UserSettings = {
followList: null,
followImportError: false,
followsImported: false,
+ enableFollowsExport: true,
uploading: [ false, false, false, false ],
previews: [ null, null, null ],
deletingAccount: false,
@@ -140,6 +141,37 @@ const UserSettings = {
this.uploading[3] = false
})
},
+ /* This function takes an Array of Users
+ * and outputs a file with all the addresses for the user to download
+ */
+ exportPeople (users, filename) {
+ // Get all the friends addresses
+ var UserAddresses = users.map(function (user) {
+ // check is it's a local user
+ if (user && user.is_local) {
+ // append the instance address
+ // eslint-disable-next-line no-undef
+ user.screen_name += '@' + location.hostname
+ }
+ return user.screen_name
+ }).join('\n')
+ // Make the user download the file
+ var fileToDownload = document.createElement('a')
+ fileToDownload.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(UserAddresses))
+ fileToDownload.setAttribute('download', filename)
+ fileToDownload.style.display = 'none'
+ document.body.appendChild(fileToDownload)
+ fileToDownload.click()
+ document.body.removeChild(fileToDownload)
+ },
+ exportFollows () {
+ this.enableFollowsExport = false
+ this.$store.state.api.backendInteractor
+ .fetchFriends({id: this.$store.state.users.currentUser.id})
+ .then((friendList) => {
+ this.exportPeople(friendList, 'friends.csv')
+ })
+ },
followListChange () {
// eslint-disable-next-line no-undef
let formData = new FormData()
@@ -156,10 +188,9 @@ const UserSettings = {
deleteAccount () {
this.$store.state.api.backendInteractor.deleteAccount({password: this.deleteAccountConfirmPasswordInput})
.then((res) => {
- console.log(res)
if (res.status === 'success') {
this.$store.dispatch('logout')
- window.location.href = '/main/all'
+ this.$router.push('/main/all')
} else {
this.deleteAccountError = res.error
}
diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue
index fbfbef8a..ea9763f3 100644
--- a/src/components/user_settings/user_settings.vue
+++ b/src/components/user_settings/user_settings.vue
@@ -66,6 +66,13 @@
<p>{{$t('settings.follow_import_error')}}</p>
</div>
</div>
+ <div class="setting-item" v-if="enableFollowsExport">
+ <h3>{{$t('settings.follow_export')}}</h3>
+ <button class="btn btn-default" @click="exportFollows">{{$t('settings.follow_export_button')}}</button>
+ </div>
+ <div class="setting-item" v-else>
+ <h3>{{$t('settings.follow_export_processing')}}</h3>
+ </div>
<hr>
<div class="setting-item">
<h3>{{$t('settings.delete_account')}}</h3>