From d93d6f5124d7e120ad1542a65b72792e31f86b22 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 31 Mar 2017 22:44:12 +0200 Subject: [PATCH] Fix reworked search --- .../javascripts/components/actions/search.jsx | 4 ++++ .../features/compose/components/search.jsx | 5 +++-- .../compose/containers/search_container.jsx | 3 ++- .../components/features/compose/index.jsx | 4 ++-- .../features/getting_started/index.jsx | 2 -- .../components/reducers/relationships.jsx | 22 +++++++++---------- app/assets/stylesheets/components.scss | 9 +++++--- app/services/search_service.rb | 4 ++-- 8 files changed, 30 insertions(+), 23 deletions(-) diff --git a/app/assets/javascripts/components/actions/search.jsx b/app/assets/javascripts/components/actions/search.jsx index 9d28ed11ea..df3ae0db1a 100644 --- a/app/assets/javascripts/components/actions/search.jsx +++ b/app/assets/javascripts/components/actions/search.jsx @@ -25,6 +25,10 @@ export function submitSearch() { return (dispatch, getState) => { const value = getState().getIn(['search', 'value']); + if (value.length === 0) { + return; + } + dispatch(fetchSearchRequest()); api(getState).get('/api/v1/search', { diff --git a/app/assets/javascripts/components/features/compose/components/search.jsx b/app/assets/javascripts/components/features/compose/components/search.jsx index 8e86f053e4..936e003f22 100644 --- a/app/assets/javascripts/components/features/compose/components/search.jsx +++ b/app/assets/javascripts/components/features/compose/components/search.jsx @@ -10,6 +10,7 @@ const Search = React.createClass({ propTypes: { value: React.PropTypes.string.isRequired, + submitted: React.PropTypes.bool, onChange: React.PropTypes.func.isRequired, onSubmit: React.PropTypes.func.isRequired, onClear: React.PropTypes.func.isRequired, @@ -40,8 +41,8 @@ const Search = React.createClass({ }, render () { - const { intl, value } = this.props; - const hasValue = value.length > 0; + const { intl, value, submitted } = this.props; + const hasValue = value.length > 0 || submitted; return (
diff --git a/app/assets/javascripts/components/features/compose/containers/search_container.jsx b/app/assets/javascripts/components/features/compose/containers/search_container.jsx index 96709215af..906c0c28c4 100644 --- a/app/assets/javascripts/components/features/compose/containers/search_container.jsx +++ b/app/assets/javascripts/components/features/compose/containers/search_container.jsx @@ -8,7 +8,8 @@ import { import Search from '../components/search'; const mapStateToProps = state => ({ - value: state.getIn(['search', 'value']) + value: state.getIn(['search', 'value']), + submitted: state.getIn(['search', 'submitted']) }); const mapDispatchToProps = dispatch => ({ diff --git a/app/assets/javascripts/components/features/compose/index.jsx b/app/assets/javascripts/components/features/compose/index.jsx index d21e7a9bc1..d4df259dcd 100644 --- a/app/assets/javascripts/components/features/compose/index.jsx +++ b/app/assets/javascripts/components/features/compose/index.jsx @@ -70,9 +70,9 @@ const Compose = React.createClass({
- + {({ x }) => -
+
} diff --git a/app/assets/javascripts/components/features/getting_started/index.jsx b/app/assets/javascripts/components/features/getting_started/index.jsx index 6f9e988ba1..8253ad017b 100644 --- a/app/assets/javascripts/components/features/getting_started/index.jsx +++ b/app/assets/javascripts/components/features/getting_started/index.jsx @@ -43,8 +43,6 @@ const GettingStarted = ({ intl, me }) => {
-

-

tootsuite/mastodon, apps: }} />

diff --git a/app/assets/javascripts/components/reducers/relationships.jsx b/app/assets/javascripts/components/reducers/relationships.jsx index 591f8034be..c65c48b431 100644 --- a/app/assets/javascripts/components/reducers/relationships.jsx +++ b/app/assets/javascripts/components/reducers/relationships.jsx @@ -23,16 +23,16 @@ const initialState = Immutable.Map(); export default function relationships(state = initialState, action) { switch(action.type) { - case ACCOUNT_FOLLOW_SUCCESS: - case ACCOUNT_UNFOLLOW_SUCCESS: - case ACCOUNT_BLOCK_SUCCESS: - case ACCOUNT_UNBLOCK_SUCCESS: - case ACCOUNT_MUTE_SUCCESS: - case ACCOUNT_UNMUTE_SUCCESS: - return normalizeRelationship(state, action.relationship); - case RELATIONSHIPS_FETCH_SUCCESS: - return normalizeRelationships(state, action.relationships); - default: - return state; + case ACCOUNT_FOLLOW_SUCCESS: + case ACCOUNT_UNFOLLOW_SUCCESS: + case ACCOUNT_BLOCK_SUCCESS: + case ACCOUNT_UNBLOCK_SUCCESS: + case ACCOUNT_MUTE_SUCCESS: + case ACCOUNT_UNMUTE_SUCCESS: + return normalizeRelationship(state, action.relationship); + case RELATIONSHIPS_FETCH_SUCCESS: + return normalizeRelationships(state, action.relationships); + default: + return state; } }; diff --git a/app/assets/stylesheets/components.scss b/app/assets/stylesheets/components.scss index 9c138e4958..d7589d9b01 100644 --- a/app/assets/stylesheets/components.scss +++ b/app/assets/stylesheets/components.scss @@ -1120,9 +1120,8 @@ a.status__content__spoiler-link { box-sizing: border-box; overflow-y: auto; padding-bottom: 235px; - background: image-url('mastodon-getting-started.png') no-repeat bottom left; - height: auto; - min-height: 100%; + background: image-url('mastodon-getting-started.png') no-repeat 0 100% local; + height: 100%; p { color: $color2; @@ -1793,6 +1792,10 @@ button.active i.fa-retweet { &.active { transform: translateZ(0) rotate(90deg); } + + &:hover { + color: $color5; + } } } diff --git a/app/services/search_service.rb b/app/services/search_service.rb index 159c037137..e9745010b0 100644 --- a/app/services/search_service.rb +++ b/app/services/search_service.rb @@ -2,10 +2,10 @@ class SearchService < BaseService def call(query, limit, resolve = false, account = nil) - return if query.blank? - results = { accounts: [], hashtags: [], statuses: [] } + return results if query.blank? + if query =~ /\Ahttps?:\/\// resource = FetchRemoteResourceService.new.call(query)