Update ComposeModal

This commit is contained in:
Daniel Supernault 2021-12-14 22:25:50 -07:00
parent b78a51890d
commit e975372631
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -1024,7 +1024,6 @@ export default {
}, },
beforeMount() { beforeMount() {
this.fetchProfile();
this.filters = window.App.util.filters; this.filters = window.App.util.filters;
axios.get('/api/compose/v0/settings') axios.get('/api/compose/v0/settings')
.then(res => { .then(res => {
@ -1038,6 +1037,7 @@ export default {
return l.title; return l.title;
})[0]; })[0];
} }
this.fetchProfile();
}); });
}, },
@ -1047,8 +1047,18 @@ export default {
methods: { methods: {
fetchProfile() { fetchProfile() {
let tags = {
public: 'Public',
private: 'Followers Only',
unlisted: 'Unlisted'
}
if(window._sharedData.curUser.id) { if(window._sharedData.curUser.id) {
this.profile = window._sharedData.curUser; this.profile = window._sharedData.curUser;
if(this.composeSettings && this.composeSettings.hasOwnProperty('default_scope') && this.composeSettings.default_scope) {
let ds = this.composeSettings.default_scope;
this.visibility = ds;
this.visibilityTag = tags[ds];
}
if(this.profile.locked == true) { if(this.profile.locked == true) {
this.visibility = 'private'; this.visibility = 'private';
this.visibilityTag = 'Followers Only'; this.visibilityTag = 'Followers Only';
@ -1057,6 +1067,11 @@ export default {
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => { axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
window._sharedData.currentUser = res.data; window._sharedData.currentUser = res.data;
this.profile = res.data; this.profile = res.data;
if(this.composeSettings && this.composeSettings.hasOwnProperty('default_scope') && this.composeSettings.default_scope) {
let ds = this.composeSettings.default_scope;
this.visibility = ds;
this.visibilityTag = tags[ds];
}
if(this.profile.locked == true) { if(this.profile.locked == true) {
this.visibility = 'private'; this.visibility = 'private';
this.visibilityTag = 'Followers Only'; this.visibilityTag = 'Followers Only';