Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
Open sidebar
Tiger Ton
mastodon
Commits
55af04b2
Unverified
Commit
55af04b2
authored
2 years ago
by
Eugen Rochko
Committed by
GitHub
2 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Fix logged out search and changed logged-in search placeholder (#19514)
parent
e6d415bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/javascript/mastodon/actions/search.js
+3
-2
app/javascript/mastodon/actions/search.js
app/javascript/mastodon/features/compose/components/search.js
+4
-1
...javascript/mastodon/features/compose/components/search.js
with
7 additions
and
3 deletions
+7
-3
app/javascript/mastodon/actions/search.js
+
3
-
2
View file @
55af04b2
...
...
@@ -29,7 +29,8 @@ export function clearSearch() {
export
function
submitSearch
()
{
return
(
dispatch
,
getState
)
=>
{
const
value
=
getState
().
getIn
([
'
search
'
,
'
value
'
]);
const
value
=
getState
().
getIn
([
'
search
'
,
'
value
'
]);
const
signedIn
=
!!
getState
().
getIn
([
'
meta
'
,
'
me
'
]);
if
(
value
.
length
===
0
)
{
dispatch
(
fetchSearchSuccess
({
accounts
:
[],
statuses
:
[],
hashtags
:
[]
},
''
));
...
...
@@ -41,7 +42,7 @@ export function submitSearch() {
api
(
getState
).
get
(
'
/api/v2/search
'
,
{
params
:
{
q
:
value
,
resolve
:
true
,
resolve
:
signedIn
,
limit
:
5
,
},
}).
then
(
response
=>
{
...
...
This diff is collapsed.
Click to expand it.
app/javascript/mastodon/features/compose/components/search.js
+
4
-
1
View file @
55af04b2
...
...
@@ -9,6 +9,7 @@ import Icon from 'mastodon/components/icon';
const
messages
=
defineMessages
({
placeholder
:
{
id
:
'
search.placeholder
'
,
defaultMessage
:
'
Search
'
},
placeholderSignedIn
:
{
id
:
'
search.search_or_paste
'
,
defaultMessage
:
'
Search or paste URL
'
},
});
class
SearchPopout
extends
React
.
PureComponent
{
...
...
@@ -49,6 +50,7 @@ class Search extends React.PureComponent {
static
contextTypes
=
{
router
:
PropTypes
.
object
.
isRequired
,
identity
:
PropTypes
.
object
.
isRequired
,
};
static
propTypes
=
{
...
...
@@ -116,6 +118,7 @@ class Search extends React.PureComponent {
render
()
{
const
{
intl
,
value
,
submitted
}
=
this
.
props
;
const
{
expanded
}
=
this
.
state
;
const
{
signedIn
}
=
this
.
context
.
identity
;
const
hasValue
=
value
.
length
>
0
||
submitted
;
return
(
...
...
@@ -126,7 +129,7 @@ class Search extends React.PureComponent {
ref
=
{
this
.
setRef
}
className
=
'
search__input
'
type
=
'
text
'
placeholder
=
{
intl
.
formatMessage
(
messages
.
placeholder
)}
placeholder
=
{
intl
.
formatMessage
(
signedIn
?
messages
.
placeholderSignedIn
:
messages
.
placeholder
)}
value
=
{
value
}
onChange
=
{
this
.
handleChange
}
onKeyUp
=
{
this
.
handleKeyUp
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets