From aae01581d95961150977dde096a8b13e21fdda82 Mon Sep 17 00:00:00 2001
From: 2458773093 <2458773093@protonmail.com>
Date: Tue, 30 Jul 2019 21:27:49 +0300
Subject: [PATCH] quote compose
---
app/javascript/gabsocial/actions/compose.js | 13 +++++++++++
app/javascript/gabsocial/components/status.js | 1 +
.../gabsocial/components/status_action_bar.js | 14 +++++++++++
.../gabsocial/containers/status_container.js | 18 +++++++++++++++
app/javascript/gabsocial/reducers/compose.js | 23 +++++++++++++++++++
5 files changed, 69 insertions(+)
diff --git a/app/javascript/gabsocial/actions/compose.js b/app/javascript/gabsocial/actions/compose.js
index e377ece9..bd5424fc 100644
--- a/app/javascript/gabsocial/actions/compose.js
+++ b/app/javascript/gabsocial/actions/compose.js
@@ -20,6 +20,7 @@ export const COMPOSE_SUBMIT_REQUEST = 'COMPOSE_SUBMIT_REQUEST';
export const COMPOSE_SUBMIT_SUCCESS = 'COMPOSE_SUBMIT_SUCCESS';
export const COMPOSE_SUBMIT_FAIL = 'COMPOSE_SUBMIT_FAIL';
export const COMPOSE_REPLY = 'COMPOSE_REPLY';
+export const COMPOSE_QUOTE = 'COMPOSE_QUOTE';
export const COMPOSE_REPLY_CANCEL = 'COMPOSE_REPLY_CANCEL';
export const COMPOSE_DIRECT = 'COMPOSE_DIRECT';
export const COMPOSE_MENTION = 'COMPOSE_MENTION';
@@ -91,6 +92,17 @@ export function replyCompose(status, routerHistory) {
};
};
+export function quoteCompose(status, routerHistory) {
+ return (dispatch, getState) => {
+ dispatch({
+ type: COMPOSE_QUOTE,
+ status: status,
+ });
+
+ dispatch(openModal('COMPOSE'));
+ };
+};
+
export function cancelReplyCompose() {
return {
type: COMPOSE_REPLY_CANCEL,
@@ -142,6 +154,7 @@ export function submitCompose(routerHistory, group) {
api(getState).post('/api/v1/statuses', {
status,
in_reply_to_id: getState().getIn(['compose', 'in_reply_to'], null),
+ quote_of_id: getState().getIn(['compose', 'quote_of_id'], null),
media_ids: media.map(item => item.get('id')),
sensitive: getState().getIn(['compose', 'sensitive']),
spoiler_text: getState().getIn(['compose', 'spoiler_text'], ''),
diff --git a/app/javascript/gabsocial/components/status.js b/app/javascript/gabsocial/components/status.js
index 61a5a06c..5f6a225b 100644
--- a/app/javascript/gabsocial/components/status.js
+++ b/app/javascript/gabsocial/components/status.js
@@ -66,6 +66,7 @@ class Status extends ImmutablePureComponent {
otherAccounts: ImmutablePropTypes.list,
onClick: PropTypes.func,
onReply: PropTypes.func,
+ onQuote: PropTypes.func,
onFavourite: PropTypes.func,
onReblog: PropTypes.func,
onDelete: PropTypes.func,
diff --git a/app/javascript/gabsocial/components/status_action_bar.js b/app/javascript/gabsocial/components/status_action_bar.js
index e65fd689..ac2f3b22 100644
--- a/app/javascript/gabsocial/components/status_action_bar.js
+++ b/app/javascript/gabsocial/components/status_action_bar.js
@@ -23,9 +23,11 @@ const messages = defineMessages({
more: { id: 'status.more', defaultMessage: 'More' },
replyAll: { id: 'status.replyAll', defaultMessage: 'Reply to thread' },
reblog: { id: 'status.reblog', defaultMessage: 'Repost' },
+ quote: { id: 'status.quote', defaultMessage: 'Quote' },
reblog_private: { id: 'status.reblog_private', defaultMessage: 'Repost to original audience' },
cancel_reblog_private: { id: 'status.cancel_reblog_private', defaultMessage: 'Un-repost' },
cannot_reblog: { id: 'status.cannot_reblog', defaultMessage: 'This post cannot be reposted' },
+ cannot_quote: { id: 'status.cannot_quote', defaultMessage: 'This post cannot be quoted' },
favourite: { id: 'status.favourite', defaultMessage: 'Favorite' },
open: { id: 'status.open', defaultMessage: 'Expand this status' },
report: { id: 'status.report', defaultMessage: 'Report @{name}' },
@@ -51,6 +53,7 @@ class StatusActionBar extends ImmutablePureComponent {
status: ImmutablePropTypes.map.isRequired,
onOpenUnauthorizedModal: PropTypes.func.isRequired,
onReply: PropTypes.func,
+ onQuote: PropTypes.func,
onFavourite: PropTypes.func,
onReblog: PropTypes.func,
onDelete: PropTypes.func,
@@ -82,6 +85,14 @@ class StatusActionBar extends ImmutablePureComponent {
}
}
+ handleQuoteClick = () => {
+ if (me) {
+ this.props.onQuote(this.props.status, this.context.router.history);
+ } else {
+ this.props.onOpenUnauthorizedModal();
+ }
+ }
+
handleShareClick = () => {
navigator.share({
text: this.props.status.get('search_index'),
@@ -283,6 +294,9 @@ class StatusActionBar extends ImmutablePureComponent {