Commit 3a65ddaa authored by ikuradon's avatar ikuradon 🐈

Revert "[New] Implement a feature of quote"

This reverts commit 96914854.
parent 993e7059
......@@ -149,7 +149,6 @@ export function submitCompose(routerHistory) {
return function (dispatch, getState) {
let status = getState().getIn(['compose', 'text'], '');
const media = getState().getIn(['compose', 'media_attachments']);
const quoteId = getState().getIn(['compose', 'quote_from'], null);
if ((!status || !status.length) && media.size === 0) {
return;
......@@ -162,13 +161,6 @@ export function submitCompose(routerHistory) {
status = [status, ` #${tag.get('text')}`].join('')
}
});
if (quoteId) {
status = [
status,
"~~~~~~~~~~",
`[${quoteId}][${getState().getIn(['compose', 'quote_from_uri'], null)}]`
].join("\n");
}
dispatch(submitComposeRequest());
......
......@@ -36,8 +36,6 @@ export default class StatusContent extends React.PureComponent {
}
const links = node.querySelectorAll('a');
const QuoteUrlFormat = /(?:https?|ftp):\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+\/users\/[\w-_]+(\/statuses\/\w+)/;
const quote = node.innerText.match(new RegExp(`\\[(\\w+)\\]\\[${QuoteUrlFormat.source}\\]`));
for (var i = 0; i < links.length; ++i) {
let link = links[i];
......@@ -46,12 +44,6 @@ export default class StatusContent extends React.PureComponent {
}
link.classList.add('status-link');
if (quote) {
if (link.href.match(QuoteUrlFormat)) {
link.addEventListener('click', this.onQuoteClick.bind(this, quote[1]), false);
}
}
let mention = this.props.status.get('mentions').find(item => link.href === item.get('url'));
if (mention) {
......@@ -102,15 +94,6 @@ export default class StatusContent extends React.PureComponent {
}
}
onQuoteClick = (statusId, e) => {
let statusUrl = `/statuses/${statusId}`;
if (this.context.router && e.button === 0) {
e.preventDefault();
this.context.router.history.push(statusUrl);
}
}
handleMouseDown = (e) => {
this.startXY = [e.clientX, e.clientY];
}
......
......@@ -30,7 +30,7 @@ export default class QuoteIndicator extends ImmutablePureComponent {
}
handleAccountClick = (e) => {
if (e.button === 0) {
if (e.button === 0 && !(e.ctrlKey || e.metaKey)) {
e.preventDefault();
this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`);
}
......
......@@ -7,7 +7,7 @@ const makeMapStateToProps = () => {
const getStatus = makeGetStatus();
const mapStateToProps = state => ({
status: getStatus(state, state.getIn(['compose', 'quote_from'])),
status: getStatus(state, { id: state.getIn(['compose', 'quote_from']) }),
});
return mapStateToProps;
......
......@@ -329,6 +329,10 @@
"defaultMessage": "Quote",
"id": "status.quote"
},
{
"defaultMessage": "Unlisted quote",
"id": "status.unlisted_quote"
},
{
"defaultMessage": "Favourite",
"id": "status.favourite"
......
......@@ -334,7 +334,8 @@
"status.pin": "プロフィールに固定表示",
"status.pinned": "固定されたトゥート",
"status.read_more": "もっと見る",
"status.quote": "引用ブースト",
"status.quote": "引用",
"status.unlisted_quote": "未収載の引用",
"status.reblog": "ブースト",
"status.reblog_private": "ブースト",
"status.reblogged_by": "{name}さんがブースト",
......
......@@ -60,7 +60,7 @@ const initialState = ImmutableMap({
preselectDate: null,
in_reply_to: null,
quote_from: null,
quote_from_uri: null,
quote_from_url: null,
is_composing: false,
is_submitting: false,
is_changing_upload: false,
......@@ -270,7 +270,7 @@ export default function compose(state = initialState, action) {
return state.withMutations(map => {
map.set('in_reply_to', action.status.get('id'));
map.set('quote_from', null);
map.set('quote_from_uri', null);
map.set('quote_from_url', null);
map.set('text', statusToTextMentions(state, action.status));
map.set('privacy', privacyPreference(action.status.get('visibility'), state.get('default_privacy')));
map.set('focusDate', new Date());
......@@ -290,12 +290,20 @@ export default function compose(state = initialState, action) {
return state.withMutations(map => {
map.set('in_reply_to', null);
map.set('quote_from', action.status.get('id'));
map.set('quote_from_uri', action.status.get('uri'));
map.set('quote_from_url', action.status.get('url'));
map.set('text', '');
map.set('privacy', privacyPreference(action.status.get('visibility'), state.get('default_privacy')));
map.set('focusDate', new Date());
map.set('preselectDate', new Date());
map.set('idempotencyKey', uuid());
if (action.status.get('spoiler_text').length > 0) {
map.set('spoiler', true);
map.set('spoiler_text', action.status.get('spoiler_text'));
} else {
map.set('spoiler', false);
map.set('spoiler_text', '');
}
});
case COMPOSE_REPLY_CANCEL:
case COMPOSE_QUOTE_CANCEL:
......@@ -303,7 +311,7 @@ export default function compose(state = initialState, action) {
return state.withMutations(map => {
map.set('in_reply_to', null);
map.set('quote_from', null);
map.set('quote_from_uri', null);
map.set('quote_from_url', null);
map.set('text', '');
map.set('spoiler', false);
map.set('spoiler_text', '');
......
......@@ -79,7 +79,7 @@ class FetchLinkCardService < BaseService
def bad_url?(uri)
# Avoid local instance URLs and invalid URLs
uri.host.blank? || (TagManager.instance.local_url?(uri.to_s) && uri.to_s !~ %r(/users/[\w_-]+/statuses/\w+)) || !%w(http https).include?(uri.scheme)
uri.host.blank? || TagManager.instance.local_url?(uri.to_s) || !%w(http https).include?(uri.scheme)
end
def mention_link?(a)
......@@ -128,7 +128,7 @@ class FetchLinkCardService < BaseService
# Most providers rely on <script> tags, which is a no-no
return false
end
@card.save_with_optional_image!
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment