From 47e507fa61be6dc39dd9821e1d07c33e993cc246 Mon Sep 17 00:00:00 2001 From: ThibG Date: Mon, 14 Dec 2020 10:03:09 +0100 Subject: Add ability to require invite request text (#15326) Fixes #15273 Co-authored-by: Claire --- app/javascript/styles/mastodon/forms.scss | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'app/javascript/styles') diff --git a/app/javascript/styles/mastodon/forms.scss b/app/javascript/styles/mastodon/forms.scss index 92d89e6f2..e0604303b 100644 --- a/app/javascript/styles/mastodon/forms.scss +++ b/app/javascript/styles/mastodon/forms.scss @@ -377,11 +377,6 @@ code { box-shadow: none; } - &:focus:invalid:not(:placeholder-shown), - &:required:invalid:not(:placeholder-shown) { - border-color: lighten($error-red, 12%); - } - &:required:valid { border-color: $valid-value-color; } @@ -397,6 +392,16 @@ code { } } + input[type=text], + input[type=number], + input[type=email], + input[type=password] { + &:focus:invalid:not(:placeholder-shown), + &:required:invalid:not(:placeholder-shown) { + border-color: lighten($error-red, 12%); + } + } + .input.field_with_errors { label { color: lighten($error-red, 12%); -- cgit From 1f564051b6b447e3663852c482982b3ff5a2f238 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 15 Dec 2020 12:56:43 +0100 Subject: Change RTL detection to rely on unicode-bidi paragraph by paragraph (#14573) --- app/helpers/statuses_helper.rb | 20 -------------- .../mastodon/components/autosuggest_input.js | 8 +----- .../mastodon/components/autosuggest_textarea.js | 8 +----- .../mastodon/components/status_content.js | 18 ++++-------- .../features/compose/components/reply_indicator.js | 6 +--- app/javascript/mastodon/rtl.js | 32 ---------------------- app/javascript/styles/mailer.scss | 12 +++++++- app/javascript/styles/mastodon/components.scss | 2 ++ app/views/notification_mailer/_status.html.haml | 4 +-- app/views/statuses/_detailed_status.html.haml | 2 +- app/views/statuses/_simple_status.html.haml | 2 +- spec/helpers/statuses_helper_spec.rb | 18 ------------ 12 files changed, 26 insertions(+), 106 deletions(-) delete mode 100644 app/javascript/mastodon/rtl.js (limited to 'app/javascript/styles') diff --git a/app/helpers/statuses_helper.rb b/app/helpers/statuses_helper.rb index daed9048f..1f654f34f 100644 --- a/app/helpers/statuses_helper.rb +++ b/app/helpers/statuses_helper.rb @@ -92,22 +92,6 @@ module StatusesHelper end end - def rtl_status?(status) - status.local? ? rtl?(status.text) : rtl?(strip_tags(status.text)) - end - - def rtl?(text) - text = simplified_text(text) - rtl_words = text.scan(/[\p{Hebrew}\p{Arabic}\p{Syriac}\p{Thaana}\p{Nko}]+/m) - - if rtl_words.present? - total_size = text.size.to_f - rtl_size(rtl_words) / total_size > 0.3 - else - false - end - end - def fa_visibility_icon(status) case status.visibility when 'public' @@ -143,10 +127,6 @@ module StatusesHelper end end - def rtl_size(words) - words.reduce(0) { |acc, elem| acc + elem.size }.to_f - end - def embedded_view? params[:controller] == EMBEDDED_CONTROLLER && params[:action] == EMBEDDED_ACTION end diff --git a/app/javascript/mastodon/components/autosuggest_input.js b/app/javascript/mastodon/components/autosuggest_input.js index 6d2035add..5187f95c8 100644 --- a/app/javascript/mastodon/components/autosuggest_input.js +++ b/app/javascript/mastodon/components/autosuggest_input.js @@ -4,7 +4,6 @@ import AutosuggestEmoji from './autosuggest_emoji'; import AutosuggestHashtag from './autosuggest_hashtag'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import { isRtl } from '../rtl'; import ImmutablePureComponent from 'react-immutable-pure-component'; import classNames from 'classnames'; import { List as ImmutableList } from 'immutable'; @@ -189,11 +188,6 @@ export default class AutosuggestInput extends ImmutablePureComponent { render () { const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus, className, id, maxLength } = this.props; const { suggestionsHidden } = this.state; - const style = { direction: 'ltr' }; - - if (isRtl(value)) { - style.direction = 'rtl'; - } return (
@@ -212,7 +206,7 @@ export default class AutosuggestInput extends ImmutablePureComponent { onKeyUp={onKeyUp} onFocus={this.onFocus} onBlur={this.onBlur} - style={style} + dir='auto' aria-autocomplete='list' id={id} className={className} diff --git a/app/javascript/mastodon/components/autosuggest_textarea.js b/app/javascript/mastodon/components/autosuggest_textarea.js index 58ec4f6eb..08b9cd80b 100644 --- a/app/javascript/mastodon/components/autosuggest_textarea.js +++ b/app/javascript/mastodon/components/autosuggest_textarea.js @@ -4,7 +4,6 @@ import AutosuggestEmoji from './autosuggest_emoji'; import AutosuggestHashtag from './autosuggest_hashtag'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import { isRtl } from '../rtl'; import ImmutablePureComponent from 'react-immutable-pure-component'; import Textarea from 'react-textarea-autosize'; import classNames from 'classnames'; @@ -195,11 +194,6 @@ export default class AutosuggestTextarea extends ImmutablePureComponent { render () { const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus, children } = this.props; const { suggestionsHidden } = this.state; - const style = { direction: 'ltr' }; - - if (isRtl(value)) { - style.direction = 'rtl'; - } return [
@@ -220,7 +214,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent { onFocus={this.onFocus} onBlur={this.onBlur} onPaste={this.onPaste} - style={style} + dir='auto' aria-autocomplete='list' /> diff --git a/app/javascript/mastodon/components/status_content.js b/app/javascript/mastodon/components/status_content.js index 3200f2d82..185a2a663 100644 --- a/app/javascript/mastodon/components/status_content.js +++ b/app/javascript/mastodon/components/status_content.js @@ -1,7 +1,6 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import { isRtl } from '../rtl'; import { FormattedMessage } from 'react-intl'; import Permalink from './permalink'; import classnames from 'classnames'; @@ -186,17 +185,12 @@ export default class StatusContent extends React.PureComponent { const content = { __html: status.get('contentHtml') }; const spoilerContent = { __html: status.get('spoilerHtml') }; - const directionStyle = { direction: 'ltr' }; const classNames = classnames('status__content', { 'status__content--with-action': this.props.onClick && this.context.router, 'status__content--with-spoiler': status.get('spoiler_text').length > 0, 'status__content--collapsed': renderReadMore, }); - if (isRtl(status.get('search_index'))) { - directionStyle.direction = 'rtl'; - } - const showThreadButton = ( + ); + } + +} diff --git a/app/javascript/mastodon/features/notifications/components/notifications_permission_banner.js b/app/javascript/mastodon/features/notifications/components/notifications_permission_banner.js index 6daf75814..df9b7fb1b 100644 --- a/app/javascript/mastodon/features/notifications/components/notifications_permission_banner.js +++ b/app/javascript/mastodon/features/notifications/components/notifications_permission_banner.js @@ -2,7 +2,8 @@ import React from 'react'; import Icon from 'mastodon/components/icon'; import Button from 'mastodon/components/button'; import IconButton from 'mastodon/components/icon_button'; -import { requestBrowserPermission, dismissBrowserPermission } from 'mastodon/actions/notifications'; +import { requestBrowserPermission } from 'mastodon/actions/notifications'; +import { changeSetting } from 'mastodon/actions/settings'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; @@ -25,7 +26,7 @@ class NotificationsPermissionBanner extends React.PureComponent { } handleClose = () => { - this.props.dispatch(dismissBrowserPermission()); + this.props.dispatch(changeSetting(['notifications', 'dismissPermissionBanner'], true)); } render () { diff --git a/app/javascript/mastodon/features/notifications/index.js b/app/javascript/mastodon/features/notifications/index.js index 2e0afd863..108470c9a 100644 --- a/app/javascript/mastodon/features/notifications/index.js +++ b/app/javascript/mastodon/features/notifications/index.js @@ -62,7 +62,7 @@ const mapStateToProps = state => ({ numPending: state.getIn(['notifications', 'pendingItems'], ImmutableList()).size, lastReadId: state.getIn(['notifications', 'readMarkerId']), canMarkAsRead: state.getIn(['notifications', 'readMarkerId']) !== '0' && getNotifications(state).some(item => item !== null && compareId(item.get('id'), state.getIn(['notifications', 'readMarkerId'])) > 0), - needsNotificationPermission: state.getIn(['settings', 'notifications', 'alerts']).includes(true) && state.getIn(['notifications', 'browserSupport']) && state.getIn(['notifications', 'browserPermission']) === 'default', + needsNotificationPermission: state.getIn(['settings', 'notifications', 'alerts']).includes(true) && state.getIn(['notifications', 'browserSupport']) && state.getIn(['notifications', 'browserPermission']) === 'default' && !state.getIn(['settings', 'notifications', 'dismissPermissionBanner']), }); export default @connect(mapStateToProps) diff --git a/app/javascript/mastodon/reducers/notifications.js b/app/javascript/mastodon/reducers/notifications.js index 46a9d5376..1d4874717 100644 --- a/app/javascript/mastodon/reducers/notifications.js +++ b/app/javascript/mastodon/reducers/notifications.js @@ -12,7 +12,6 @@ import { NOTIFICATIONS_MARK_AS_READ, NOTIFICATIONS_SET_BROWSER_SUPPORT, NOTIFICATIONS_SET_BROWSER_PERMISSION, - NOTIFICATIONS_DISMISS_BROWSER_PERMISSION, } from '../actions/notifications'; import { ACCOUNT_BLOCK_SUCCESS, @@ -251,8 +250,6 @@ export default function notifications(state = initialState, action) { return state.set('browserSupport', action.value); case NOTIFICATIONS_SET_BROWSER_PERMISSION: return state.set('browserPermission', action.value); - case NOTIFICATIONS_DISMISS_BROWSER_PERMISSION: - return state.set('browserPermission', 'denied'); default: return state; } diff --git a/app/javascript/mastodon/reducers/settings.js b/app/javascript/mastodon/reducers/settings.js index 057fa353a..357ab352a 100644 --- a/app/javascript/mastodon/reducers/settings.js +++ b/app/javascript/mastodon/reducers/settings.js @@ -44,6 +44,8 @@ const initialState = ImmutableMap({ advanced: false, }), + dismissPermissionBanner: false, + shows: ImmutableMap({ follow: true, follow_request: false, diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index 22bf025fb..2163d74fc 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -3459,6 +3459,12 @@ a.status-card.compact:hover { } } +.column-header__permission-btn { + display: inline; + font-weight: inherit; + text-decoration: underline; +} + .column-header__setting-arrows { float: right; @@ -3857,7 +3863,7 @@ a.status-card.compact:hover { } .column-settings__row { - .text-btn { + .text-btn:not(.column-header__permission-btn) { margin-bottom: 15px; } } -- cgit From 941ff04b03a8a3e3f03e95c108f0cfa621226fb1 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 18 Dec 2020 08:47:36 +0100 Subject: Fix styles for RTL languages and the light theme (#15356) --- app/javascript/styles/mastodon-light/diff.scss | 42 ++++++++++++++++++++++- app/javascript/styles/mastodon/rtl.scss | 46 +++++++++++++++++++++++++- 2 files changed, 86 insertions(+), 2 deletions(-) (limited to 'app/javascript/styles') diff --git a/app/javascript/styles/mastodon-light/diff.scss b/app/javascript/styles/mastodon-light/diff.scss index 64f4adb84..d4290d7e6 100644 --- a/app/javascript/styles/mastodon-light/diff.scss +++ b/app/javascript/styles/mastodon-light/diff.scss @@ -355,11 +355,45 @@ html { .error-modal, .onboarding-modal, .report-modal__comment .setting-text__wrapper, -.report-modal__comment .setting-text { +.report-modal__comment .setting-text, +.announcements, +.picture-in-picture__header, +.picture-in-picture__footer, +.reactions-bar__item { background: $white; border: 1px solid lighten($ui-base-color, 8%); } +.reactions-bar__item { + &:hover, + &:focus, + &:active { + background-color: $ui-base-color; + } +} + +.reactions-bar__item.active { + background-color: mix($white, $ui-highlight-color, 80%); + border-color: mix(lighten($ui-base-color, 8%), $ui-highlight-color, 80%); +} + +.media-modal__overlay .picture-in-picture__footer { + border: 0; +} + +.picture-in-picture__header { + border-bottom: 0; +} + +.announcements, +.picture-in-picture__footer { + border-top: 0; +} + +.icon-with-badge__badge { + border-color: $white; +} + .report-modal__comment { border-right-color: lighten($ui-base-color, 8%); } @@ -512,6 +546,12 @@ html { } } +.picture-in-picture-placeholder { + background: $white; + border-color: lighten($ui-base-color, 8%); + color: lighten($ui-base-color, 8%); +} + .brand__tagline { color: $ui-secondary-color; } diff --git a/app/javascript/styles/mastodon/rtl.scss b/app/javascript/styles/mastodon/rtl.scss index fbf26e30b..8051e4edb 100644 --- a/app/javascript/styles/mastodon/rtl.scss +++ b/app/javascript/styles/mastodon/rtl.scss @@ -17,15 +17,38 @@ body.rtl { margin-right: 15px; } - .display-name { + .display-name, + .announcements__item { text-align: right; } + .announcements__item__range { + padding-right: 0; + padding-left: 18px; + } + + .reactions-bar { + margin-left: auto; + margin-right: -2px; + direction: rtl; + } + + .reactions-bar__item__count { + margin-left: 0; + margin-right: 6px; + } + + .announcements__pagination { + right: auto; + left: 0; + } + .notification__message { margin-left: 0; margin-right: 68px; } + .announcements__mastodon, .drawer__inner__mastodon > img { transform: scaleX(-1); } @@ -195,6 +218,7 @@ body.rtl { margin-right: 0; } + .picture-in-picture__header__account .display-name, .detailed-status__display-name .display-name { text-align: right; } @@ -205,6 +229,21 @@ body.rtl { float: right; } + .picture-in-picture__header__account .account__avatar { + margin-right: 0; + margin-left: 10px; + } + + .icon-button__counter { + margin-left: 0; + margin-right: 4px; + } + + .notifications-permission-banner__close { + right: auto; + left: 10px; + } + .detailed-status__favorites, .detailed-status__reblogs { margin-left: 0; @@ -416,4 +455,9 @@ body.rtl { left: auto; right: 0; } + + .picture-in-picture { + right: auto; + left: 20px; + } } -- cgit From 47c6c54d31fe43cdda2fab55d39ad5f99c0538be Mon Sep 17 00:00:00 2001 From: ThibG Date: Fri, 18 Dec 2020 09:43:33 +0100 Subject: Fix styling issue on /about when server admin has a long username (#15357) Co-authored-by: Claire --- app/javascript/styles/mastodon/about.scss | 1 + 1 file changed, 1 insertion(+) (limited to 'app/javascript/styles') diff --git a/app/javascript/styles/mastodon/about.scss b/app/javascript/styles/mastodon/about.scss index 3be0aee49..d6bd9e3c6 100644 --- a/app/javascript/styles/mastodon/about.scss +++ b/app/javascript/styles/mastodon/about.scss @@ -732,6 +732,7 @@ $small-breakpoint: 960px; &__column { flex: 1 1 50%; + overflow-x: hidden; } } -- cgit