aboutsummaryrefslogtreecommitdiff
path: root/src/components/user_settings
diff options
context:
space:
mode:
authoreal <eal@waifu.club>2018-02-01 18:19:36 +0200
committereal <eal@waifu.club>2018-02-01 18:19:36 +0200
commit36e68fba961a46fcd6dda1a57471dcf10775c511 (patch)
tree21dd7deace28b33296946714dc1c9561c6b4d30c /src/components/user_settings
parent90175a1872cace45ae0e410ed283fab25c9e42cd (diff)
parent92289e545a62bd28ea336c5d712a05445e0e20ab (diff)
Merge branch 'develop' into feature/normal-emoji-completion
Diffstat (limited to 'src/components/user_settings')
-rw-r--r--src/components/user_settings/user_settings.js31
-rw-r--r--src/components/user_settings/user_settings.vue17
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>