1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-12-05 10:18:09 +09:00
This commit is contained in:
Aya Morisawa 2018-12-07 18:33:09 +09:00 committed by GitHub
parent f72b00bec7
commit 96571866a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,7 +28,7 @@
</div> </div>
</x-draggable> </x-draggable>
</div> </div>
<mk-poll-editor v-if="poll" ref="poll" @destroyed="poll = false"/> <mk-poll-editor v-if="poll" ref="poll" @destroyed="poll = false" @updated="onPollUpdate()"/>
<mk-uploader ref="uploader" @uploaded="attachMedia" @change="onChangeUploadings"/> <mk-uploader ref="uploader" @uploaded="attachMedia" @change="onChangeUploadings"/>
<footer> <footer>
<button class="upload" @click="chooseFile"><fa icon="upload"/></button> <button class="upload" @click="chooseFile"><fa icon="upload"/></button>
@ -101,6 +101,7 @@ export default Vue.extend({
uploadings: [], uploadings: [],
files: [], files: [],
poll: false, poll: false,
pollChoices: [],
geo: null, geo: null,
visibility: 'public', visibility: 'public',
visibleUsers: [], visibleUsers: [],
@ -156,7 +157,8 @@ export default Vue.extend({
canPost(): boolean { canPost(): boolean {
return !this.posting && return !this.posting &&
(1 <= this.text.length || 1 <= this.files.length || this.poll || this.renote) && (1 <= this.text.length || 1 <= this.files.length || this.poll || this.renote) &&
(this.text.trim().length <= this.maxNoteTextLength); (this.text.trim().length <= this.maxNoteTextLength) &&
(!this.poll || this.pollChoices.length >= 2);
} }
}, },
@ -257,6 +259,10 @@ export default Vue.extend({
Array.from((this.$refs.file as any).files).forEach(this.upload); Array.from((this.$refs.file as any).files).forEach(this.upload);
}, },
onPollUpdate() {
this.pollChoices = this.$refs.poll.get().choices;
},
upload(file) { upload(file) {
(this.$refs.uploader as any).upload(file); (this.$refs.uploader as any).upload(file);
}, },