diff --git a/routes/_components/compose/ComposeBox.html b/routes/_components/compose/ComposeBox.html
index 2f6ec31..e72bbc5 100644
--- a/routes/_components/compose/ComposeBox.html
+++ b/routes/_components/compose/ComposeBox.html
@@ -102,6 +102,13 @@
import { importDialogs } from '../../_utils/asyncModules'
import { classname } from '../../_utils/classname'
+ const PRIVACY_LEVEL = {
+ 'direct': 1,
+ 'private': 2,
+ 'unlisted': 3,
+ 'public': 4
+ }
+
export default {
oncreate() {
let realm = this.get('realm')
@@ -156,7 +163,16 @@
text: (composeData) => composeData.text || '',
media: (composeData) => composeData.media || [],
postPrivacy: (postPrivacyKey) => POST_PRIVACY_OPTIONS.find(_ => _.key === postPrivacyKey),
- defaultPostPrivacyKey: ($currentVerifyCredentials) => $currentVerifyCredentials.source.privacy,
+ defaultPostPrivacyKey: ($currentVerifyCredentials, replyVisibility) => {
+ let defaultVisibility = $currentVerifyCredentials.source.privacy
+ // return the most private between the user's preferred default privacy
+ // and the privacy of the status they're replying to
+ if (replyVisibility &&
+ PRIVACY_LEVEL[replyVisibility] < PRIVACY_LEVEL[defaultVisibility]) {
+ return replyVisibility
+ }
+ return defaultVisibility
+ },
postPrivacyKey: (composeData, defaultPostPrivacyKey) => composeData.postPrivacy || defaultPostPrivacyKey,
textLength: (text) => measureText(text),
contentWarningLength: (contentWarning) => measureText(contentWarning),
diff --git a/routes/_components/status/Status.html b/routes/_components/status/Status.html
index a3c7c37..24846c9 100644
--- a/routes/_components/status/Status.html
+++ b/routes/_components/status/Status.html
@@ -38,7 +38,9 @@
:isStatusInOwnThread :uuid :visibility :replyShown
on:recalculateHeight />
{{#if replyShown}}
-
+
{{/if}}
diff --git a/routes/_components/status/StatusComposeBox.html b/routes/_components/status/StatusComposeBox.html
index 2af3b87..f1ca12c 100644
--- a/routes/_components/status/StatusComposeBox.html
+++ b/routes/_components/status/StatusComposeBox.html
@@ -3,6 +3,7 @@
size="slim"
autoFocus="true"
hideBottomBorder="true"
+ replyVisibility="{{visibility}}"
on:postedStatus="onPostedStatus()"
/>
@@ -44,7 +45,7 @@
},
store: () => store,
computed: {
- composeData: ($currentComposeData, originalStatusId) => $currentComposeData[originalStatusId] || {},
+ composeData: ($currentComposeData, originalStatusId) => $currentComposeData[originalStatusId] || {}
},
methods: {
onPostedStatus() {
diff --git a/tests/spec/017-compose-reply.js b/tests/spec/017-compose-reply.js
index 603d900..c2b5ea5 100644
--- a/tests/spec/017-compose-reply.js
+++ b/tests/spec/017-compose-reply.js
@@ -1,6 +1,6 @@
import {
composeInput,
- getNthComposeReplyInput, getNthReplyButton,
+ getNthComposeReplyInput, getNthPostPrivacyButton, getNthReplyButton,
getNthStatus, getUrl, goBack, homeNavButton, notificationsNavButton
} from '../utils'
import { foobarRole } from '../roles'
@@ -34,3 +34,27 @@ test('replying to posts with mentions', async t => {
.click(getNthReplyButton(0))
.expect(getNthComposeReplyInput(0).value).eql('@ExternalLinks @admin @quux ')
})
+
+test('replies have same privacy as replied-to status by default', async t => {
+ await t.useRole(foobarRole)
+ .hover(getNthStatus(0))
+ .hover(getNthStatus(1))
+ .click(getNthReplyButton(1))
+ .expect(getNthPostPrivacyButton(1).getAttribute('aria-label')).eql('Adjust privacy (currently Unlisted)')
+ .click(getNthReplyButton(1))
+ .hover(getNthStatus(2))
+ .click(getNthReplyButton(2))
+ .expect(getNthPostPrivacyButton(2).getAttribute('aria-label')).eql('Adjust privacy (currently Followers-only)')
+ .click(getNthReplyButton(2))
+ .hover(getNthStatus(3))
+ .click(getNthReplyButton(3))
+ .expect(getNthPostPrivacyButton(3).getAttribute('aria-label')).eql('Adjust privacy (currently Direct)')
+ .click(getNthReplyButton(3))
+ .hover(getNthStatus(4))
+ .hover(getNthStatus(5))
+ .hover(getNthStatus(6))
+ .hover(getNthStatus(7))
+ .click(getNthReplyButton(7))
+ .expect(getNthPostPrivacyButton(7).getAttribute('aria-label')).eql('Adjust privacy (currently Public)')
+ .click(getNthReplyButton(7))
+})
diff --git a/tests/utils.js b/tests/utils.js
index 3448e89..d444e4f 100644
--- a/tests/utils.js
+++ b/tests/utils.js
@@ -104,6 +104,10 @@ export function getNthComposeReplyButton (n) {
return getNthStatus(n).find('.compose-box-button')
}
+export function getNthPostPrivacyButton (n) {
+ return getNthStatus(n).find('.compose-box-toolbar button:nth-child(3)')
+}
+
export function getNthAutosuggestionResult (n) {
return $(`.compose-autosuggest-list-item:nth-child(${n}) button`)
}