diff --git a/routes/_components/compose/ComposeBox.html b/routes/_components/compose/ComposeBox.html index d126191..8135bb2 100644 --- a/routes/_components/compose/ComposeBox.html +++ b/routes/_components/compose/ComposeBox.html @@ -115,8 +115,12 @@ let sensitive = media.length && !!contentWarning let realm = this.get('realm') let mediaIds = media.map(_ => _.data.id) - let inReplyTo = realm === 'home' ? null : realm + let overLimit = this.get('overLimit') + + if (!text || overLimit) { + return // do nothing if invalid + } /* no await */ postStatus(realm, text, inReplyTo, mediaIds, sensitive, contentWarning, postPrivacyKey) diff --git a/routes/_components/compose/ComposeButton.html b/routes/_components/compose/ComposeButton.html index 58055ce..c940b1f 100644 --- a/routes/_components/compose/ComposeButton.html +++ b/routes/_components/compose/ComposeButton.html @@ -43,7 +43,7 @@ export default { store: () => store, computed: { - disabled: ($postingStatus, overLimit, length) => $postingStatus || overLimit || length === 0 + disabled: ($postingStatus, overLimit) => $postingStatus || overLimit } } \ No newline at end of file diff --git a/tests/spec/012-compose.js b/tests/spec/012-compose.js index 9de1c14..ae1b25c 100644 --- a/tests/spec/012-compose.js +++ b/tests/spec/012-compose.js @@ -14,7 +14,7 @@ test('shows compose limits', async t => { await t.useRole(foobarRole) .hover(composeInput) .expect(composeLengthIndicator.innerText).eql('500') - .expect(composeButton.getAttribute('disabled')).eql('') + .expect(composeButton.hasAttribute('disabled')).notOk() .typeText(composeInput, 'typing some text') .expect(composeLengthIndicator.innerText).eql('484') .expect(composeButton.hasAttribute('disabled')).notOk() @@ -33,13 +33,13 @@ test('shows compose limits', async t => { .pressKey('delete') .expect(composeInput.value).eql('') .expect(composeLengthIndicator.innerText).eql('500') - .expect(composeButton.getAttribute('disabled')).eql('') + .expect(composeButton.hasAttribute('disabled')).notOk() }) test('shows compose limits for URLs/handles', async t => { await t.useRole(foobarRole) .expect(composeLengthIndicator.innerText).eql('500') - .expect(composeButton.getAttribute('disabled')).eql('') + .expect(composeButton.hasAttribute('disabled')).notOk() .typeText(composeInput, 'hello world ' + 'http://foo.bar.baz.whatever.example.com/hello ' + '@reallylongnamethatstretchesonandon@foo.example.com', {paste: true})