diff --git a/routes/_actions/statuses.js b/routes/_actions/statuses.js index e8b84e88..1b760c2c 100644 --- a/routes/_actions/statuses.js +++ b/routes/_actions/statuses.js @@ -35,12 +35,18 @@ export async function postStatus (realm, text, inReplyToId, mediaIds, return } - store.set({postingStatus: true}) + store.set({ + postingStatus: true, + postedStatusForRealm: null + }) try { let status = await postStatusToServer(instanceName, accessToken, text, inReplyToId, mediaIds, sensitive, spoilerText, visibility) addStatusOrNotification(instanceName, 'home', status) store.clearComposeData(realm) + store.set({ + postedStatusForRealm: realm + }) } catch (e) { toast.say('Unable to post status: ' + (e.message || '')) } finally { diff --git a/routes/_components/compose/ComposeBox.html b/routes/_components/compose/ComposeBox.html index c690af1a..eebf6981 100644 --- a/routes/_components/compose/ComposeBox.html +++ b/routes/_components/compose/ComposeBox.html @@ -61,6 +61,13 @@ import { postStatus } from '../../_actions/statuses' export default { + oncreate() { + this.observe('postedStatusForRealm', postedStatusForRealm => { + if (postedStatusForRealm === this.get('realm')) { + window.history.back() + } + }, {init: false}) + }, components: { ComposeAuthor, ComposeToolbar, @@ -86,7 +93,8 @@ }, overLimit: (length) => length > CHAR_LIMIT, contentWarningShown: (composeData) => composeData.contentWarningShown, - contentWarning: (composeData) => composeData.contentWarning || '' + contentWarning: (composeData) => composeData.contentWarning || '', + postedStatusForRealm: ($postedStatusForRealm) => $postedStatusForRealm }, transitions: { slide @@ -101,7 +109,9 @@ let realm = this.get('realm') let mediaIds = media.map(_ => _.data.id) - /* no await */ postStatus(realm, text, null, mediaIds, + let inReplyTo = realm === 'home' ? null : realm + + /* no await */ postStatus(realm, text, inReplyTo, mediaIds, sensitive, contentWarning, postPrivacyKey) } } diff --git a/routes/_components/status/Status.html b/routes/_components/status/Status.html index 34f3394d..477011de 100644 --- a/routes/_components/status/Status.html +++ b/routes/_components/status/Status.html @@ -157,7 +157,9 @@ return `${$currentInstance}/${timelineType}/${timelineValue}/${notification ? notification.id : ''}/${status.id}` }, originalAccount: (originalStatus) => originalStatus.account, - isStatusInOwnThread: (timelineType, timelineValue, statusId) => timelineType === 'status' && timelineValue === statusId, + isStatusInOwnThread: (timelineType, timelineValue, statusId) => { + return (timelineType === 'status' || timelineType === 'reply') && timelineValue === statusId + }, isStatusInNotification: (status, notification) => notification && notification.status && notification.type !== 'mention' && notification.status.id === status.id, spoilerShown: ($spoilersShown, contextualStatusId) => !!$spoilersShown[contextualStatusId], visibility: (originalStatus) => originalStatus.visibility, diff --git a/routes/_components/status/StatusToolbar.html b/routes/_components/status/StatusToolbar.html index ee0dc4d7..fee691ba 100644 --- a/routes/_components/status/StatusToolbar.html +++ b/routes/_components/status/StatusToolbar.html @@ -2,6 +2,9 @@ this.onFavoriteClick()) registerClickDelegate(this.get('reblogKey'), () => this.onReblogClick()) + registerClickDelegate(this.get('replyKey'), () => this.onReplyClick()) }, ondestroy() { unregisterClickDelegate(this.get('favoriteKey')) unregisterClickDelegate(this.get('reblogKey')) + unregisterClickDelegate(this.get('replyKey')) }, components: { IconButton @@ -65,6 +71,10 @@ let statusId = this.get('statusId') let reblogged = this.get('reblogged') /* no await */ setReblogged(statusId, !reblogged) + }, + onReplyClick() { + let statusId = this.get('statusId') + goto(`/statuses/${statusId}/reply`) } }, computed: { @@ -105,8 +115,10 @@ return status.favourited }, statusId: (status) => status.id, + disableReply: (statusId, timelineType, timelineValue) => timelineType === 'reply' && statusId === timelineValue, favoriteKey: (statusId, timelineType, timelineValue) => `fav-${timelineType}-${timelineValue}-${statusId}`, reblogKey: (statusId, timelineType, timelineValue) => `reblog-${timelineType}-${timelineValue}-${statusId}`, + replyKey: (statusId, timelineType, timelineValue) => `reply-${timelineType}-${timelineValue}-${statusId}`, } } \ No newline at end of file diff --git a/routes/statuses/[statusId]/reply.html b/routes/statuses/[statusId]/reply.html new file mode 100644 index 00000000..ba4302c8 --- /dev/null +++ b/routes/statuses/[statusId]/reply.html @@ -0,0 +1,53 @@ +<:Head> + Pinafore – Reply + + + + +
+ {{#if status}} + + + {{else}} + + {{/if}} +
+
+ + \ No newline at end of file