about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/compose/containers/poll_form_container.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-05-09 22:10:27 +0200
committerEugen Rochko <eugen@zeonfederated.com>2019-05-09 22:10:27 +0200
commitf2be71c2931e0d0b8f1ec05f50bd7d791c420c91 (patch)
tree3447ff40943f7d63bd691eae065f8a2a75c6b020 /app/javascript/mastodon/features/compose/containers/poll_form_container.js
parent62f5235b6f906a3336292a1a3afa222084de9a97 (diff)
Add emoji suggestions to CW and poll option fields (#10555)
* Refactor selectComposeSuggestion so that different paths can be updated

* Add suggestions in CW field

* Add emoji suggestion to poll options

* Attempt to fix CSS

* Hide suggestions by default

They will be enabled if the input has focus
Diffstat (limited to 'app/javascript/mastodon/features/compose/containers/poll_form_container.js')
-rw-r--r--app/javascript/mastodon/features/compose/containers/poll_form_container.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/javascript/mastodon/features/compose/containers/poll_form_container.js b/app/javascript/mastodon/features/compose/containers/poll_form_container.js
index da795a291..1401371d0 100644
--- a/app/javascript/mastodon/features/compose/containers/poll_form_container.js
+++ b/app/javascript/mastodon/features/compose/containers/poll_form_container.js
@@ -1,8 +1,14 @@
 import { connect } from 'react-redux';
 import PollForm from '../components/poll_form';
 import { addPollOption, removePollOption, changePollOption, changePollSettings } from '../../../actions/compose';
+import {
+  clearComposeSuggestions,
+  fetchComposeSuggestions,
+  selectComposeSuggestion,
+} from '../../../actions/compose';
 
 const mapStateToProps = state => ({
+  suggestions: state.getIn(['compose', 'suggestions']),
   options: state.getIn(['compose', 'poll', 'options']),
   expiresIn: state.getIn(['compose', 'poll', 'expires_in']),
   isMultiple: state.getIn(['compose', 'poll', 'multiple']),
@@ -24,6 +30,19 @@ const mapDispatchToProps = dispatch => ({
   onChangeSettings(expiresIn, isMultiple) {
     dispatch(changePollSettings(expiresIn, isMultiple));
   },
+
+  onClearSuggestions () {
+    dispatch(clearComposeSuggestions());
+  },
+
+  onFetchSuggestions (token) {
+    dispatch(fetchComposeSuggestions(token));
+  },
+
+  onSuggestionSelected (position, token, accountId, path) {
+    dispatch(selectComposeSuggestion(position, token, accountId, path));
+  },
+
 });
 
 export default connect(mapStateToProps, mapDispatchToProps)(PollForm);