Skip to content
Snippets Groups Projects
Commit 6cdcac13 authored by Eugen Rochko's avatar Eugen Rochko
Browse files

Fix #598 - arrow keys to navigate media; fix #481 - non-exact matches no longer

overshadow requirement for remote-lookup
parent 44fad016
No related branches found
No related tags found
No related merge requests found
...@@ -44,7 +44,7 @@ const Lightbox = React.createClass({ ...@@ -44,7 +44,7 @@ const Lightbox = React.createClass({
componentDidMount () { componentDidMount () {
this._listener = e => { this._listener = e => {
if (e.key === 'Escape') { if (this.props.isVisible && e.key === 'Escape') {
this.props.onCloseClicked(); this.props.onCloseClicked();
} }
}; };
......
...@@ -104,6 +104,29 @@ const Modal = React.createClass({ ...@@ -104,6 +104,29 @@ const Modal = React.createClass({
this.props.onPrevClicked(); this.props.onPrevClicked();
}, },
componentDidMount () {
this._listener = e => {
if (!this.props.isVisible) {
return;
}
switch(e.key) {
case 'ArrowLeft':
this.props.onPrevClicked();
break;
case 'ArrowRight':
this.props.onNextClicked();
break;
}
};
window.addEventListener('keyup', this._listener);
},
componentDidUnmount () {
window.removeEventListener('keyup', this._listener);
},
render () { render () {
const { media, index, ...other } = this.props; const { media, index, ...other } = this.props;
......
...@@ -17,7 +17,7 @@ class SearchService < BaseService ...@@ -17,7 +17,7 @@ class SearchService < BaseService
results = results.limit(limit).to_a results = results.limit(limit).to_a
results = [exact_match] + results.reject { |a| a.id == exact_match.id } if exact_match results = [exact_match] + results.reject { |a| a.id == exact_match.id } if exact_match
if resolve && results.empty? && !domain.nil? if resolve && !exact_match && !domain.nil?
results = [FollowRemoteAccountService.new.call("#{username}@#{domain}")] results = [FollowRemoteAccountService.new.call("#{username}@#{domain}")]
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment