From 01ba6c5d83aeeafe6601896d38dc320e021e9d64 Mon Sep 17 00:00:00 2001 From: ThibG Date: Fri, 10 May 2019 17:59:57 +0200 Subject: [PATCH 1/6] Change icon and label depending on whether media is marked as sensitive (#10748) * Change icon and label depending on whether media is marked as sensitive * WiP use a checkbox --- .../containers/sensitive_button_container.js | 17 +++++++--- .../styles/mastodon/components.scss | 31 +++++++++++++++++-- 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/app/javascript/mastodon/features/compose/containers/sensitive_button_container.js b/app/javascript/mastodon/features/compose/containers/sensitive_button_container.js index 50612b086a..7073f76c2e 100644 --- a/app/javascript/mastodon/features/compose/containers/sensitive_button_container.js +++ b/app/javascript/mastodon/features/compose/containers/sensitive_button_container.js @@ -4,7 +4,6 @@ import PropTypes from 'prop-types'; import classNames from 'classnames'; import { changeComposeSensitivity } from 'mastodon/actions/compose'; import { injectIntl, defineMessages, FormattedMessage } from 'react-intl'; -import Icon from 'mastodon/components/icon'; const messages = defineMessages({ marked: { id: 'compose_form.sensitive.marked', defaultMessage: 'Media is marked as sensitive' }, @@ -38,9 +37,19 @@ class SensitiveButton extends React.PureComponent { return (
- +
); } diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index e8c5f70f55..834563ee9f 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -268,9 +268,34 @@ padding: 10px; padding-top: 0; - .icon-button { - font-size: 14px; - font-weight: 500; + font-size: 14px; + font-weight: 500; + + &.active { + color: $highlight-text-color; + } + + input[type=checkbox] { + display: none; + } + + .checkbox { + display: inline-block; + position: relative; + border: 1px solid $ui-primary-color; + box-sizing: border-box; + width: 18px; + height: 18px; + flex: 0 0 auto; + margin-right: 10px; + top: -1px; + border-radius: 4px; + vertical-align: middle; + + &.active { + border-color: $highlight-text-color; + background: $highlight-text-color; + } } } From 1959e4e5ec49f5a43b0de7cc84c897919d2e7eea Mon Sep 17 00:00:00 2001 From: Alix Rossi Date: Fri, 10 May 2019 18:09:34 +0200 Subject: [PATCH 2/6] i18n: Update Corsican translations (#10746) * i18n: Update Corsican translations * Update co.yml * Fix a translation in co.yml --- app/javascript/mastodon/locales/co.json | 3 ++- config/locales/co.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/javascript/mastodon/locales/co.json b/app/javascript/mastodon/locales/co.json index 016be39b39..335706af7e 100644 --- a/app/javascript/mastodon/locales/co.json +++ b/app/javascript/mastodon/locales/co.json @@ -77,6 +77,7 @@ "compose_form.poll.remove_option": "Toglie sta scelta", "compose_form.publish": "Toot", "compose_form.publish_loud": "{publish}!", + "compose_form.sensitive.hide": "Indicà u media cum'è sensibile", "compose_form.sensitive.marked": "Media indicatu cum'è sensibile", "compose_form.sensitive.unmarked": "Media micca indicatu cum'è sensibile", "compose_form.spoiler.marked": "Testu piattatu daret'à un'avertimentu", @@ -209,6 +210,7 @@ "lightbox.close": "Chjudà", "lightbox.next": "Siguente", "lightbox.previous": "Pricidente", + "lightbox.view_context": "Vede u cuntestu", "lists.account.add": "Aghjunghje à a lista", "lists.account.remove": "Toglie di a lista", "lists.delete": "Supprime a lista", @@ -340,7 +342,6 @@ "status.reply": "Risponde", "status.replyAll": "Risponde à tutti", "status.report": "Palisà @{name}", - "status.sensitive_toggle": "Cliccate per vede", "status.sensitive_warning": "Cuntinutu sensibile", "status.share": "Sparte", "status.show_less": "Ripiegà", diff --git a/config/locales/co.yml b/config/locales/co.yml index 8c1a13e54b..22ee4b0cee 100644 --- a/config/locales/co.yml +++ b/config/locales/co.yml @@ -81,7 +81,7 @@ co: destroyed_msg: Nota di muderazione sguassata! accounts: approve: Appruvà - approve_all: Appruvà tutti + approve_all: Appruvà tuttu are_you_sure: Site sicuru·a? avatar: Ritrattu di prufile by_domain: Duminiu @@ -877,6 +877,7 @@ co: migrate: Migrazione di u contu notifications: Nutificazione preferences: Priferenze + profile: Prufile relationships: Abbunamenti è abbunati two_factor_authentication: Identificazione à dui fattori statuses: From 062684bcf8b2a80f427024f1f8e9fb421108627e Mon Sep 17 00:00:00 2001 From: Alix Rossi Date: Fri, 10 May 2019 18:09:47 +0200 Subject: [PATCH 3/6] i18n: Update French translations (#10747) * Update French JSON * i18n: Update fr.yml * i18n: Update simple_form.fr.yml * Update simple_form.fr.yml * Update fr.yml --- app/javascript/mastodon/locales/fr.json | 3 ++- config/locales/fr.yml | 6 ++++++ config/locales/simple_form.fr.yml | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/locales/fr.json b/app/javascript/mastodon/locales/fr.json index 58f3ce1476..090f15beaa 100644 --- a/app/javascript/mastodon/locales/fr.json +++ b/app/javascript/mastodon/locales/fr.json @@ -77,6 +77,7 @@ "compose_form.poll.remove_option": "Supprimer ce choix", "compose_form.publish": "Pouet", "compose_form.publish_loud": "{publish} !", + "compose_form.sensitive.hide": "Marquer le média comme sensible", "compose_form.sensitive.marked": "Média marqué comme sensible", "compose_form.sensitive.unmarked": "Média non marqué comme sensible", "compose_form.spoiler.marked": "Le texte est caché derrière un avertissement", @@ -209,6 +210,7 @@ "lightbox.close": "Fermer", "lightbox.next": "Suivant", "lightbox.previous": "Précédent", + "lightbox.view_context": "Voir le contexte", "lists.account.add": "Ajouter à la liste", "lists.account.remove": "Supprimer de la liste", "lists.delete": "Effacer la liste", @@ -340,7 +342,6 @@ "status.reply": "Répondre", "status.replyAll": "Répondre au fil", "status.report": "Signaler @{name}", - "status.sensitive_toggle": "Cliquer pour afficher", "status.sensitive_warning": "Contenu sensible", "status.share": "Partager", "status.show_less": "Replier", diff --git a/config/locales/fr.yml b/config/locales/fr.yml index b969fda083..e76fdf99e7 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -26,6 +26,8 @@ fr: hosted_on: Serveur Mastodon hébergée par %{domain} learn_more: En savoir plus privacy_policy: Politique de vie privée + see_whats_happening: Voir ce qui se passe + server_stats: 'Statistiques du serveur :' source_code: Code source status_count_after: one: Statut @@ -66,6 +68,7 @@ fr: admin: Admin bot: Robot moderator: Modérateur·trice + unavailable: Profil non disponible unfollow: Ne plus suivre admin: account_actions: @@ -77,6 +80,8 @@ fr: delete: Supprimer destroyed_msg: Note de modération supprimée avec succès ! accounts: + approve: Approuver + approve_all: Tout approuver are_you_sure: Êtes-vous certain⋅e ? avatar: Avatar by_domain: Domaine @@ -868,6 +873,7 @@ fr: featured_tags: Hashtags mis en avant identity_proofs: Preuves d’identité import: Import de données + import_and_export: Import et export migrate: Migration de compte notifications: Notifications preferences: Préférences diff --git a/config/locales/simple_form.fr.yml b/config/locales/simple_form.fr.yml index 98c802abb2..1ce97639c2 100644 --- a/config/locales/simple_form.fr.yml +++ b/config/locales/simple_form.fr.yml @@ -128,6 +128,7 @@ fr: follow: Envoyer un courriel lorsque quelqu’un me suit follow_request: Envoyer un courriel lorsque quelqu’un demande à me suivre mention: Envoyer un courriel lorsque quelqu’un me mentionne + pending_account: Envoyer un courriel lorsqu'un nouveau compte est en attente d'approbation reblog: Envoyer un courriel lorsque quelqu’un partage mes statuts report: Envoyer un courriel lorsqu’un nouveau rapport est soumis 'no': Non From d35f558b378da1a0c99ec2b4848ce96c2c86bc90 Mon Sep 17 00:00:00 2001 From: nzws Date: Sat, 11 May 2019 13:46:02 +0900 Subject: [PATCH 4/6] Use local time in audit log (#10751) --- app/views/admin/action_logs/_action_log.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/action_logs/_action_log.html.haml b/app/views/admin/action_logs/_action_log.html.haml index f059814bd6..a545e189ef 100644 --- a/app/views/admin/action_logs/_action_log.html.haml +++ b/app/views/admin/action_logs/_action_log.html.haml @@ -6,7 +6,7 @@ .log-entry__title = t("admin.action_logs.actions.#{action_log.action}_#{action_log.target_type.underscore}", name: content_tag(:span, action_log.account.username, class: 'username'), target: content_tag(:span, log_target(action_log), class: 'target')).html_safe .log-entry__timestamp - %time= l action_log.created_at + %time.formatted{ datetime: action_log.created_at.iso8601 } .spacer .log-entry__icon = fa_icon icon_for_log(action_log) From 2a917031c9bf685842b858c9d4b542743e2b46e8 Mon Sep 17 00:00:00 2001 From: ThibG Date: Sat, 11 May 2019 06:46:43 +0200 Subject: [PATCH 5/6] Add toot source to delete result to ease Delete & Redraft (#10669) * Return Status with raw text in raw_content when deleting a status * Use raw content if available on delete & redraft * Rename raw_content to text; do not serialize formatted content when source is requested --- app/controllers/api/v1/statuses_controller.rb | 2 +- app/javascript/mastodon/actions/statuses.js | 7 ++++--- app/javascript/mastodon/reducers/compose.js | 2 +- app/serializers/rest/status_serializer.rb | 9 ++++++++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb index f9506971a0..b0e134554f 100644 --- a/app/controllers/api/v1/statuses_controller.rb +++ b/app/controllers/api/v1/statuses_controller.rb @@ -65,7 +65,7 @@ class Api::V1::StatusesController < Api::BaseController RemovalWorker.perform_async(@status.id) - render_empty + render json: @status, serializer: REST::StatusSerializer, source_requested: true end private diff --git a/app/javascript/mastodon/actions/statuses.js b/app/javascript/mastodon/actions/statuses.js index 1794538e2b..3916b9ac14 100644 --- a/app/javascript/mastodon/actions/statuses.js +++ b/app/javascript/mastodon/actions/statuses.js @@ -131,10 +131,11 @@ export function fetchStatusFail(id, error, skipLoading) { }; }; -export function redraft(status) { +export function redraft(status, raw_text) { return { type: REDRAFT, status, + raw_text, }; }; @@ -148,13 +149,13 @@ export function deleteStatus(id, router, withRedraft = false) { dispatch(deleteStatusRequest(id)); - api(getState).delete(`/api/v1/statuses/${id}`).then(() => { + api(getState).delete(`/api/v1/statuses/${id}`).then(response => { evictStatus(id); dispatch(deleteStatusSuccess(id)); dispatch(deleteFromTimelines(id)); if (withRedraft) { - dispatch(redraft(status)); + dispatch(redraft(status, response.data.text)); if (!getState().getIn(['compose', 'mounted'])) { router.push('/statuses/new'); diff --git a/app/javascript/mastodon/reducers/compose.js b/app/javascript/mastodon/reducers/compose.js index 39cc5bd817..85cbdfb17e 100644 --- a/app/javascript/mastodon/reducers/compose.js +++ b/app/javascript/mastodon/reducers/compose.js @@ -331,7 +331,7 @@ export default function compose(state = initialState, action) { })); case REDRAFT: return state.withMutations(map => { - map.set('text', unescapeHTML(expandMentions(action.status))); + map.set('text', action.raw_content || unescapeHTML(expandMentions(action.status))); map.set('in_reply_to', action.status.get('in_reply_to_id')); map.set('privacy', action.status.get('visibility')); map.set('media_attachments', action.status.get('media_attachments')); diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb index 106777b6e9..c9b76cb162 100644 --- a/app/serializers/rest/status_serializer.rb +++ b/app/serializers/rest/status_serializer.rb @@ -3,7 +3,7 @@ class REST::StatusSerializer < ActiveModel::Serializer attributes :id, :created_at, :in_reply_to_id, :in_reply_to_account_id, :sensitive, :spoiler_text, :visibility, :language, - :uri, :content, :url, :replies_count, :reblogs_count, + :uri, :url, :replies_count, :reblogs_count, :favourites_count attribute :favourited, if: :current_user? @@ -11,6 +11,9 @@ class REST::StatusSerializer < ActiveModel::Serializer attribute :muted, if: :current_user? attribute :pinned, if: :pinnable? + attribute :content, unless: :source_requested? + attribute :text, if: :source_requested? + belongs_to :reblog, serializer: REST::StatusSerializer belongs_to :application, if: :show_application? belongs_to :account, serializer: REST::AccountSerializer @@ -105,6 +108,10 @@ class REST::StatusSerializer < ActiveModel::Serializer %w(public unlisted).include?(object.visibility) end + def source_requested? + instance_options[:source_requested] + end + def ordered_mentions object.active_mentions.to_a.sort_by(&:id) end From c8195e2da152734a4edd849b36ed39e01ad8bc33 Mon Sep 17 00:00:00 2001 From: ThibG Date: Sat, 11 May 2019 06:46:43 +0200 Subject: [PATCH 6/6] [Glitch] Use raw content if available on Delete & Redraft Port front-end changes from 2a917031c9bf685842b858c9d4b542743e2b46e8 to glitch-soc --- app/javascript/flavours/glitch/actions/statuses.js | 7 ++++--- app/javascript/flavours/glitch/reducers/compose.js | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/javascript/flavours/glitch/actions/statuses.js b/app/javascript/flavours/glitch/actions/statuses.js index 4eabc4be0b..550fe510fc 100644 --- a/app/javascript/flavours/glitch/actions/statuses.js +++ b/app/javascript/flavours/glitch/actions/statuses.js @@ -71,10 +71,11 @@ export function fetchStatusFail(id, error, skipLoading) { }; }; -export function redraft(status) { +export function redraft(status, raw_text) { return { type: REDRAFT, status, + raw_text, }; }; @@ -88,12 +89,12 @@ export function deleteStatus(id, router, withRedraft = false) { dispatch(deleteStatusRequest(id)); - api(getState).delete(`/api/v1/statuses/${id}`).then(() => { + api(getState).delete(`/api/v1/statuses/${id}`).then(response => { dispatch(deleteStatusSuccess(id)); dispatch(deleteFromTimelines(id)); if (withRedraft) { - dispatch(redraft(status)); + dispatch(redraft(status, response.data.text)); if (!getState().getIn(['compose', 'mounted'])) { router.push('/statuses/new'); diff --git a/app/javascript/flavours/glitch/reducers/compose.js b/app/javascript/flavours/glitch/reducers/compose.js index 009e1fee7d..bc1785a480 100644 --- a/app/javascript/flavours/glitch/reducers/compose.js +++ b/app/javascript/flavours/glitch/reducers/compose.js @@ -426,7 +426,7 @@ export default function compose(state = initialState, action) { return state.mergeIn(['doodle'], action.options); case REDRAFT: return state.withMutations(map => { - map.set('text', unescapeHTML(expandMentions(action.status))); + map.set('text', action.raw_text || unescapeHTML(expandMentions(action.status))); map.set('in_reply_to', action.status.get('in_reply_to_id')); map.set('privacy', action.status.get('visibility')); map.set('media_attachments', action.status.get('media_attachments'));