Merge branch 'feature/search_updates_groups' of https://code.gab.com/gab/social/gab-social into develop
This commit is contained in:
commit
adde863246
@ -1,7 +1,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Api::V1::SearchController < Api::BaseController
|
class Api::V1::SearchController < Api::BaseController
|
||||||
RESULTS_LIMIT = 20
|
RESULTS_LIMIT = 100
|
||||||
|
|
||||||
respond_to :json
|
respond_to :json
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@ export function submitSearch() {
|
|||||||
params: {
|
params: {
|
||||||
q: value,
|
q: value,
|
||||||
resolve: true,
|
resolve: true,
|
||||||
limit: 5,
|
|
||||||
},
|
},
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
if (response.data.accounts) {
|
if (response.data.accounts) {
|
||||||
|
40
app/javascript/gabsocial/components/group_list_item.js
Normal file
40
app/javascript/gabsocial/components/group_list_item.js
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
|
import { defineMessages, injectIntl } from 'react-intl';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
import { shortNumberFormat } from '../utils/numbers';
|
||||||
|
|
||||||
|
const messages = defineMessages({
|
||||||
|
members: { id: 'groups.card.members', defaultMessage: 'Members' },
|
||||||
|
});
|
||||||
|
|
||||||
|
export default
|
||||||
|
@injectIntl
|
||||||
|
class GroupListItem extends ImmutablePureComponent {
|
||||||
|
static propTypes = {
|
||||||
|
group: ImmutablePropTypes.map.isRequired,
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { intl, group } = this.props;
|
||||||
|
|
||||||
|
if (!group) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='trends__item'>
|
||||||
|
<div className='trends__item__name'>
|
||||||
|
<Link to={`/groups/${group.get('id')}`}>
|
||||||
|
<strong>{group.get('title')}</strong>
|
||||||
|
<br />
|
||||||
|
<span>
|
||||||
|
{shortNumberFormat(group.get('member_count'))}
|
||||||
|
|
||||||
|
{intl.formatMessage(messages.members)}
|
||||||
|
</span>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -9,10 +9,10 @@ const Hashtag = ({ hashtag }) => (
|
|||||||
<div className='trends__item'>
|
<div className='trends__item'>
|
||||||
<div className='trends__item__name'>
|
<div className='trends__item__name'>
|
||||||
<Permalink href={hashtag.get('url')} to={`/tags/${hashtag.get('name')}`}>
|
<Permalink href={hashtag.get('url')} to={`/tags/${hashtag.get('name')}`}>
|
||||||
#<span>{hashtag.get('name')}</span>
|
<strong>#{hashtag.get('name')}</strong>
|
||||||
</Permalink>
|
</Permalink>
|
||||||
|
|
||||||
<FormattedMessage id='trends.count_by_accounts' defaultMessage='{count} {rawCount, plural, one {person} other {people}} talking' values={{ rawCount: hashtag.getIn(['history', 0, 'accounts']), count: <strong>{shortNumberFormat(hashtag.getIn(['history', 0, 'accounts']))}</strong> }} />
|
<FormattedMessage id='trends.count_by_accounts' defaultMessage='{count} {rawCount, plural, one {person} other {people}} talking' values={{ rawCount: hashtag.getIn(['history', 0, 'accounts']), count: <span>{shortNumberFormat(hashtag.getIn(['history', 0, 'accounts']))}</span> }} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='trends__item__current'>
|
<div className='trends__item__current'>
|
||||||
|
@ -19,7 +19,7 @@ class SearchPopout extends React.PureComponent {
|
|||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { style } = this.props;
|
const { style } = this.props;
|
||||||
const extraInformation = searchEnabled ? <FormattedMessage id='search_popout.tips.full_text' defaultMessage='Simple text returns statuses you have written, favorited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.' /> : <FormattedMessage id='search_popout.tips.text' defaultMessage='Simple text returns matching display names, usernames and hashtags' />;
|
const extraInformation = searchEnabled ? <FormattedMessage id='search_popout.tips.full_text' defaultMessage='Simple text returns statuses you have written, favorited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.' /> : <FormattedMessage id='search_popout.tips.text' defaultMessage='Simple text returns matching display names, usernames, groups and hashtags' />;
|
||||||
return (
|
return (
|
||||||
<div className='search-popout-container' style={{ ...style, position: 'absolute', zIndex: 1000 }}>
|
<div className='search-popout-container' style={{ ...style, position: 'absolute', zIndex: 1000 }}>
|
||||||
<Motion defaultStyle={{ opacity: 0, scaleX: 1, scaleY: 1 }} style={{ opacity: spring(1, { damping: 35, stiffness: 400 }), scaleX: spring(1, { damping: 35, stiffness: 400 }), scaleY: spring(1, { damping: 35, stiffness: 400 }) }}>
|
<Motion defaultStyle={{ opacity: 0, scaleX: 1, scaleY: 1 }} style={{ opacity: spring(1, { damping: 35, stiffness: 400 }), scaleX: spring(1, { damping: 35, stiffness: 400 }), scaleY: spring(1, { damping: 35, stiffness: 400 }) }}>
|
||||||
|
@ -9,13 +9,16 @@ import Hashtag from '../../../components/hashtag';
|
|||||||
import Icon from 'gabsocial/components/icon';
|
import Icon from 'gabsocial/components/icon';
|
||||||
import WhoToFollowPanel from '../../ui/components/who_to_follow_panel';
|
import WhoToFollowPanel from '../../ui/components/who_to_follow_panel';
|
||||||
// import TrendsPanel from '../../ui/components/trends_panel';
|
// import TrendsPanel from '../../ui/components/trends_panel';
|
||||||
|
import GroupListItem from 'gabsocial/components/group_list_item';
|
||||||
|
|
||||||
export default @injectIntl
|
export default
|
||||||
|
@injectIntl
|
||||||
class SearchResults extends ImmutablePureComponent {
|
class SearchResults extends ImmutablePureComponent {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
results: ImmutablePropTypes.map.isRequired,
|
results: ImmutablePropTypes.map.isRequired,
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
|
location: PropTypes.object,
|
||||||
};
|
};
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
@ -23,7 +26,7 @@ class SearchResults extends ImmutablePureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { intl, results, dismissSuggestion } = this.props;
|
const { results, location } = this.props;
|
||||||
const { isSmallScreen } = this.state;
|
const { isSmallScreen } = this.state;
|
||||||
|
|
||||||
if (results.isEmpty() && isSmallScreen) {
|
if (results.isEmpty() && isSmallScreen) {
|
||||||
@ -35,38 +38,44 @@ class SearchResults extends ImmutablePureComponent {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let accounts, statuses, hashtags;
|
const pathname = location.pathname || '';
|
||||||
|
const showPeople = pathname === '/search/people';
|
||||||
|
const showHashtags = pathname === '/search/hashtags';
|
||||||
|
const showGroups = pathname === '/search/groups';
|
||||||
|
const isTop = !showPeople && !showHashtags && !showGroups;
|
||||||
|
|
||||||
|
let accounts, statuses, hashtags, groups;
|
||||||
let count = 0;
|
let count = 0;
|
||||||
|
|
||||||
if (results.get('accounts') && results.get('accounts').size > 0) {
|
if (results.get('accounts') && results.get('accounts').size > 0 && (isTop || showPeople)) {
|
||||||
count += results.get('accounts').size;
|
const size = isTop ? Math.min(results.get('accounts').size, 5) : results.get('accounts').size;
|
||||||
|
count += size;
|
||||||
accounts = (
|
accounts = (
|
||||||
<div className='search-results__section'>
|
<div className='search-results__section'>
|
||||||
<h5><Icon id='users' fixedWidth /><FormattedMessage id='search_results.accounts' defaultMessage='People' /></h5>
|
<h5><Icon id='user' fixedWidth /><FormattedMessage id='search_results.accounts' defaultMessage='People' /></h5>
|
||||||
|
{results.get('accounts').slice(0, size).map(accountId => <AccountContainer key={accountId} id={accountId} />)}
|
||||||
{results.get('accounts').map(accountId => <AccountContainer key={accountId} id={accountId} />)}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (results.get('statuses') && results.get('statuses').size > 0) {
|
if (results.get('groups') && results.get('groups').size > 0 && (isTop || showGroups)) {
|
||||||
count += results.get('statuses').size;
|
const size = isTop ? Math.min(results.get('groups').size, 5) : results.get('groups').size;
|
||||||
statuses = (
|
count += size;
|
||||||
|
groups = (
|
||||||
<div className='search-results__section'>
|
<div className='search-results__section'>
|
||||||
<h5><Icon id='quote-right' fixedWidth /><FormattedMessage id='search_results.statuses' defaultMessage='Gabs' /></h5>
|
<h5><Icon id='users' fixedWidth /><FormattedMessage id='search_results.groups' defaultMessage='Groups' /></h5>
|
||||||
|
{results.get('groups').slice(0, size).map(group => <GroupListItem key={`search-${group.get('name')}`} group={group} />)}
|
||||||
{results.get('statuses').map(statusId => <StatusContainer key={statusId} id={statusId} />)}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (results.get('hashtags') && results.get('hashtags').size > 0) {
|
if (results.get('hashtags') && results.get('hashtags').size > 0 && (isTop || showHashtags)) {
|
||||||
count += results.get('hashtags').size;
|
const size = isTop ? Math.min(results.get('hashtags').size, 5) : results.get('hashtags').size;
|
||||||
|
count += size;
|
||||||
hashtags = (
|
hashtags = (
|
||||||
<div className='search-results__section'>
|
<div className='search-results__section'>
|
||||||
<h5><Icon id='hashtag' fixedWidth /><FormattedMessage id='search_results.hashtags' defaultMessage='Hashtags' /></h5>
|
<h5><Icon id='hashtag' fixedWidth /><FormattedMessage id='search_results.hashtags' defaultMessage='Hashtags' /></h5>
|
||||||
|
{results.get('hashtags').slice(0, size).map(hashtag => <Hashtag key={hashtag.get('name')} hashtag={hashtag} />)}
|
||||||
{results.get('hashtags').map(hashtag => <Hashtag key={hashtag.get('name')} hashtag={hashtag} />)}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -79,6 +88,7 @@ class SearchResults extends ImmutablePureComponent {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{accounts}
|
{accounts}
|
||||||
|
{groups}
|
||||||
{statuses}
|
{statuses}
|
||||||
{hashtags}
|
{hashtags}
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import SearchResults from '../components/search_results';
|
import SearchResults from '../components/search_results';
|
||||||
import { fetchSuggestions, dismissSuggestion } from '../../../actions/suggestions';
|
import { fetchSuggestions, dismissSuggestion } from '../../../actions/suggestions';
|
||||||
|
import { withRouter } from 'react-router-dom';
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
results: state.getIn(['search', 'results']),
|
results: state.getIn(['search', 'results']),
|
||||||
@ -12,4 +13,4 @@ const mapDispatchToProps = dispatch => ({
|
|||||||
dismissSuggestion: account => dispatch(dismissSuggestion(account.get('id'))),
|
dismissSuggestion: account => dispatch(dismissSuggestion(account.get('id'))),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(SearchResults);
|
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(SearchResults));
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import { withRouter } from 'react-router-dom';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import { NavLink } from 'react-router-dom';
|
import { NavLink } from 'react-router-dom';
|
||||||
|
|
||||||
@ -11,7 +10,10 @@ const mapStateToProps = state => ({
|
|||||||
submitted: state.getIn(['search', 'submitted']),
|
submitted: state.getIn(['search', 'submitted']),
|
||||||
});
|
});
|
||||||
|
|
||||||
class Header extends ImmutablePureComponent {
|
export default
|
||||||
|
@withRouter
|
||||||
|
@connect(mapStateToProps)
|
||||||
|
class Header extends React.PureComponent {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
value: PropTypes.string,
|
value: PropTypes.string,
|
||||||
@ -32,10 +34,6 @@ class Header extends ImmutablePureComponent {
|
|||||||
render () {
|
render () {
|
||||||
const { submittedValue } = this.state;
|
const { submittedValue } = this.state;
|
||||||
|
|
||||||
if (!submittedValue) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='search-header'>
|
<div className='search-header'>
|
||||||
<div className='search-header__text-container'>
|
<div className='search-header__text-container'>
|
||||||
@ -46,21 +44,18 @@ class Header extends ImmutablePureComponent {
|
|||||||
<div className='search-header__type-filters'>
|
<div className='search-header__type-filters'>
|
||||||
<div className='account__section-headline'>
|
<div className='account__section-headline'>
|
||||||
<div className='search-header__type-filters-tabs'>
|
<div className='search-header__type-filters-tabs'>
|
||||||
<NavLink to='/search' activeClassName='active'>
|
<NavLink to='/search' exact activeClassName='active'>
|
||||||
<FormattedMessage id='search_results.top' defaultMessage='Top' />
|
<FormattedMessage id='search_results.top' defaultMessage='Top' />
|
||||||
</NavLink>
|
</NavLink>
|
||||||
{/*<NavLink to='/search/gabs' activeClassName='active'>
|
<NavLink to='/search/people' exact activeClassName='active'>
|
||||||
<FormattedMessage id='search_results.statuses' defaultMessage='Gabs' />
|
|
||||||
</NavLink>
|
|
||||||
<NavLink to='/search/people' activeClassName='active'>
|
|
||||||
<FormattedMessage id='search_results.accounts' defaultMessage='People' />
|
<FormattedMessage id='search_results.accounts' defaultMessage='People' />
|
||||||
</NavLink>
|
</NavLink>
|
||||||
<NavLink to='/search/hashtags' activeClassName='active'>
|
<NavLink to='/search/hashtags' exact activeClassName='active'>
|
||||||
<FormattedMessage id='search_results.hashtags' defaultMessage='Hashtags' />
|
<FormattedMessage id='search_results.hashtags' defaultMessage='Hashtags' />
|
||||||
</NavLink>
|
</NavLink>
|
||||||
<NavLink to='/search/groups' activeClassName='active'>
|
<NavLink to='/search/groups' exact activeClassName='active'>
|
||||||
<FormattedMessage id='search_results.groups' defaultMessage='Groups' />
|
<FormattedMessage id='search_results.groups' defaultMessage='Groups' />
|
||||||
</NavLink>*/}
|
</NavLink>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -68,5 +63,3 @@ class Header extends ImmutablePureComponent {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(mapStateToProps)(Header);
|
|
||||||
|
@ -202,7 +202,10 @@ class SwitchingColumnsArea extends React.PureComponent {
|
|||||||
|
|
||||||
<WrappedRoute path='/notifications' layout={LAYOUT.DEFAULT} component={Notifications} content={children} />
|
<WrappedRoute path='/notifications' layout={LAYOUT.DEFAULT} component={Notifications} content={children} />
|
||||||
|
|
||||||
<WrappedRoute path='/search' publicRoute page={SearchPage} component={Search} content={children} />
|
<WrappedRoute path='/search' exact publicRoute page={SearchPage} component={Search} content={children} />
|
||||||
|
<WrappedRoute path='/search/people' exact page={SearchPage} component={Search} content={children} />
|
||||||
|
<WrappedRoute path='/search/hashtags' exact page={SearchPage} component={Search} content={children} />
|
||||||
|
<WrappedRoute path='/search/groups' exact page={SearchPage} component={Search} content={children} />
|
||||||
|
|
||||||
<WrappedRoute path='/follow_requests' layout={LAYOUT.DEFAULT} component={FollowRequests} content={children} />
|
<WrappedRoute path='/follow_requests' layout={LAYOUT.DEFAULT} component={FollowRequests} content={children} />
|
||||||
<WrappedRoute path='/blocks' layout={LAYOUT.DEFAULT} component={Blocks} content={children} />
|
<WrappedRoute path='/blocks' layout={LAYOUT.DEFAULT} component={Blocks} content={children} />
|
||||||
|
@ -307,7 +307,7 @@
|
|||||||
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
||||||
"search_popout.tips.hashtag": "etiqueta",
|
"search_popout.tips.hashtag": "etiqueta",
|
||||||
"search_popout.tips.status": "estáu",
|
"search_popout.tips.status": "estáu",
|
||||||
"search_popout.tips.text": "Simple text returns matching display names, usernames and hashtags",
|
"search_popout.tips.text": "Simple text returns matching display names, usernames, groups and hashtags",
|
||||||
"search_popout.tips.user": "usuariu",
|
"search_popout.tips.user": "usuariu",
|
||||||
"search_results.accounts": "Xente",
|
"search_results.accounts": "Xente",
|
||||||
"search_results.hashtags": "Etiquetes",
|
"search_results.hashtags": "Etiquetes",
|
||||||
|
@ -307,7 +307,7 @@
|
|||||||
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
||||||
"search_popout.tips.hashtag": "hashtag",
|
"search_popout.tips.hashtag": "hashtag",
|
||||||
"search_popout.tips.status": "status",
|
"search_popout.tips.status": "status",
|
||||||
"search_popout.tips.text": "Simple text returns matching display names, usernames and hashtags",
|
"search_popout.tips.text": "Simple text returns matching display names, usernames, groups and hashtags",
|
||||||
"search_popout.tips.user": "user",
|
"search_popout.tips.user": "user",
|
||||||
"search_results.accounts": "People",
|
"search_results.accounts": "People",
|
||||||
"search_results.hashtags": "Hashtags",
|
"search_results.hashtags": "Hashtags",
|
||||||
|
@ -1026,7 +1026,7 @@
|
|||||||
"id": "search_popout.tips.full_text"
|
"id": "search_popout.tips.full_text"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"defaultMessage": "Simple text returns matching display names, usernames and hashtags",
|
"defaultMessage": "Simple text returns matching display names, usernames, groups and hashtags",
|
||||||
"id": "search_popout.tips.text"
|
"id": "search_popout.tips.text"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -310,7 +310,7 @@
|
|||||||
"search_popout.tips.full_text": "Simple text returns statuses you have written, favorited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
"search_popout.tips.full_text": "Simple text returns statuses you have written, favorited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
||||||
"search_popout.tips.hashtag": "hashtag",
|
"search_popout.tips.hashtag": "hashtag",
|
||||||
"search_popout.tips.status": "status",
|
"search_popout.tips.status": "status",
|
||||||
"search_popout.tips.text": "Simple text returns matching display names, usernames and hashtags",
|
"search_popout.tips.text": "Simple text returns matching display names, usernames, groups and hashtags",
|
||||||
"search_popout.tips.user": "user",
|
"search_popout.tips.user": "user",
|
||||||
"search_results.accounts": "People",
|
"search_results.accounts": "People",
|
||||||
"search_results.hashtags": "Hashtags",
|
"search_results.hashtags": "Hashtags",
|
||||||
|
@ -307,7 +307,7 @@
|
|||||||
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
||||||
"search_popout.tips.hashtag": "hashtag",
|
"search_popout.tips.hashtag": "hashtag",
|
||||||
"search_popout.tips.status": "status",
|
"search_popout.tips.status": "status",
|
||||||
"search_popout.tips.text": "Simple text returns matching display names, usernames and hashtags",
|
"search_popout.tips.text": "Simple text returns matching display names, usernames, groups and hashtags",
|
||||||
"search_popout.tips.user": "user",
|
"search_popout.tips.user": "user",
|
||||||
"search_results.accounts": "People",
|
"search_results.accounts": "People",
|
||||||
"search_results.hashtags": "Hashtags",
|
"search_results.hashtags": "Hashtags",
|
||||||
|
@ -307,7 +307,7 @@
|
|||||||
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
||||||
"search_popout.tips.hashtag": "hashtag",
|
"search_popout.tips.hashtag": "hashtag",
|
||||||
"search_popout.tips.status": "status",
|
"search_popout.tips.status": "status",
|
||||||
"search_popout.tips.text": "Simple text returns matching display names, usernames and hashtags",
|
"search_popout.tips.text": "Simple text returns matching display names, usernames, groups and hashtags",
|
||||||
"search_popout.tips.user": "user",
|
"search_popout.tips.user": "user",
|
||||||
"search_results.accounts": "People",
|
"search_results.accounts": "People",
|
||||||
"search_results.hashtags": "Hashtags",
|
"search_results.hashtags": "Hashtags",
|
||||||
|
@ -307,7 +307,7 @@
|
|||||||
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
||||||
"search_popout.tips.hashtag": "hashtag",
|
"search_popout.tips.hashtag": "hashtag",
|
||||||
"search_popout.tips.status": "status",
|
"search_popout.tips.status": "status",
|
||||||
"search_popout.tips.text": "Simple text returns matching display names, usernames and hashtags",
|
"search_popout.tips.text": "Simple text returns matching display names, usernames, groups and hashtags",
|
||||||
"search_popout.tips.user": "felhasználó",
|
"search_popout.tips.user": "felhasználó",
|
||||||
"search_results.accounts": "People",
|
"search_results.accounts": "People",
|
||||||
"search_results.hashtags": "Hashtags",
|
"search_results.hashtags": "Hashtags",
|
||||||
|
@ -307,7 +307,7 @@
|
|||||||
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
||||||
"search_popout.tips.hashtag": "tagar",
|
"search_popout.tips.hashtag": "tagar",
|
||||||
"search_popout.tips.status": "status",
|
"search_popout.tips.status": "status",
|
||||||
"search_popout.tips.text": "Simple text returns matching display names, usernames and hashtags",
|
"search_popout.tips.text": "Simple text returns matching display names, usernames, groups and hashtags",
|
||||||
"search_popout.tips.user": "user",
|
"search_popout.tips.user": "user",
|
||||||
"search_results.accounts": "People",
|
"search_results.accounts": "People",
|
||||||
"search_results.hashtags": "Hashtags",
|
"search_results.hashtags": "Hashtags",
|
||||||
|
@ -307,7 +307,7 @@
|
|||||||
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
||||||
"search_popout.tips.hashtag": "hashtag",
|
"search_popout.tips.hashtag": "hashtag",
|
||||||
"search_popout.tips.status": "status",
|
"search_popout.tips.status": "status",
|
||||||
"search_popout.tips.text": "Simple text returns matching display names, usernames and hashtags",
|
"search_popout.tips.text": "Simple text returns matching display names, usernames, groups and hashtags",
|
||||||
"search_popout.tips.user": "user",
|
"search_popout.tips.user": "user",
|
||||||
"search_results.accounts": "People",
|
"search_results.accounts": "People",
|
||||||
"search_results.hashtags": "Hashtags",
|
"search_results.hashtags": "Hashtags",
|
||||||
|
@ -307,7 +307,7 @@
|
|||||||
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
||||||
"search_popout.tips.hashtag": "hashtag",
|
"search_popout.tips.hashtag": "hashtag",
|
||||||
"search_popout.tips.status": "status",
|
"search_popout.tips.status": "status",
|
||||||
"search_popout.tips.text": "Simple text returns matching display names, usernames and hashtags",
|
"search_popout.tips.text": "Simple text returns matching display names, usernames, groups and hashtags",
|
||||||
"search_popout.tips.user": "user",
|
"search_popout.tips.user": "user",
|
||||||
"search_results.accounts": "People",
|
"search_results.accounts": "People",
|
||||||
"search_results.hashtags": "Hashtags",
|
"search_results.hashtags": "Hashtags",
|
||||||
|
@ -307,7 +307,7 @@
|
|||||||
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
||||||
"search_popout.tips.hashtag": "hashtag",
|
"search_popout.tips.hashtag": "hashtag",
|
||||||
"search_popout.tips.status": "status",
|
"search_popout.tips.status": "status",
|
||||||
"search_popout.tips.text": "Simple text returns matching display names, usernames and hashtags",
|
"search_popout.tips.text": "Simple text returns matching display names, usernames, groups and hashtags",
|
||||||
"search_popout.tips.user": "user",
|
"search_popout.tips.user": "user",
|
||||||
"search_results.accounts": "People",
|
"search_results.accounts": "People",
|
||||||
"search_results.hashtags": "Hashtags",
|
"search_results.hashtags": "Hashtags",
|
||||||
|
@ -307,7 +307,7 @@
|
|||||||
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
||||||
"search_popout.tips.hashtag": "hashtag",
|
"search_popout.tips.hashtag": "hashtag",
|
||||||
"search_popout.tips.status": "status",
|
"search_popout.tips.status": "status",
|
||||||
"search_popout.tips.text": "Simple text returns matching display names, usernames and hashtags",
|
"search_popout.tips.text": "Simple text returns matching display names, usernames, groups and hashtags",
|
||||||
"search_popout.tips.user": "user",
|
"search_popout.tips.user": "user",
|
||||||
"search_results.accounts": "People",
|
"search_results.accounts": "People",
|
||||||
"search_results.hashtags": "Hashtags",
|
"search_results.hashtags": "Hashtags",
|
||||||
|
@ -307,7 +307,7 @@
|
|||||||
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
||||||
"search_popout.tips.hashtag": "hashtag",
|
"search_popout.tips.hashtag": "hashtag",
|
||||||
"search_popout.tips.status": "status",
|
"search_popout.tips.status": "status",
|
||||||
"search_popout.tips.text": "Simple text returns matching display names, usernames and hashtags",
|
"search_popout.tips.text": "Simple text returns matching display names, usernames, groups and hashtags",
|
||||||
"search_popout.tips.user": "user",
|
"search_popout.tips.user": "user",
|
||||||
"search_results.accounts": "People",
|
"search_results.accounts": "People",
|
||||||
"search_results.hashtags": "Hashtags",
|
"search_results.hashtags": "Hashtags",
|
||||||
|
@ -307,7 +307,7 @@
|
|||||||
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
||||||
"search_popout.tips.hashtag": "แฮชแท็ก",
|
"search_popout.tips.hashtag": "แฮชแท็ก",
|
||||||
"search_popout.tips.status": "สถานะ",
|
"search_popout.tips.status": "สถานะ",
|
||||||
"search_popout.tips.text": "Simple text returns matching display names, usernames and hashtags",
|
"search_popout.tips.text": "Simple text returns matching display names, usernames, groups and hashtags",
|
||||||
"search_popout.tips.user": "ผู้ใช้",
|
"search_popout.tips.user": "ผู้ใช้",
|
||||||
"search_results.accounts": "ผู้คน",
|
"search_results.accounts": "ผู้คน",
|
||||||
"search_results.hashtags": "แฮชแท็ก",
|
"search_results.hashtags": "แฮชแท็ก",
|
||||||
|
@ -307,7 +307,7 @@
|
|||||||
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, boosted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, boosted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
||||||
"search_popout.tips.hashtag": "hashtag",
|
"search_popout.tips.hashtag": "hashtag",
|
||||||
"search_popout.tips.status": "durum",
|
"search_popout.tips.status": "durum",
|
||||||
"search_popout.tips.text": "Simple text returns matching display names, usernames and hashtags",
|
"search_popout.tips.text": "Simple text returns matching display names, usernames, groups and hashtags",
|
||||||
"search_popout.tips.user": "kullanıcı",
|
"search_popout.tips.user": "kullanıcı",
|
||||||
"search_results.accounts": "İnsanlar",
|
"search_results.accounts": "İnsanlar",
|
||||||
"search_results.hashtags": "Hashtagler",
|
"search_results.hashtags": "Hashtagler",
|
||||||
|
@ -307,7 +307,7 @@
|
|||||||
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
"search_popout.tips.full_text": "Simple text returns statuses you have written, favourited, reposted, or have been mentioned in, as well as matching usernames, display names, and hashtags.",
|
||||||
"search_popout.tips.hashtag": "hashtag",
|
"search_popout.tips.hashtag": "hashtag",
|
||||||
"search_popout.tips.status": "status",
|
"search_popout.tips.status": "status",
|
||||||
"search_popout.tips.text": "Simple text returns matching display names, usernames and hashtags",
|
"search_popout.tips.text": "Simple text returns matching display names, usernames, groups and hashtags",
|
||||||
"search_popout.tips.user": "user",
|
"search_popout.tips.user": "user",
|
||||||
"search_results.accounts": "People",
|
"search_results.accounts": "People",
|
||||||
"search_results.hashtags": "Hashtags",
|
"search_results.hashtags": "Hashtags",
|
||||||
|
@ -43,6 +43,7 @@ export default function search(state = initialState, action) {
|
|||||||
accounts: ImmutableList(action.results.accounts.map(item => item.id)),
|
accounts: ImmutableList(action.results.accounts.map(item => item.id)),
|
||||||
statuses: ImmutableList(action.results.statuses.map(item => item.id)),
|
statuses: ImmutableList(action.results.statuses.map(item => item.id)),
|
||||||
hashtags: fromJS(action.results.hashtags),
|
hashtags: fromJS(action.results.hashtags),
|
||||||
|
groups: fromJS(action.results.groups),
|
||||||
})).set('submitted', true);
|
})).set('submitted', true);
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
|
@ -4625,14 +4625,20 @@ noscript {
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|
||||||
|
span {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
strong {
|
strong {
|
||||||
font-weight: 500;
|
color: $primary-text-color;
|
||||||
|
font-weight: 600;
|
||||||
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: $darker-text-color;
|
color: $darker-text-color;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-size: 14px;
|
font-size: 16px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
display: block;
|
display: block;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@ -5198,6 +5204,7 @@ noscript {
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
max-width: 1200px;
|
max-width: 1200px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
height: 32px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__type-filters-tabs {
|
&__type-filters-tabs {
|
||||||
|
@ -43,6 +43,17 @@ class Group < ApplicationRecord
|
|||||||
before_destroy :clean_feed_manager
|
before_destroy :clean_feed_manager
|
||||||
after_create :add_owner_to_accounts
|
after_create :add_owner_to_accounts
|
||||||
|
|
||||||
|
class << self
|
||||||
|
def search_for(term, limit = 100, offset = 0)
|
||||||
|
pattern = sanitize_sql_like(term.strip) + '%'
|
||||||
|
|
||||||
|
Group.where('lower(title) like lower(?) AND is_archived=false', pattern)
|
||||||
|
.order(:title)
|
||||||
|
.limit(limit)
|
||||||
|
.offset(offset)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def add_owner_to_accounts
|
def add_owner_to_accounts
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Search < ActiveModelSerializers::Model
|
class Search < ActiveModelSerializers::Model
|
||||||
attributes :accounts, :statuses, :hashtags
|
attributes :accounts, :statuses, :hashtags, :groups
|
||||||
end
|
end
|
||||||
|
@ -5,6 +5,7 @@ class REST::SearchSerializer < ActiveModel::Serializer
|
|||||||
|
|
||||||
has_many :accounts, serializer: REST::AccountSerializer
|
has_many :accounts, serializer: REST::AccountSerializer
|
||||||
has_many :statuses, serializer: REST::StatusSerializer
|
has_many :statuses, serializer: REST::StatusSerializer
|
||||||
|
has_many :groups, serializer: REST::GroupSerializer
|
||||||
|
|
||||||
def hashtags
|
def hashtags
|
||||||
object.hashtags.map(&:name)
|
object.hashtags.map(&:name)
|
||||||
|
@ -4,4 +4,5 @@ class REST::V2::SearchSerializer < ActiveModel::Serializer
|
|||||||
has_many :accounts, serializer: REST::AccountSerializer
|
has_many :accounts, serializer: REST::AccountSerializer
|
||||||
has_many :statuses, serializer: REST::StatusSerializer
|
has_many :statuses, serializer: REST::StatusSerializer
|
||||||
has_many :hashtags, serializer: REST::TagSerializer
|
has_many :hashtags, serializer: REST::TagSerializer
|
||||||
|
has_many :groups, serializer: REST::GroupSerializer
|
||||||
end
|
end
|
||||||
|
@ -16,6 +16,7 @@ class SearchService < BaseService
|
|||||||
results[:accounts] = perform_accounts_search! if account_searchable?
|
results[:accounts] = perform_accounts_search! if account_searchable?
|
||||||
results[:statuses] = perform_statuses_search! if full_text_searchable?
|
results[:statuses] = perform_statuses_search! if full_text_searchable?
|
||||||
results[:hashtags] = perform_hashtags_search! if hashtag_searchable?
|
results[:hashtags] = perform_hashtags_search! if hashtag_searchable?
|
||||||
|
results[:groups] = perform_groups_search!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -32,6 +33,14 @@ class SearchService < BaseService
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def perform_groups_search!
|
||||||
|
Group.search_for(
|
||||||
|
@query.gsub(/\A#/, ''),
|
||||||
|
@limit,
|
||||||
|
@offset
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
def perform_statuses_search!
|
def perform_statuses_search!
|
||||||
definition = StatusesIndex.filter(term: { searchable_by: @account.id })
|
definition = StatusesIndex.filter(term: { searchable_by: @account.id })
|
||||||
.query(multi_match: { type: 'most_fields', query: @query, operator: 'and', fields: %w(text text.stemmed) })
|
.query(multi_match: { type: 'most_fields', query: @query, operator: 'and', fields: %w(text text.stemmed) })
|
||||||
|
Loading…
Reference in New Issue
Block a user