From 494969d394f5e2c09f42e659e99411c34b69867f Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Sat, 10 Mar 2018 19:42:28 +0900 Subject: [PATCH 1/7] Remove git from Docker image (#6724) --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7a195b31e..e1b77b950 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,7 +32,6 @@ RUN apk -U upgrade \ ca-certificates \ ffmpeg \ file \ - git \ icu-libs \ imagemagick \ libidn \ From 58a4633707ad5e9abe4727752f6ebd43566845c0 Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Sat, 10 Mar 2018 19:42:42 +0900 Subject: [PATCH 2/7] Remove su-exec from Docker image (#6722) It is no longer necessary since commit be9bab171dc2b1fe43bc742decb71f64541ca347. --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e1b77b950..f6fd6c3cb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,7 +38,6 @@ RUN apk -U upgrade \ libpq \ nodejs \ protobuf \ - su-exec \ tini \ tzdata \ && update-ca-certificates \ From 4476a454445281b2468d03c9c6d4d99e52b1a597 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 10 Mar 2018 11:43:20 +0100 Subject: [PATCH 3/7] Fix #6717: Do not double html-encode page titles (#6720) --- app/views/layouts/application.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index b26d2c509..df898d5a2 100755 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -11,7 +11,7 @@ %meta{ name: 'theme-color', content: '#282c37' }/ %meta{ name: 'apple-mobile-web-app-capable', content: 'yes' }/ - %title= content_for?(:page_title) ? safe_join([yield(:page_title).chomp, ' - ', title]) : title + %title= content_for?(:page_title) ? safe_join([yield(:page_title).chomp.html_safe, title], ' - ') : title = stylesheet_pack_tag 'common', media: 'all' = stylesheet_pack_tag current_theme, media: 'all' From 36579bac88b88b7bb916ce7bcc56152427156a26 Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Sat, 10 Mar 2018 19:49:04 +0900 Subject: [PATCH 4/7] Use Alpine Linux yarn package in Docker (#6725) Yarn was manually installed to meet the Yarn version requirement of webpacker. Today, Alpine Linux 3.7 provides Yarn new enough. --- Dockerfile | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index f6fd6c3cb..9eb5e609d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,8 +9,6 @@ ARG GID=991 ENV RAILS_SERVE_STATIC_FILES=true \ RAILS_ENV=production NODE_ENV=production -ARG YARN_VERSION=1.5.1 -ARG YARN_DOWNLOAD_SHA256=cd31657232cf48d57fdbff55f38bfa058d2fb4950450bd34af72dac796af4de1 ARG LIBICONV_VERSION=1.15 ARG LIBICONV_DOWNLOAD_SHA256=ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc8913178 @@ -40,14 +38,9 @@ RUN apk -U upgrade \ protobuf \ tini \ tzdata \ + yarn \ && update-ca-certificates \ - && mkdir -p /tmp/src /opt \ - && wget -O yarn.tar.gz "https://github.com/yarnpkg/yarn/releases/download/v$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \ - && echo "$YARN_DOWNLOAD_SHA256 *yarn.tar.gz" | sha256sum -c - \ - && tar -xzf yarn.tar.gz -C /tmp/src \ - && rm yarn.tar.gz \ - && mv /tmp/src/yarn-v$YARN_VERSION /opt/yarn \ - && ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \ + && mkdir -p /tmp/src \ && wget -O libiconv.tar.gz "https://ftp.gnu.org/pub/gnu/libiconv/libiconv-$LIBICONV_VERSION.tar.gz" \ && echo "$LIBICONV_DOWNLOAD_SHA256 *libiconv.tar.gz" | sha256sum -c - \ && tar -xzf libiconv.tar.gz -C /tmp/src \ From 37b043d4478fb195d0c2ae7fe7ba0207ce63032d Mon Sep 17 00:00:00 2001 From: abcang Date: Sun, 11 Mar 2018 01:44:26 +0900 Subject: [PATCH 5/7] Improve performance of account_media_status_ids (#6729) --- app/controllers/api/v1/accounts/statuses_controller.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/accounts/statuses_controller.rb b/app/controllers/api/v1/accounts/statuses_controller.rb index 7261ccd24..1e1511a7b 100644 --- a/app/controllers/api/v1/accounts/statuses_controller.rb +++ b/app/controllers/api/v1/accounts/statuses_controller.rb @@ -51,7 +51,13 @@ class Api::V1::Accounts::StatusesController < Api::BaseController end def account_media_status_ids - @account.media_attachments.attached.reorder(nil).select(:status_id).distinct + # `SELECT DISTINCT id, updated_at` is too slow, so pluck ids at first, and then select id, updated_at with ids. + # Also, Avoid getting slow by not narrowing down by `statuses.account_id`. + # When narrowing down by `statuses.account_id`, `index_statuses_20180106` will be used + # and the table will be joined by `Merge Semi Join`, so the query will be slow. + Status.joins(:media_attachments).merge(@account.media_attachments).permitted_for(@account, current_account) + .paginate_by_max_id(limit_param(DEFAULT_STATUSES_LIMIT), params[:max_id], params[:since_id]) + .reorder(id: :desc).distinct(:id).pluck(:id) end def pinned_scope From f5ee2d469bb2ff398571694a95a16c8e819153c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Miko=C5=82ajczak?= Date: Sat, 10 Mar 2018 17:56:30 +0100 Subject: [PATCH 6/7] i18n: Update Polish translation (#6731) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcin Mikołajczak --- app/javascript/mastodon/locales/pl.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/javascript/mastodon/locales/pl.json b/app/javascript/mastodon/locales/pl.json index d85d8ae64..ba9d64e4c 100644 --- a/app/javascript/mastodon/locales/pl.json +++ b/app/javascript/mastodon/locales/pl.json @@ -3,7 +3,7 @@ "account.block_domain": "Blokuj wszystko z {domain}", "account.blocked": "Zablokowany", "account.disclaimer_full": "Poniższe informacje mogą nie odwzorowywać bezbłędnie profilu użytkownika.", - "account.domain_blocked": "Domain hidden", + "account.domain_blocked": "Ukryto domenę", "account.edit_profile": "Edytuj profil", "account.follow": "Śledź", "account.followers": "Śledzący", @@ -219,7 +219,7 @@ "report.target": "Zgłaszanie {target}", "search.placeholder": "Szukaj", "search_popout.search_format": "Zaawansowane wyszukiwanie", - "search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, boosted, or have been mentioned in, as well as matching usernames, display names, and hashtags.", + "search_popout.tips.full_text": "Pozwala na wyszukiwanie wpisów które napisałeś, dodałeś do ulubionych, podbiłeś w których o Tobie wspomniano, oraz pasujące nazwy użytkowników, pełne nazwy i hashtagi.", "search_popout.tips.hashtag": "hashtag", "search_popout.tips.status": "wpis", "search_popout.tips.text": "Proste wyszukiwanie pasujących pseudonimów, nazw użytkowników i hashtagów", @@ -263,7 +263,7 @@ "upload_area.title": "Przeciągnij i upuść aby wysłać", "upload_button.label": "Dodaj zawartość multimedialną", "upload_form.description": "Wprowadź opis dla niewidomych i niedowidzących", - "upload_form.focus": "Crop", + "upload_form.focus": "Przytnij", "upload_form.undo": "Cofnij", "upload_progress.label": "Wysyłanie", "video.close": "Zamknij film", From b6003afcdb1b89eb967a2b211e3b4e26aed9ac9d Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sun, 11 Mar 2018 09:52:59 +0100 Subject: [PATCH 7/7] Add show more/less toggle for entire threads in web UI (#6733) Fix #1258 --- app/javascript/mastodon/actions/statuses.js | 25 ++++++++++++ .../mastodon/components/column_header.js | 26 +++++++----- app/javascript/mastodon/components/status.js | 12 ++---- .../mastodon/containers/status_container.js | 16 +++++++- .../status/components/detailed_status.js | 7 +++- .../mastodon/features/status/index.js | 40 +++++++++++++++++-- app/javascript/mastodon/reducers/statuses.js | 15 ++++++- .../styles/mastodon/components.scss | 4 ++ 8 files changed, 120 insertions(+), 25 deletions(-) diff --git a/app/javascript/mastodon/actions/statuses.js b/app/javascript/mastodon/actions/statuses.js index 2204e0b14..073f09883 100644 --- a/app/javascript/mastodon/actions/statuses.js +++ b/app/javascript/mastodon/actions/statuses.js @@ -23,6 +23,9 @@ export const STATUS_UNMUTE_REQUEST = 'STATUS_UNMUTE_REQUEST'; export const STATUS_UNMUTE_SUCCESS = 'STATUS_UNMUTE_SUCCESS'; export const STATUS_UNMUTE_FAIL = 'STATUS_UNMUTE_FAIL'; +export const STATUS_REVEAL = 'STATUS_REVEAL'; +export const STATUS_HIDE = 'STATUS_HIDE'; + export function fetchStatusRequest(id, skipLoading) { return { type: STATUS_FETCH_REQUEST, @@ -215,3 +218,25 @@ export function unmuteStatusFail(id, error) { error, }; }; + +export function hideStatus(ids) { + if (!Array.isArray(ids)) { + ids = [ids]; + } + + return { + type: STATUS_HIDE, + ids, + }; +}; + +export function revealStatus(ids) { + if (!Array.isArray(ids)) { + ids = [ids]; + } + + return { + type: STATUS_REVEAL, + ids, + }; +}; diff --git a/app/javascript/mastodon/components/column_header.js b/app/javascript/mastodon/components/column_header.js index 6b79ec02d..56453aeac 100644 --- a/app/javascript/mastodon/components/column_header.js +++ b/app/javascript/mastodon/components/column_header.js @@ -19,10 +19,11 @@ export default class ColumnHeader extends React.PureComponent { static propTypes = { intl: PropTypes.object.isRequired, - title: PropTypes.node.isRequired, - icon: PropTypes.string.isRequired, + title: PropTypes.node, + icon: PropTypes.string, active: PropTypes.bool, multiColumn: PropTypes.bool, + extraButton: PropTypes.node, showBackButton: PropTypes.bool, children: PropTypes.node, pinned: PropTypes.bool, @@ -63,7 +64,7 @@ export default class ColumnHeader extends React.PureComponent { } render () { - const { title, icon, active, children, pinned, onPin, multiColumn, showBackButton, intl: { formatMessage } } = this.props; + const { title, icon, active, children, pinned, onPin, multiColumn, extraButton, showBackButton, intl: { formatMessage } } = this.props; const { collapsed, animating } = this.state; const wrapperClassName = classNames('column-header__wrapper', { @@ -125,19 +126,26 @@ export default class ColumnHeader extends React.PureComponent { } if (children || multiColumn) { - collapseButton = ; + collapseButton = ; } + const hasTitle = icon && title; + return (

- + {hasTitle && ( + + )} + + {!hasTitle && backButton}
- {backButton} + {hasTitle && backButton} + {extraButton} {collapseButton}

diff --git a/app/javascript/mastodon/components/status.js b/app/javascript/mastodon/components/status.js index 8102d1e06..a918a94f8 100644 --- a/app/javascript/mastodon/components/status.js +++ b/app/javascript/mastodon/components/status.js @@ -37,16 +37,13 @@ export default class Status extends ImmutablePureComponent { onBlock: PropTypes.func, onEmbed: PropTypes.func, onHeightChange: PropTypes.func, + onToggleHidden: PropTypes.func, muted: PropTypes.bool, hidden: PropTypes.bool, onMoveUp: PropTypes.func, onMoveDown: PropTypes.func, }; - state = { - isExpanded: false, - } - // Avoid checking props that are functions (and whose equality will always // evaluate to false. See react-immutable-pure-component for usage. updateOnProps = [ @@ -56,8 +53,6 @@ export default class Status extends ImmutablePureComponent { 'hidden', ] - updateOnStates = ['isExpanded'] - handleClick = () => { if (!this.context.router) { return; @@ -76,7 +71,7 @@ export default class Status extends ImmutablePureComponent { } handleExpandedToggle = () => { - this.setState({ isExpanded: !this.state.isExpanded }); + this.props.onToggleHidden(this._properStatus()); }; renderLoadingMediaGallery () { @@ -140,7 +135,6 @@ export default class Status extends ImmutablePureComponent { let statusAvatar, prepend; const { hidden, featured } = this.props; - const { isExpanded } = this.state; let { status, account, ...other } = this.props; @@ -248,7 +242,7 @@ export default class Status extends ImmutablePureComponent {
- + {media} diff --git a/app/javascript/mastodon/containers/status_container.js b/app/javascript/mastodon/containers/status_container.js index b22540204..8ba1015b5 100644 --- a/app/javascript/mastodon/containers/status_container.js +++ b/app/javascript/mastodon/containers/status_container.js @@ -15,7 +15,13 @@ import { unpin, } from '../actions/interactions'; import { blockAccount } from '../actions/accounts'; -import { muteStatus, unmuteStatus, deleteStatus } from '../actions/statuses'; +import { + muteStatus, + unmuteStatus, + deleteStatus, + hideStatus, + revealStatus, +} from '../actions/statuses'; import { initMuteModal } from '../actions/mutes'; import { initReport } from '../actions/reports'; import { openModal } from '../actions/modal'; @@ -128,6 +134,14 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ } }, + onToggleHidden (status) { + if (status.get('hidden')) { + dispatch(revealStatus(status.get('id'))); + } else { + dispatch(hideStatus(status.get('id'))); + } + }, + }); export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Status)); diff --git a/app/javascript/mastodon/features/status/components/detailed_status.js b/app/javascript/mastodon/features/status/components/detailed_status.js index d4f21fc32..b5f516032 100644 --- a/app/javascript/mastodon/features/status/components/detailed_status.js +++ b/app/javascript/mastodon/features/status/components/detailed_status.js @@ -22,6 +22,7 @@ export default class DetailedStatus extends ImmutablePureComponent { status: ImmutablePropTypes.map.isRequired, onOpenMedia: PropTypes.func.isRequired, onOpenVideo: PropTypes.func.isRequired, + onToggleHidden: PropTypes.func.isRequired, }; handleAccountClick = (e) => { @@ -37,6 +38,10 @@ export default class DetailedStatus extends ImmutablePureComponent { this.props.onOpenVideo(this.props.status.getIn(['media_attachments', 0]), startTime); } + handleExpandedToggle = () => { + this.props.onToggleHidden(this.props.status); + } + render () { const status = this.props.status.get('reblog') ? this.props.status.get('reblog') : this.props.status; @@ -105,7 +110,7 @@ export default class DetailedStatus extends ImmutablePureComponent { - + {media} diff --git a/app/javascript/mastodon/features/status/index.js b/app/javascript/mastodon/features/status/index.js index 73ea9321d..2f482b292 100644 --- a/app/javascript/mastodon/features/status/index.js +++ b/app/javascript/mastodon/features/status/index.js @@ -21,12 +21,19 @@ import { mentionCompose, } from '../../actions/compose'; import { blockAccount } from '../../actions/accounts'; -import { muteStatus, unmuteStatus, deleteStatus } from '../../actions/statuses'; +import { + muteStatus, + unmuteStatus, + deleteStatus, + hideStatus, + revealStatus, +} from '../../actions/statuses'; import { initMuteModal } from '../../actions/mutes'; import { initReport } from '../../actions/reports'; import { makeGetStatus } from '../../selectors'; import { ScrollContainer } from 'react-router-scroll-4'; import ColumnBackButton from '../../components/column_back_button'; +import ColumnHeader from '../../components/column_header'; import StatusContainer from '../../containers/status_container'; import { openModal } from '../../actions/modal'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; @@ -39,6 +46,8 @@ const messages = defineMessages({ deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' }, deleteMessage: { id: 'confirmations.delete.message', defaultMessage: 'Are you sure you want to delete this status?' }, blockConfirm: { id: 'confirmations.block.confirm', defaultMessage: 'Block' }, + revealAll: { id: 'status.show_more_all', defaultMessage: 'Show more for all' }, + hideAll: { id: 'status.show_less_all', defaultMessage: 'Show less for all' }, }); const makeMapStateToProps = () => { @@ -163,6 +172,25 @@ export default class Status extends ImmutablePureComponent { } } + handleToggleHidden = (status) => { + if (status.get('hidden')) { + this.props.dispatch(revealStatus(status.get('id'))); + } else { + this.props.dispatch(hideStatus(status.get('id'))); + } + } + + handleToggleAll = () => { + const { status, ancestorsIds, descendantsIds } = this.props; + const statusIds = [status.get('id')].concat(ancestorsIds.toJS(), descendantsIds.toJS()); + + if (status.get('hidden')) { + this.props.dispatch(revealStatus(statusIds)); + } else { + this.props.dispatch(hideStatus(statusIds)); + } + } + handleBlockClick = (account) => { const { dispatch, intl } = this.props; @@ -293,7 +321,7 @@ export default class Status extends ImmutablePureComponent { render () { let ancestors, descendants; - const { status, ancestorsIds, descendantsIds } = this.props; + const { status, ancestorsIds, descendantsIds, intl } = this.props; const { fullscreen } = this.state; if (status === null) { @@ -325,7 +353,12 @@ export default class Status extends ImmutablePureComponent { return ( - + + )} + />
@@ -337,6 +370,7 @@ export default class Status extends ImmutablePureComponent { status={status} onOpenVideo={this.handleOpenVideo} onOpenMedia={this.handleOpenMedia} + onToggleHidden={this.handleToggleHidden} /> { }, {}); normalStatus.search_index = domParser.parseFromString(searchContent, 'text/html').documentElement.textContent; - normalStatus.contentHtml = emojify(normalStatus.content, emojiMap); - normalStatus.spoilerHtml = emojify(escapeTextContentForBrowser(normalStatus.spoiler_text || ''), emojiMap); + normalStatus.contentHtml = emojify(normalStatus.content, emojiMap); + normalStatus.spoilerHtml = emojify(escapeTextContentForBrowser(normalStatus.spoiler_text || ''), emojiMap); + normalStatus.hidden = normalStatus.sensitive; return state.update(status.id, ImmutableMap(), map => map.mergeDeep(fromJS(normalStatus))); }; @@ -111,6 +114,14 @@ export default function statuses(state = initialState, action) { return state.setIn([action.id, 'muted'], true); case STATUS_UNMUTE_SUCCESS: return state.setIn([action.id, 'muted'], false); + case STATUS_REVEAL: + return state.withMutations(map => { + action.ids.forEach(id => map.setIn([id, 'hidden'], false)); + }); + case STATUS_HIDE: + return state.withMutations(map => { + action.ids.forEach(id => map.setIn([id, 'hidden'], true)); + }); case TIMELINE_REFRESH_SUCCESS: case TIMELINE_EXPAND_SUCCESS: case CONTEXT_FETCH_SUCCESS: diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index 5c2e5713d..1f3fb0fcd 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -2515,6 +2515,10 @@ a.status-card { flex: 1; } + & > .column-header__back-button { + color: $ui-highlight-color; + } + &.active { box-shadow: 0 1px 0 rgba($ui-highlight-color, 0.3);