Add follow import to user settings.
This commit is contained in:
parent
8f3926a096
commit
a058941aed
5 changed files with 67 additions and 4 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue