diff options
Diffstat (limited to 'src/components/user_settings')
| -rw-r--r-- | src/components/user_settings/user_settings.js | 31 | ||||
| -rw-r--r-- | src/components/user_settings/user_settings.vue | 17 |
2 files changed, 47 insertions, 1 deletions
diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js index fd20a6ad..25ee1f35 100644 --- a/src/components/user_settings/user_settings.js +++ b/src/components/user_settings/user_settings.js @@ -5,7 +5,10 @@ const UserSettings = { return { newname: this.$store.state.users.currentUser.name, newbio: this.$store.state.users.currentUser.description, - uploading: [ false, false, false ], + followList: null, + followImportError: false, + followsImported: false, + uploading: [ false, false, false, false ], previews: [ null, null, null ] } }, @@ -15,6 +18,9 @@ const UserSettings = { computed: { user () { return this.$store.state.users.currentUser + }, + pleromaBackend () { + return this.$store.state.config.pleromaBackend } }, methods: { @@ -117,6 +123,29 @@ const UserSettings = { } this.uploading[2] = false }) + }, + importFollows () { + this.uploading[3] = true + const followList = this.followList + this.$store.state.api.backendInteractor.followImport({params: followList}) + .then((status) => { + if (status) { + this.followsImported = true + } else { + this.followImportError = true + } + this.uploading[3] = false + }) + }, + followListChange () { + // eslint-disable-next-line no-undef + let formData = new FormData() + formData.append('list', this.$refs.followlist.files[0]) + this.followList = formData + }, + dismissImported () { + this.followsImported = false + this.followImportError = false } } } diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue index 515fd253..da78cdc2 100644 --- a/src/components/user_settings/user_settings.vue +++ b/src/components/user_settings/user_settings.vue @@ -49,6 +49,23 @@ <i class="base09 icon-spin4 animate-spin uploading" v-if="uploading[2]"></i> <button class="btn btn-default base05 base02-background" v-else-if="previews[2]" @click="submitBg">{{$t('general.submit')}}</button> </div> + <div class="setting-item" v-if="pleromaBackend"> + <h3>{{$t('settings.follow_import')}}</h3> + <p>{{$t('settings.import_followers_from_a_csv_file')}}</p> + <form v-model="followImportForm"> + <input type="file" ref="followlist" v-on:change="followListChange"></input> + </form> + <i class="base09 icon-spin4 animate-spin uploading" v-if="uploading[3]"></i> + <button class="btn btn-default base05 base02-background" v-else @click="importFollows">{{$t('general.submit')}}</button> + <div v-if="followsImported"> + <i class="icon-cross" @click="dismissImported"></i> + <p>{{$t('settings.follows_imported')}}</p> + </div> + <div v-else-if="followImportError"> + <i class="icon-cross" @click="dismissImported"</i> + <p>{{$t('settings.follow_import_error')}}</p> + </div> + </div> </div> </div> </template> |
