mirror of https://github.com/mastodon/mastodon
Fix full-text search query quotation, improve tag search performance with an index,
add ability to open status by URL from search (fix #53)pull/676/head
parent
c89ccbab09
commit
5aa3df017b
@ -1,11 +1,16 @@
|
||||
import Avatar from '../../../components/avatar';
|
||||
import DisplayName from '../../../components/display_name';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
|
||||
const AutosuggestAccount = ({ account }) => (
|
||||
<div style={{ overflow: 'hidden' }}>
|
||||
<div style={{ overflow: 'hidden' }} className='autosuggest-account'>
|
||||
<div style={{ float: 'left', marginRight: '5px' }}><Avatar src={account.get('avatar')} size={18} /></div>
|
||||
<DisplayName account={account} />
|
||||
</div>
|
||||
);
|
||||
|
||||
AutosuggestAccount.propTypes = {
|
||||
account: ImmutablePropTypes.map.isRequired
|
||||
};
|
||||
|
||||
export default AutosuggestAccount;
|
||||
|
@ -0,0 +1,15 @@
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import DisplayName from '../../../components/display_name';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
|
||||
const AutosuggestStatus = ({ status }) => (
|
||||
<div style={{ overflow: 'hidden' }} className='autosuggest-status'>
|
||||
<FormattedMessage id='search.status_by' defaultMessage='Status by {name}' values={{ name: <strong>@{status.getIn(['account', 'acct'])}</strong> }} />
|
||||
</div>
|
||||
);
|
||||
|
||||
AutosuggestStatus.propTypes = {
|
||||
status: ImmutablePropTypes.map.isRequired
|
||||
};
|
||||
|
||||
export default AutosuggestStatus;
|
@ -0,0 +1,15 @@
|
||||
import { connect } from 'react-redux';
|
||||
import AutosuggestStatus from '../components/autosuggest_status';
|
||||
import { makeGetStatus } from '../../../selectors';
|
||||
|
||||
const makeMapStateToProps = () => {
|
||||
const getStatus = makeGetStatus();
|
||||
|
||||
const mapStateToProps = (state, { id }) => ({
|
||||
status: getStatus(state, id)
|
||||
});
|
||||
|
||||
return mapStateToProps;
|
||||
};
|
||||
|
||||
export default connect(makeMapStateToProps)(AutosuggestStatus);
|
@ -0,0 +1,9 @@
|
||||
class AddSearchIndexToTags < ActiveRecord::Migration[5.0]
|
||||
def up
|
||||
execute 'CREATE INDEX hashtag_search_index ON tags USING gin(to_tsvector(\'simple\', tags.name));'
|
||||
end
|
||||
|
||||
def down
|
||||
remove_index :tags, name: :hashtag_search_index
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue