|
|
@ -13,6 +13,8 @@ import SelectableList from '../selectable_list/selectable_list.vue'
|
|
|
|
import ProgressButton from '../progress_button/progress_button.vue'
|
|
|
|
import ProgressButton from '../progress_button/progress_button.vue'
|
|
|
|
import EmojiInput from '../emoji-input/emoji-input.vue'
|
|
|
|
import EmojiInput from '../emoji-input/emoji-input.vue'
|
|
|
|
import Autosuggest from '../autosuggest/autosuggest.vue'
|
|
|
|
import Autosuggest from '../autosuggest/autosuggest.vue'
|
|
|
|
|
|
|
|
import Importer from '../importer/importer.vue'
|
|
|
|
|
|
|
|
import Exporter from '../exporter/exporter.vue'
|
|
|
|
import withSubscription from '../../hocs/with_subscription/with_subscription'
|
|
|
|
import withSubscription from '../../hocs/with_subscription/with_subscription'
|
|
|
|
import userSearchApi from '../../services/new_api/user_search.js'
|
|
|
|
import userSearchApi from '../../services/new_api/user_search.js'
|
|
|
|
|
|
|
|
|
|
|
@ -40,14 +42,9 @@ const UserSettings = {
|
|
|
|
hideFollowers: this.$store.state.users.currentUser.hide_followers,
|
|
|
|
hideFollowers: this.$store.state.users.currentUser.hide_followers,
|
|
|
|
showRole: this.$store.state.users.currentUser.show_role,
|
|
|
|
showRole: this.$store.state.users.currentUser.show_role,
|
|
|
|
role: this.$store.state.users.currentUser.role,
|
|
|
|
role: this.$store.state.users.currentUser.role,
|
|
|
|
followList: null,
|
|
|
|
|
|
|
|
followImportError: false,
|
|
|
|
|
|
|
|
followsImported: false,
|
|
|
|
|
|
|
|
enableFollowsExport: true,
|
|
|
|
|
|
|
|
pickAvatarBtnVisible: true,
|
|
|
|
pickAvatarBtnVisible: true,
|
|
|
|
bannerUploading: false,
|
|
|
|
bannerUploading: false,
|
|
|
|
backgroundUploading: false,
|
|
|
|
backgroundUploading: false,
|
|
|
|
followListUploading: false,
|
|
|
|
|
|
|
|
bannerPreview: null,
|
|
|
|
bannerPreview: null,
|
|
|
|
backgroundPreview: null,
|
|
|
|
backgroundPreview: null,
|
|
|
|
bannerUploadError: null,
|
|
|
|
bannerUploadError: null,
|
|
|
@ -75,7 +72,9 @@ const UserSettings = {
|
|
|
|
Autosuggest,
|
|
|
|
Autosuggest,
|
|
|
|
BlockCard,
|
|
|
|
BlockCard,
|
|
|
|
MuteCard,
|
|
|
|
MuteCard,
|
|
|
|
ProgressButton
|
|
|
|
ProgressButton,
|
|
|
|
|
|
|
|
Importer,
|
|
|
|
|
|
|
|
Exporter
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
computed: {
|
|
|
|
user () {
|
|
|
|
user () {
|
|
|
@ -236,62 +235,41 @@ const UserSettings = {
|
|
|
|
this.backgroundUploading = false
|
|
|
|
this.backgroundUploading = false
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
importFollows () {
|
|
|
|
importFollows (file) {
|
|
|
|
this.followListUploading = true
|
|
|
|
return this.$store.state.api.backendInteractor.importFollows(file)
|
|
|
|
const followList = this.followList
|
|
|
|
|
|
|
|
this.$store.state.api.backendInteractor.followImport({params: followList})
|
|
|
|
|
|
|
|
.then((status) => {
|
|
|
|
.then((status) => {
|
|
|
|
if (status) {
|
|
|
|
if (!status) {
|
|
|
|
this.followsImported = true
|
|
|
|
throw new Error('failed')
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
this.followImportError = true
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
importBlocks (file) {
|
|
|
|
|
|
|
|
return this.$store.state.api.backendInteractor.importBlocks(file)
|
|
|
|
|
|
|
|
.then((status) => {
|
|
|
|
|
|
|
|
if (!status) {
|
|
|
|
|
|
|
|
throw new Error('failed')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.followListUploading = false
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
/* This function takes an Array of Users
|
|
|
|
generateExportableUsersContent (users) {
|
|
|
|
* and outputs a file with all the addresses for the user to download
|
|
|
|
// Get addresses
|
|
|
|
*/
|
|
|
|
return users.map((user) => {
|
|
|
|
exportPeople (users, filename) {
|
|
|
|
|
|
|
|
// Get all the friends addresses
|
|
|
|
|
|
|
|
var UserAddresses = users.map(function (user) {
|
|
|
|
|
|
|
|
// check is it's a local user
|
|
|
|
// check is it's a local user
|
|
|
|
if (user && user.is_local) {
|
|
|
|
if (user && user.is_local) {
|
|
|
|
// append the instance address
|
|
|
|
// append the instance address
|
|
|
|
// eslint-disable-next-line no-undef
|
|
|
|
// eslint-disable-next-line no-undef
|
|
|
|
user.screen_name += '@' + location.hostname
|
|
|
|
return user.screen_name + '@' + location.hostname
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return user.screen_name
|
|
|
|
return user.screen_name
|
|
|
|
}).join('\n')
|
|
|
|
}).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 () {
|
|
|
|
getFollowsContent () {
|
|
|
|
this.enableFollowsExport = false
|
|
|
|
return this.$store.state.api.backendInteractor.exportFriends({ id: this.$store.state.users.currentUser.id })
|
|
|
|
this.$store.state.api.backendInteractor
|
|
|
|
.then(this.generateExportableUsersContent)
|
|
|
|
.exportFriends({
|
|
|
|
|
|
|
|
id: this.$store.state.users.currentUser.id
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.then((friendList) => {
|
|
|
|
|
|
|
|
this.exportPeople(friendList, 'friends.csv')
|
|
|
|
|
|
|
|
setTimeout(() => { this.enableFollowsExport = true }, 2000)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
followListChange () {
|
|
|
|
|
|
|
|
// eslint-disable-next-line no-undef
|
|
|
|
|
|
|
|
let formData = new FormData()
|
|
|
|
|
|
|
|
formData.append('list', this.$refs.followlist.files[0])
|
|
|
|
|
|
|
|
this.followList = formData
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
dismissImported () {
|
|
|
|
getBlocksContent () {
|
|
|
|
this.followsImported = false
|
|
|
|
return this.$store.state.api.backendInteractor.fetchBlocks()
|
|
|
|
this.followImportError = false
|
|
|
|
.then(this.generateExportableUsersContent)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
confirmDelete () {
|
|
|
|
confirmDelete () {
|
|
|
|
this.deletingAccount = true
|
|
|
|
this.deletingAccount = true
|
|
|
|