about summary refs log tree commit diff
path: root/app/assets/javascripts/components/features/compose
diff options
context:
space:
mode:
authorEugen <eugen@zeonfederated.com>2017-04-23 04:39:50 +0200
committerGitHub <noreply@github.com>2017-04-23 04:39:50 +0200
commit59b1de0bcf39473106e5380c129d7436be1ad89a (patch)
tree348ac6a815dafa69baea150c2e69be3274fbdc3f /app/assets/javascripts/components/features/compose
parentdf46864b39b0ba26aedb65d2984b9be08ff5e35a (diff)
Add a confirmation modal: (#2279)
- Deleting a toot
- Muting, blocking someone
- Clearing notifications

Remove source map generation from development environment, as it is a huge
performance sink hole with little gains
Diffstat (limited to 'app/assets/javascripts/components/features/compose')
-rw-r--r--app/assets/javascripts/components/features/compose/components/search.jsx10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/assets/javascripts/components/features/compose/components/search.jsx b/app/assets/javascripts/components/features/compose/components/search.jsx
index 7b025341b..f62248a33 100644
--- a/app/assets/javascripts/components/features/compose/components/search.jsx
+++ b/app/assets/javascripts/components/features/compose/components/search.jsx
@@ -13,6 +13,7 @@ class Search extends React.PureComponent {
     this.handleChange = this.handleChange.bind(this);
     this.handleKeyDown = this.handleKeyDown.bind(this);
     this.handleFocus = this.handleFocus.bind(this);
+    this.handleClear = this.handleClear.bind(this);
   }
 
   handleChange (e) {
@@ -21,7 +22,10 @@ class Search extends React.PureComponent {
 
   handleClear (e) {
     e.preventDefault();
-    this.props.onClear();
+
+    if (this.props.value.length > 0 || this.props.submitted) {
+      this.props.onClear();
+    }
   }
 
   handleKeyDown (e) {
@@ -55,9 +59,9 @@ class Search extends React.PureComponent {
           onFocus={this.handleFocus}
         />
 
-        <div role='button' tabIndex='0' className='search__icon' onClick={hasValue ? this.handleClear : this.noop}>
+        <div role='button' tabIndex='0' className='search__icon' onClick={this.handleClear}>
           <i className={`fa fa-search ${hasValue ? '' : 'active'}`} />
-          <i aria-label="Clear search" className={`fa fa-times-circle ${hasValue ? 'active' : ''}`} />
+          <i aria-label={intl.formatMessage(messages.placeholder)} className={`fa fa-times-circle ${hasValue ? 'active' : ''}`} />
         </div>
       </div>
     );