[Client] Fix bug

This commit is contained in:
syuilo 2018-11-09 08:26:32 +09:00
parent 60ef3e3563
commit fccbecf159
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
44 changed files with 83 additions and 81 deletions

View file

@ -88,7 +88,7 @@ export default (opts: Opts = {}) => ({
methods: {
reply(viaKeyboard = false) {
(this as any).apis.post({
this.$root.apis.post({
reply: this.appearNote,
animation: !viaKeyboard,
cb: () => {
@ -98,7 +98,7 @@ export default (opts: Opts = {}) => ({
},
renote(viaKeyboard = false) {
(this as any).apis.post({
this.$root.apis.post({
renote: this.appearNote,
animation: !viaKeyboard,
cb: () => {

View file

@ -50,7 +50,7 @@ export default Vue.extend({
methods: {
regenerateToken() {
(this as any).apis.input({
this.$root.apis.input({
title: this.$t('enter-password'),
type: 'password'
}).then(password => {

View file

@ -100,7 +100,7 @@ export default Vue.extend({
},
match() {
(this as any).apis.input({
this.$root.apis.input({
title: this.$t('enter-username')
}).then(username => {
this.$root.api('users/show', {

View file

@ -131,7 +131,7 @@ export default Vue.extend({
},
chooseFileFromDrive() {
(this as any).apis.chooseDriveFile({
this.$root.apis.chooseDriveFile({
multiple: false
}).then(file => {
this.file = file;

View file

@ -12,20 +12,20 @@ export default Vue.extend({
i18n: i18n('common/views/components/password-settings.vue'),
methods: {
reset() {
(this as any).apis.input({
this.$root.apis.input({
title: this.$t('enter-current-password'),
type: 'password'
}).then(currentPassword => {
(this as any).apis.input({
this.$root.apis.input({
title: this.$t('enter-new-password'),
type: 'password'
}).then(newPassword => {
(this as any).apis.input({
this.$root.apis.input({
title: this.$t('enter-new-password-again'),
type: 'password'
}).then(newPassword2 => {
if (newPassword !== newPassword2) {
(this as any).apis.dialog({
this.$root.apis.dialog({
title: null,
text: this.$t('not-match'),
actions: [{
@ -38,7 +38,7 @@ export default Vue.extend({
currentPasword: currentPassword,
newPassword: newPassword
}).then(() => {
(this as any).apis.notify(this.$t('changed'));
this.$root.apis.notify(this.$t('changed'));
});
});
});

View file

@ -114,7 +114,7 @@ export default define({
});
},
choose() {
(this as any).apis.chooseDriveFolder().then(folder => {
this.$root.apis.chooseDriveFolder().then(folder => {
this.props.folder = folder ? folder.id : null;
this.save();
this.fetch();

View file

@ -149,7 +149,7 @@ export default Vue.extend({
},
rename() {
(this as any).apis.input({
this.$root.apis.input({
title: this.$t('contextmenu.rename-file'),
placeholder: this.$t('contextmenu.input-new-file-name'),
default: this.file.name,
@ -171,7 +171,7 @@ export default Vue.extend({
copyUrl() {
copyToClipboard(this.file.url);
(this as any).apis.dialog({
this.$root.apis.dialog({
title: this.$t('contextmenu.copied'),
text: this.$t('contextmenu.copied-url-to-clipboard'),
actions: [{
@ -181,11 +181,11 @@ export default Vue.extend({
},
setAsAvatar() {
(this as any).apis.updateAvatar(this.file);
this.$root.apis.updateAvatar(this.file);
},
setAsBanner() {
(this as any).apis.updateBanner(this.file);
this.$root.apis.updateBanner(this.file);
},
addApp() {

View file

@ -156,7 +156,7 @@ export default Vue.extend({
}).catch(err => {
switch (err) {
case 'detected-circular-definition':
(this as any).apis.dialog({
this.$root.apis.dialog({
title: this.$t('unable-to-process'),
text: this.$t('circular-reference-detected'),
actions: [{
@ -196,7 +196,7 @@ export default Vue.extend({
},
rename() {
(this as any).apis.input({
this.$root.apis.input({
title: this.$t('contextmenu.rename-folder'),
placeholder: this.$t('contextmenu.input-new-folder-name'),
default: this.folder.name

View file

@ -314,7 +314,7 @@ export default Vue.extend({
}).catch(err => {
switch (err) {
case 'detected-circular-definition':
(this as any).apis.dialog({
this.$root.apis.dialog({
title: this.$t('unable-to-process'),
text: this.$t('circular-reference-detected'),
actions: [{
@ -335,7 +335,7 @@ export default Vue.extend({
},
urlUpload() {
(this as any).apis.input({
this.$root.apis.input({
title: this.$t('url-upload'),
placeholder: this.$t('url-of-file')
}).then(url => {
@ -344,7 +344,7 @@ export default Vue.extend({
folderId: this.folder ? this.folder.id : undefined
});
(this as any).apis.dialog({
this.$root.apis.dialog({
title: this.$t('url-upload-requested'),
text: this.$t('may-take-time'),
actions: [{
@ -355,7 +355,7 @@ export default Vue.extend({
},
createFolder() {
(this as any).apis.input({
this.$root.apis.input({
title: this.$t('create-folder'),
placeholder: this.$t('folder-name')
}).then(name => {

View file

@ -186,7 +186,7 @@ export default Vue.extend({
methods: {
hint() {
(this as any).apis.dialog({
this.$root.apis.dialog({
title: this.$t('@.customization-tips.title'),
text: this.$t('@.customization-tips.paragraph'),
actions: [{

View file

@ -36,7 +36,7 @@
<button class="drive" :title="$t('attach-media-from-drive')" @click="chooseFileFromDrive"><fa icon="cloud"/></button>
<button class="kao" :title="$t('insert-a-kao')" @click="kao"><fa :icon="['far', 'smile']"/></button>
<button class="poll" :title="$t('create-poll')" @click="poll = !poll"><fa icon="chart-pie"/></button>
<button class="cw%" :title="$t('hide-contents%')" @click="useCw = !useCw"><fa icon="eye-slash"/></button>
<button class="cw" :title="$t('hide-contents%')" @click="useCw = !useCw"><fa icon="eye-slash"/></button>
<button class="geo" :title="$t('attach-location-information')" @click="geo ? removeGeo() : setGeo()"><fa icon="map-marker-alt"/></button>
<button class="visibility" :title="$t('visibility')" @click="setVisibility" ref="visibilityButton">
<span v-if="visibility === 'public'"><fa icon="globe"/></span>
@ -45,9 +45,9 @@
<span v-if="visibility === 'specified'"><fa icon="envelope"/></span>
<span v-if="visibility === 'private'"><fa icon="lock"/></span>
</button>
<p class="text-count" :class="{ over: this.trimmedLength(text) > this.maxNoteTextLength }">{{ this.maxNoteTextLength - this.trimmedLength(text) }}</p>
<p class="text-count" :class="{ over: trimmedLength(text) > maxNoteTextLength }">{{ maxNoteTextLength - trimmedLength(text) }}</p>
<button :class="{ posting }" class="submit" :disabled="!canPost" @click="post">
{{ posting ? this.$t('posting') : submitText }}<mk-ellipsis v-if="posting"/>
{{ posting ? $t('posting') : submitText }}<mk-ellipsis v-if="posting"/>
</button>
<input ref="file" type="file" multiple="multiple" tabindex="-1" @change="onChangeFile"/>
<div class="dropzone" v-if="draghover"></div>
@ -245,7 +245,7 @@ export default Vue.extend({
},
chooseFileFromDrive() {
(this as any).apis.chooseDriveFile({
this.$root.apis.chooseDriveFile({
multiple: true
}).then(files => {
files.forEach(this.attachMedia);
@ -363,7 +363,7 @@ export default Vue.extend({
},
addVisibleUser() {
(this as any).apis.input({
this.$root.apis.input({
title: this.$t('enter-username')
}).then(acct => {
if (acct.startsWith('@')) acct = acct.substr(1);
@ -401,13 +401,13 @@ export default Vue.extend({
this.clear();
this.deleteDraft();
this.$emit('posted');
(this as any).apis.notify(this.renote
this.$root.apis.notify(this.renote
? this.$t('reposted')
: this.reply
? this.$t('replied')
: this.$t('posted'));
}).catch(err => {
(this as any).apis.notify(this.renote
this.$root.apis.notify(this.renote
? this.$t('renote-failed')
: this.reply
? this.$t('reply-failed')
@ -689,6 +689,7 @@ export default Vue.extend({
> .drive
> .kao
> .poll
> .cw
> .geo
> .visibility
display inline-block

View file

@ -34,9 +34,9 @@ export default Vue.extend({
renoteId: this.note.id
}).then(data => {
this.$emit('posted');
(this as any).apis.notify(this.$t('success'));
this.$root.apis.notify(this.$t('success'));
}).catch(err => {
(this as any).apis.notify(this.$t('failure'));
this.$root.apis.notify(this.$t('failure'));
}).then(() => {
this.wait = false;
});

View file

@ -35,7 +35,7 @@ export default Vue.extend({
},
methods: {
register() {
(this as any).apis.input({
this.$root.apis.input({
title: this.$t('enter-password'),
type: 'password'
}).then(password => {
@ -48,14 +48,14 @@ export default Vue.extend({
},
unregister() {
(this as any).apis.input({
this.$root.apis.input({
title: this.$t('enter-password'),
type: 'password'
}).then(password => {
this.$root.api('i/2fa/unregister', {
password: password
}).then(() => {
(this as any).apis.notify(this.$t('unregistered'));
this.$root.apis.notify(this.$t('unregistered'));
this.$store.state.i.twoFactorEnabled = false;
});
});
@ -65,10 +65,10 @@ export default Vue.extend({
this.$root.api('i/2fa/done', {
token: this.token
}).then(() => {
(this as any).apis.notify(this.$t('success'));
this.$root.apis.notify(this.$t('success'));
this.$store.state.i.twoFactorEnabled = true;
}).catch(() => {
(this as any).apis.notify(this.$t('failed'));
this.$root.apis.notify(this.$t('failed'));
});
}
}

View file

@ -513,7 +513,7 @@ export default Vue.extend({
this.$emit('done');
},
updateWallpaper() {
(this as any).apis.chooseDriveFile({
this.$root.apis.chooseDriveFile({
multiple: false
}).then(file => {
this.$root.api('i/update', {
@ -537,12 +537,12 @@ export default Vue.extend({
this.checkingForUpdate = false;
this.latestVersion = newer;
if (newer == null) {
(this as any).apis.dialog({
this.$root.apis.dialog({
title: this.$t('no-updates'),
text: this.$t('no-updates-desc')
});
} else {
(this as any).apis.dialog({
this.$root.apis.dialog({
title: this.$t('update-available'),
text: this.$t('update-available-desc')
});
@ -551,7 +551,7 @@ export default Vue.extend({
},
clean() {
localStorage.clear();
(this as any).apis.dialog({
this.$root.apis.dialog({
title: this.$t('cache-cleared'),
text: this.$t('cache-cleared-desc')
});

View file

@ -109,7 +109,7 @@ export default Vue.extend({
icon: 'plus',
text: this.$t('add-list'),
action: () => {
(this as any).apis.input({
this.$root.apis.input({
title: this.$t('list-name'),
}).then(async title => {
const list = await this.$root.api('users/lists/create', {

View file

@ -12,7 +12,7 @@ export default Vue.extend({
i18n: i18n('desktop/views/components/ui.header.post.vue'),
methods: {
post() {
(this as any).apis.post();
this.$root.apis.post();
}
}
});

View file

@ -139,7 +139,7 @@ export default Vue.extend({
},
post() {
(this as any).apis.post();
this.$root.apis.post();
},
drive() {

View file

@ -67,7 +67,7 @@ export default Vue.extend({
methods: {
post() {
(this as any).apis.post();
this.$root.apis.post();
},
toggleZenMode() {

View file

@ -29,7 +29,7 @@ export default Vue.extend({
},
methods: {
add() {
(this as any).apis.input({
this.$root.apis.input({
title: this.$t('list-name'),
}).then(async title => {
const list = await this.$root.api('users/lists/create', {

View file

@ -168,7 +168,7 @@ export default Vue.extend({
icon: 'pencil-alt',
text: this.$t('rename'),
action: () => {
(this as any).apis.input({
this.$root.apis.input({
title: this.$t('rename'),
default: this.name,
allowEmpty: false

View file

@ -137,7 +137,7 @@ export default Vue.extend({
align-items baseline
white-space nowrap
i, .mk-reaction-icon
[data-icon], .mk-reaction-icon
margin-right 4px
> .mk-time
@ -159,15 +159,15 @@ export default Vue.extend({
margin-right 3px
&.renote
> div > header i
> div > header [data-icon]
color #77B255
&.follow
> div > header i
> div > header [data-icon]
color #53c7ce
&.receiveFollowRequest
> div > header i
> div > header [data-icon]
color #888
</style>

View file

@ -131,7 +131,7 @@ export default Vue.extend({
},
mounted() {
document.title = this.$root.os.instanceName;
document.title = this.$root.instanceName;
document.documentElement.style.overflow = 'hidden';
},
@ -255,7 +255,7 @@ export default Vue.extend({
icon: 'hashtag',
text: this.$t('@deck.hashtag'),
action: () => {
(this as any).apis.input({
this.$root.apis.input({
title: this.$t('enter-hashtag-tl-title')
}).then(title => {
this.$store.dispatch('settings/addDeckColumn', {

View file

@ -23,7 +23,7 @@ export default Vue.extend({
}
},
mounted() {
document.title = this.$root.os.instanceName;
document.title = this.$root.instanceName;
Progress.start();
},

View file

@ -81,7 +81,7 @@ export default Vue.extend({
onBannerClick() {
if (!this.$store.getters.isSignedIn || this.$store.state.i.id != this.user.id) return;
(this as any).apis.updateBanner().then(i => {
this.$root.apis.updateBanner().then(i => {
this.user.bannerUrl = i.bannerUrl;
});
}

View file

@ -101,7 +101,7 @@ export default Vue.extend({
listId: list.id,
userId: this.user.id
});
(this as any).apis.dialog({
this.$root.apis.dialog({
title: 'Done!',
text: this.$t('list-pushed').replace('{user}', this.user.name).replace('{list}', list.title)
});

View file

@ -285,7 +285,8 @@ export default (callback: (launch: (router: VueRouter, api?: (os: MiOS) => API)
windows: os.windows
},
stream: os.stream,
apis: os.apis
apis: os.apis,
instanceName: os.instanceName
};
},
methods: {

View file

@ -101,7 +101,7 @@ export default Vue.extend({
},
move() {
(this as any).apis.chooseDriveFolder().then(folder => {
this.$root.apis.chooseDriveFolder().then(folder => {
this.$root.api('drive/files/update', {
fileId: this.file.id,
folderId: folder == null ? null : folder.id

View file

@ -439,7 +439,7 @@ export default Vue.extend({
alert(this.$t('root-move-alert'));
return;
}
(this as any).apis.chooseDriveFolder().then(folder => {
this.$root.apis.chooseDriveFolder().then(folder => {
this.$root.api('drive/folders/update', {
parentId: folder ? folder.id : null,
folderId: this.folder.id

View file

@ -196,13 +196,13 @@ export default Vue.extend({
},
reply() {
(this as any).apis.post({
this.$root.apis.post({
reply: this.p
});
},
renote() {
(this as any).apis.post({
this.$root.apis.post({
renote: this.p
});
},

View file

@ -220,7 +220,7 @@ export default Vue.extend({
},
chooseFileFromDrive() {
(this as any).apis.chooseDriveFile({
this.$root.apis.chooseDriveFile({
multiple: true
}).then(files => {
files.forEach(this.attachMedia);
@ -279,7 +279,7 @@ export default Vue.extend({
},
addVisibleUser() {
(this as any).apis.input({
this.$root.apis.input({
title: this.$t('username-prompt')
}).then(acct => {
if (acct.startsWith('@')) acct = acct.substr(1);

View file

@ -45,7 +45,7 @@ export default Vue.extend({
window.addEventListener('popstate', this.onPopState);
},
mounted() {
document.title = `${this.$root.os.instanceName} Drive`;
document.title = `${this.$root.instanceName} Drive`;
},
beforeDestroy() {
window.removeEventListener('popstate', this.onPopState);
@ -64,7 +64,7 @@ export default Vue.extend({
(this.$refs as any).browser.openContextMenu();
},
onMoveRoot(silent) {
const title = `${this.$root.os.instanceName} Drive`;
const title = `${this.$root.instanceName} Drive`;
if (!silent) {
// Rewrite URL
@ -77,7 +77,7 @@ export default Vue.extend({
this.folder = null;
},
onOpenFolder(folder, silent) {
const title = `${folder.name} | ${this.$root.os.instanceName} Drive`;
const title = `${folder.name} | ${this.$root.instanceName} Drive`;
if (!silent) {
// Rewrite URL
@ -90,7 +90,7 @@ export default Vue.extend({
this.folder = folder;
},
onOpenFile(file, silent) {
const title = `${file.name} | ${this.$root.os.instanceName} Drive`;
const title = `${file.name} | ${this.$root.instanceName} Drive`;
if (!silent) {
// Rewrite URL

View file

@ -30,7 +30,7 @@ export default Vue.extend({
this.fetch();
},
mounted() {
document.title = `${this.$root.os.instanceName} | %i18n:@notifications%`;
document.title = `${this.$root.instanceName} | %i18n:@notifications%`;
},
methods: {
fetch() {

View file

@ -50,7 +50,7 @@ export default Vue.extend({
this.user = user;
this.fetching = false;
document.title = `${this.$t('followers-of').replace('{}', this.name)} | ${this.$root.os.instanceName}`;
document.title = `${this.$t('followers-of').replace('{}', this.name)} | ${this.$root.instanceName}`;
});
},
onLoaded() {

View file

@ -49,7 +49,7 @@ export default Vue.extend({
this.user = user;
this.fetching = false;
document.title = `${this.$t('followers-of').replace('{}', this.name)} | ${this.$root.os.instanceName}`;
document.title = `${this.$t('followers-of').replace('{}', this.name)} | ${this.$root.instanceName}`;
});
},
onLoaded() {

View file

@ -15,7 +15,7 @@ export default Vue.extend({
XReversi: () => import('../../../../common/views/components/games/reversi/reversi.vue')
},
mounted() {
document.title = `${this.$root.os.instanceName} %i18n:@reversi%`;
document.title = `${this.$root.instanceName} %i18n:@reversi%`;
},
methods: {
nav(game, actualNav) {

View file

@ -128,7 +128,7 @@ export default Vue.extend({
},
mounted() {
document.title = this.$root.os.instanceName;
document.title = this.$root.instanceName;
Progress.start();
@ -139,7 +139,7 @@ export default Vue.extend({
methods: {
fn() {
(this as any).apis.post();
this.$root.apis.post();
},
saveSrc() {

View file

@ -49,7 +49,7 @@ export default Vue.extend({
this.user = user;
this.fetching = false;
document.title = `${this.$t('@.messaging')}: ${Vue.filter('userName')(this.user)} | ${this.$root.os.instanceName}`;
document.title = `${this.$t('@.messaging')}: ${Vue.filter('userName')(this.user)} | ${this.$root.instanceName}`;
});
}
}

View file

@ -13,7 +13,7 @@ import getAcct from '../../../../../misc/acct/render';
export default Vue.extend({
i18n: i18n(),
mounted() {
document.title = `${this.$root.os.instanceName} ${this.$t('@.messaging')}`;
document.title = `${this.$root.instanceName} ${this.$t('@.messaging')}`;
},
methods: {
navigate(user) {

View file

@ -33,7 +33,7 @@ export default Vue.extend({
this.fetch();
},
mounted() {
document.title = this.$root.os.instanceName;
document.title = this.$root.instanceName;
},
methods: {
fetch() {

View file

@ -36,7 +36,7 @@ export default Vue.extend({
}
},
mounted() {
document.title = `%i18n:@search%: ${this.q} | ${this.$root.os.instanceName}`;
document.title = `%i18n:@search%: ${this.q} | ${this.$root.instanceName}`;
this.fetch();
},

View file

@ -343,12 +343,12 @@ export default Vue.extend({
this.checkingForUpdate = false;
this.latestVersion = newer;
if (newer == null) {
(this as any).apis.dialog({
this.$root.apis.dialog({
title: this.$t('no-updates'),
text: this.$t('no-updates-desc')
});
} else {
(this as any).apis.dialog({
this.$root.apis.dialog({
title: this.$t('update-available'),
text: this.$t('update-available-desc')
});

View file

@ -38,7 +38,7 @@ export default Vue.extend({
},
methods: {
fn() {
(this as any).apis.input({
this.$root.apis.input({
title: this.$t('enter-list-name'),
}).then(async title => {
const list = await this.$root.api('users/lists/create', {

View file

@ -110,7 +110,7 @@ export default Vue.extend({
this.fetching = false;
Progress.done();
document.title = `${Vue.filter('userName')(this.user)} | ${this.$root.os.instanceName}`;
document.title = `${Vue.filter('userName')(this.user)} | ${this.$root.instanceName}`;
});
},

View file

@ -104,7 +104,7 @@ export default Vue.extend({
},
mounted() {
document.title = this.$root.os.instanceName;
document.title = this.$root.instanceName;
},
methods: {