diff options
author | Claire <claire.github-309c@sitedethib.com> | 2021-05-07 18:21:59 +0200 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2021-05-07 18:21:59 +0200 |
commit | 50b430d9a2857edf8ab44e9b94c7bcb14ecd2117 (patch) | |
tree | 4932ca1d8e52f6ce9b8b9fbb304b6bfce4027e54 /app/javascript/mastodon/actions | |
parent | a346912030012dc1451249373ff7ef1a61016517 (diff) | |
parent | d8e0c8a89e1f1dd1c4ce1513deaeb3c85c6e4a42 (diff) |
Merge branch 'main' into glitch-soc/merge-upstream
- `app/views/statuses/_simple_status.html.haml`: Small markup change in glitch-soc, on a line that has been modified by upstream. Ported upstream changes.
Diffstat (limited to 'app/javascript/mastodon/actions')
-rw-r--r-- | app/javascript/mastodon/actions/importer/normalizer.js | 7 | ||||
-rw-r--r-- | app/javascript/mastodon/actions/search.js | 1 | ||||
-rw-r--r-- | app/javascript/mastodon/actions/timelines.js | 16 |
3 files changed, 23 insertions, 1 deletions
diff --git a/app/javascript/mastodon/actions/importer/normalizer.js b/app/javascript/mastodon/actions/importer/normalizer.js index 087f26491..abd5681d4 100644 --- a/app/javascript/mastodon/actions/importer/normalizer.js +++ b/app/javascript/mastodon/actions/importer/normalizer.js @@ -62,6 +62,13 @@ export function normalizeStatus(status, normalOldStatus) { normalStatus.spoilerHtml = normalOldStatus.get('spoilerHtml'); normalStatus.hidden = normalOldStatus.get('hidden'); } else { + // If the status has a CW but no contents, treat the CW as if it were the + // status' contents, to avoid having a CW toggle with seemingly no effect. + if (normalStatus.spoiler_text && !normalStatus.content) { + normalStatus.content = normalStatus.spoiler_text; + normalStatus.spoiler_text = ''; + } + const spoilerText = normalStatus.spoiler_text || ''; const searchContent = ([spoilerText, status.content].concat((status.poll && status.poll.options) ? status.poll.options.map(option => option.title) : [])).join('\n\n').replace(/<br\s*\/?>/g, '\n').replace(/<\/p><p>/g, '\n\n'); const emojiMap = makeEmojiMap(normalStatus); diff --git a/app/javascript/mastodon/actions/search.js b/app/javascript/mastodon/actions/search.js index a178faead..37560a74c 100644 --- a/app/javascript/mastodon/actions/search.js +++ b/app/javascript/mastodon/actions/search.js @@ -32,6 +32,7 @@ export function submitSearch() { const value = getState().getIn(['search', 'value']); if (value.length === 0) { + dispatch(fetchSearchSuccess({ accounts: [], statuses: [], hashtags: [] }, '')); return; } diff --git a/app/javascript/mastodon/actions/timelines.js b/app/javascript/mastodon/actions/timelines.js index de1725acf..31ae09e4a 100644 --- a/app/javascript/mastodon/actions/timelines.js +++ b/app/javascript/mastodon/actions/timelines.js @@ -18,17 +18,26 @@ export const TIMELINE_LOAD_PENDING = 'TIMELINE_LOAD_PENDING'; export const TIMELINE_DISCONNECT = 'TIMELINE_DISCONNECT'; export const TIMELINE_CONNECT = 'TIMELINE_CONNECT'; +export const TIMELINE_MARK_AS_PARTIAL = 'TIMELINE_MARK_AS_PARTIAL'; + export const loadPending = timeline => ({ type: TIMELINE_LOAD_PENDING, timeline, }); export function updateTimeline(timeline, status, accept) { - return dispatch => { + return (dispatch, getState) => { if (typeof accept === 'function' && !accept(status)) { return; } + if (getState().getIn(['timelines', timeline, 'isPartial'])) { + // Prevent new items from being added to a partial timeline, + // since it will be reloaded anyway + + return; + } + dispatch(importFetchedStatus(status)); dispatch({ @@ -183,3 +192,8 @@ export const disconnectTimeline = timeline => ({ timeline, usePendingItems: preferPendingItems, }); + +export const markAsPartial = timeline => ({ + type: TIMELINE_MARK_AS_PARTIAL, + timeline, +}); |