You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

182 lines
5.0 KiB

Optional notification muting (#5087) * Add a hide_notifications column to mutes * Add muting_notifications? and a notifications argument to mute! * block notifications in notify_service from hard muted accounts * Add specs for how mute! interacts with muting_notifications? * specs testing that hide_notifications in mutes actually hides notifications * Add support for muting notifications in MuteService * API support for muting notifications (and specs) * Less gross passing of notifications flag * Break out a separate mute modal with a hide-notifications checkbox. * Convert profile header mute to use mute modal * Satisfy eslint. * specs for MuteService notifications params * add trailing newlines to files for Pork :) * Put the label for the hide notifications checkbox in a label element. * Add a /api/v1/mutes/details route that just returns the array of mutes. * Define a serializer for /api/v1/mutes/details * Add more specs for the /api/v1/mutes/details endpoint * Expose whether a mute hides notifications in the api/v1/relationships endpoint * Show whether muted users' notifications are muted in account lists * Allow modifying the hide_notifications of a mute with the /api/v1/accounts/:id/mute endpoint * make the hide/unhide notifications buttons work * satisfy eslint * In probably dead code, replace a dispatch of muteAccount that was skipping the modal with launching the mute modal. * fix a missing import * add an explanatory comment to AccountInteractions * Refactor handling of default params for muting to make code cleaner * minor code style fixes oops * Fixed a typo that was breaking the account mute API endpoint * Apply white-space: nowrap to account relationships icons * Fix code style issues * Remove superfluous blank line * Rename /api/v1/mutes/details -> /api/v2/mutes * Don't serialize "account" in MuteSerializer Doing so is somewhat unnecessary since it's always the current user's account. * Fix wrong variable name in api/v2/mutes * Use Toggle in place of checkbox in the mute modal. * Make the Toggle in the mute modal look better * Code style changes in specs and removed an extra space * Code review suggestions from akihikodaki Also fixed a syntax error in tests for AccountInteractions. * Make AddHideNotificationsToMute Concurrent It's not clear how much this will benefit instances in practice, as the number of mutes tends to be pretty small, but this should prevent any blocking migrations nonetheless. * Fix up migration things * Remove /api/v2/mutes
6 years ago
Weblate translations (2018-08-25) (#8420) * Translated using Weblate (Georgian) Currently translated at 99.8% (674 of 675 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/ka/ * Translated using Weblate (Korean) Currently translated at 100.0% (310 of 310 strings) Translation: Mastodon/React Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/frontend/ko/ * Translated using Weblate (Korean) Currently translated at 96.8% (654 of 675 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/ko/ * Translated using Weblate (Japanese) Currently translated at 100.0% (310 of 310 strings) Translation: Mastodon/React Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/frontend/ja/ * Translated using Weblate (Danish) Currently translated at 100.0% (98 of 98 strings) Translation: Mastodon/Doorkeeper Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/doorkeeper/da/ * Translated using Weblate (Danish) Currently translated at 100.0% (310 of 310 strings) Translation: Mastodon/React Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/frontend/da/ * Translated using Weblate (Danish) Currently translated at 87.2% (589 of 675 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/da/ * Translated using Weblate (Galician) Currently translated at 100.0% (680 of 680 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/gl/ * Translated using Weblate (Czech) Currently translated at 100.0% (310 of 310 strings) Translation: Mastodon/React Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/frontend/cs/ * Translated using Weblate (Czech) Currently translated at 99.4% (676 of 680 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/cs/ * Translated using Weblate (Danish) Currently translated at 88.0% (599 of 680 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/da/ * Translated using Weblate (Arabic) Currently translated at 97.6% (664 of 680 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/ar/ * Translated using Weblate (Japanese) Currently translated at 99.7% (678 of 680 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/ja/ * Translated using Weblate (Occitan) Currently translated at 99.5% (677 of 680 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/oc/ * Translated using Weblate (Arabic) Currently translated at 97.9% (668 of 682 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/ar/ * Translated using Weblate (Persian) Currently translated at 99.7% (680 of 682 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/fa/ * Translated using Weblate (Dutch) Currently translated at 99.8% (681 of 682 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/nl/ * Translated using Weblate (Occitan) Currently translated at 99.8% (681 of 682 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/oc/ * Translated using Weblate (Japanese) Currently translated at 0.0% (0 of 682 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/ja/ * Translated using Weblate (Japanese) Currently translated at 0.1% (1 of 682 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/ja/ * Translated using Weblate (Japanese) Currently translated at 0.1% (676 of 682 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/ja/ * Translated using Weblate (Japanese) Currently translated at 99.8% (681 of 682 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/ja/ * Translated using Weblate (Galician) Currently translated at 100.0% (682 of 682 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/gl/ * Translated using Weblate (Greek) Currently translated at 99.8% (681 of 682 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/el/ * Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (310 of 310 strings) Translation: Mastodon/React Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/frontend/pt_BR/ * Translated using Weblate (Portuguese (Brazil)) Currently translated at 98.8% (674 of 682 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/pt_BR/ * Translated using Weblate (Danish) Currently translated at 89.2% (609 of 682 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/da/ * Translated using Weblate (French) Currently translated at 100.0% (82 of 82 strings) Translation: Mastodon/Preferences Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/simple_form/fr/ * Translated using Weblate (French) Currently translated at 100.0% (310 of 310 strings) Translation: Mastodon/React Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/frontend/fr/ * Translated using Weblate (French) Currently translated at 99.8% (681 of 682 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/fr/ * Translated using Weblate (Japanese) Currently translated at 99.8% (681 of 682 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/ja/ * Translated using Weblate (Japanese) Currently translated at 99.8% (681 of 682 strings) Translation: Mastodon/Backend Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/backend/ja/ * Translated using Weblate (Korean) Currently translated at 100.0% (310 of 310 strings) Translation: Mastodon/React Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/frontend/ko/ * Translated using Weblate (Occitan) Currently translated at 100.0% (310 of 310 strings) Translation: Mastodon/React Translate-URL: https://weblate.joinmastodon.org/projects/mastodon/frontend/oc/ * yarn manage:translations * i18n-tasks normalize && i18n-tasks remove-unused * revert * Add defaultMessage
5 years ago
Optional notification muting (#5087) * Add a hide_notifications column to mutes * Add muting_notifications? and a notifications argument to mute! * block notifications in notify_service from hard muted accounts * Add specs for how mute! interacts with muting_notifications? * specs testing that hide_notifications in mutes actually hides notifications * Add support for muting notifications in MuteService * API support for muting notifications (and specs) * Less gross passing of notifications flag * Break out a separate mute modal with a hide-notifications checkbox. * Convert profile header mute to use mute modal * Satisfy eslint. * specs for MuteService notifications params * add trailing newlines to files for Pork :) * Put the label for the hide notifications checkbox in a label element. * Add a /api/v1/mutes/details route that just returns the array of mutes. * Define a serializer for /api/v1/mutes/details * Add more specs for the /api/v1/mutes/details endpoint * Expose whether a mute hides notifications in the api/v1/relationships endpoint * Show whether muted users' notifications are muted in account lists * Allow modifying the hide_notifications of a mute with the /api/v1/accounts/:id/mute endpoint * make the hide/unhide notifications buttons work * satisfy eslint * In probably dead code, replace a dispatch of muteAccount that was skipping the modal with launching the mute modal. * fix a missing import * add an explanatory comment to AccountInteractions * Refactor handling of default params for muting to make code cleaner * minor code style fixes oops * Fixed a typo that was breaking the account mute API endpoint * Apply white-space: nowrap to account relationships icons * Fix code style issues * Remove superfluous blank line * Rename /api/v1/mutes/details -> /api/v2/mutes * Don't serialize "account" in MuteSerializer Doing so is somewhat unnecessary since it's always the current user's account. * Fix wrong variable name in api/v2/mutes * Use Toggle in place of checkbox in the mute modal. * Make the Toggle in the mute modal look better * Code style changes in specs and removed an extra space * Code review suggestions from akihikodaki Also fixed a syntax error in tests for AccountInteractions. * Make AddHideNotificationsToMute Concurrent It's not clear how much this will benefit instances in practice, as the number of mutes tends to be pretty small, but this should prevent any blocking migrations nonetheless. * Fix up migration things * Remove /api/v2/mutes
6 years ago
  1. import { connect } from 'react-redux';
  2. import Status from '../components/status';
  3. import { makeGetStatus } from '../selectors';
  4. import {
  5. replyCompose,
  6. mentionCompose,
  7. directCompose,
  8. } from '../actions/compose';
  9. import {
  10. reblog,
  11. favourite,
  12. unreblog,
  13. unfavourite,
  14. pin,
  15. unpin,
  16. } from '../actions/interactions';
  17. import {
  18. muteStatus,
  19. unmuteStatus,
  20. deleteStatus,
  21. hideStatus,
  22. revealStatus,
  23. fetchContext,
  24. } from '../actions/statuses';
  25. import { initMuteModal } from '../actions/mutes';
  26. import { initBlockModal } from '../actions/blocks';
  27. import { initReport } from '../actions/reports';
  28. import { openModal } from '../actions/modal';
  29. import { defineMessages, injectIntl } from 'react-intl';
  30. import { boostModal, deleteModal } from '../initial_state';
  31. import { showAlertForError } from '../actions/alerts';
  32. const messages = defineMessages({
  33. deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
  34. deleteMessage: { id: 'confirmations.delete.message', defaultMessage: 'Are you sure you want to delete this status?' },
  35. redraftConfirm: { id: 'confirmations.redraft.confirm', defaultMessage: 'Delete & redraft' },
  36. redraftMessage: { id: 'confirmations.redraft.message', defaultMessage: 'Are you sure you want to delete this status and re-draft it? Favourites and boosts will be lost, and replies to the original post will be orphaned.' },
  37. replyConfirm: { id: 'confirmations.reply.confirm', defaultMessage: 'Reply' },
  38. replyMessage: { id: 'confirmations.reply.message', defaultMessage: 'Replying now will overwrite the message you are currently composing. Are you sure you want to proceed?' },
  39. });
  40. const makeMapStateToProps = () => {
  41. const getStatus = makeGetStatus();
  42. const mapStateToProps = (state, props) => {
  43. const status = getStatus(state, props);
  44. const sons = state.getIn(['contexts', 'replies', status.getIn(['reblog', 'id'], props.id)]);
  45. return ({
  46. 'status': status,
  47. 'sonsIds': (props.showThread && sons) ? sons.map(id => ({
  48. 'id': id,
  49. 'sonsIds' : state.getIn(['contexts', 'replies', id])
  50. }))
  51. :
  52. null,
  53. })
  54. }
  55. return mapStateToProps;
  56. };
  57. const mapDispatchToProps = (dispatch, { intl }) => ({
  58. onReply (status, router) {
  59. dispatch((_, getState) => {
  60. let state = getState();
  61. if (state.getIn(['compose', 'text']).trim().length !== 0) {
  62. dispatch(openModal('CONFIRM', {
  63. message: intl.formatMessage(messages.replyMessage),
  64. confirm: intl.formatMessage(messages.replyConfirm),
  65. onConfirm: () => dispatch(replyCompose(status, router)),
  66. }));
  67. } else {
  68. dispatch(replyCompose(status, router));
  69. }
  70. });
  71. },
  72. onModalReblog (status) {
  73. if (status.get('reblogged')) {
  74. dispatch(unreblog(status));
  75. } else {
  76. dispatch(reblog(status));
  77. }
  78. },
  79. onReblog (status, e) {
  80. if ((e && e.shiftKey) || !boostModal) {
  81. this.onModalReblog(status);
  82. } else {
  83. dispatch(openModal('BOOST', { status, onReblog: this.onModalReblog }));
  84. }
  85. },
  86. onFavourite (status) {
  87. if (status.get('favourited')) {
  88. dispatch(unfavourite(status));
  89. } else {
  90. dispatch(favourite(status));
  91. }
  92. },
  93. onPin (status) {
  94. if (status.get('pinned')) {
  95. dispatch(unpin(status));
  96. } else {
  97. dispatch(pin(status));
  98. }
  99. },
  100. onEmbed (status) {
  101. dispatch(openModal('EMBED', {
  102. url: status.get('url'),
  103. onError: error => dispatch(showAlertForError(error)),
  104. }));
  105. },
  106. onDelete (status, history, withRedraft = false) {
  107. if (!deleteModal) {
  108. dispatch(deleteStatus(status.get('id'), history, withRedraft));
  109. } else {
  110. dispatch(openModal('CONFIRM', {
  111. message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage),
  112. confirm: intl.formatMessage(withRedraft ? messages.redraftConfirm : messages.deleteConfirm),
  113. onConfirm: () => dispatch(deleteStatus(status.get('id'), history, withRedraft)),
  114. }));
  115. }
  116. },
  117. onDirect (account, router) {
  118. dispatch(directCompose(account, router));
  119. },
  120. onMention (account, router) {
  121. dispatch(mentionCompose(account, router));
  122. },
  123. onOpenMedia (media, index) {
  124. dispatch(openModal('MEDIA', { media, index }));
  125. },
  126. onOpenVideo (media, time) {
  127. dispatch(openModal('VIDEO', { media, time }));
  128. },
  129. onBlock (status) {
  130. const account = status.get('account');
  131. dispatch(initBlockModal(account));
  132. },
  133. onReport (status) {
  134. dispatch(initReport(status.get('account'), status));
  135. },
  136. onMute (account) {
  137. dispatch(initMuteModal(account));
  138. },
  139. onMuteConversation (status) {
  140. if (status.get('muted')) {
  141. dispatch(unmuteStatus(status.get('id')));
  142. } else {
  143. dispatch(muteStatus(status.get('id')));
  144. }
  145. },
  146. onToggleHidden (status) {
  147. if (status.get('hidden')) {
  148. dispatch(revealStatus(status.get('id')));
  149. } else {
  150. dispatch(hideStatus(status.get('id')));
  151. }
  152. },
  153. onPreview (id) {
  154. dispatch(fetchContext(id));
  155. },
  156. });
  157. export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Status));