Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Haelwenn
glitchsoc-fe
Commits
02b3cb20
Verified
Commit
02b3cb20
authored
Mar 30, 2018
by
Morgan Bazalgette
Committed by
Haelwenn
Jun 04, 2018
Browse files
Get charLimit from the initial state
parent
42cf3776
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/javascript/mastodon/features/compose/components/compose_form.js
View file @
02b3cb20
...
...
@@ -17,6 +17,7 @@ import { isMobile } from '../../../is_mobile';
import
ImmutablePureComponent
from
'
react-immutable-pure-component
'
;
import
{
length
}
from
'
stringz
'
;
import
{
countableText
}
from
'
../util/counter
'
;
import
{
charLimit
}
from
"
../../../initial_state
"
const
allowedAroundShortCode
=
'
><
\
u0085
\
u0020
\
u00a0
\
u1680
\
u2000
\
u2001
\
u2002
\
u2003
\
u2004
\
u2005
\
u2006
\
u2007
\
u2008
\
u2009
\
u200a
\
u202f
\
u205f
\
u3000
\
u2028
\
u2029
\
u0009
\
u000a
\
u000b
\
u000c
\
u000d
'
;
...
...
@@ -146,7 +147,7 @@ export default class ComposeForm extends ImmutablePureComponent {
const
{
intl
,
onPaste
,
showSearch
,
anyMedia
}
=
this
.
props
;
const
disabled
=
this
.
props
.
is_submitting
;
const
text
=
[
this
.
props
.
spoiler_text
,
countableText
(
this
.
props
.
text
)].
join
(
''
);
const
disabledButton
=
disabled
||
this
.
props
.
is_uploading
||
length
(
text
)
>
500
||
(
text
.
length
!==
0
&&
text
.
trim
().
length
===
0
&&
!
anyMedia
);
const
disabledButton
=
disabled
||
this
.
props
.
is_uploading
||
length
(
text
)
>
charLimit
||
(
text
.
length
!==
0
&&
text
.
trim
().
length
===
0
&&
!
anyMedia
);
let
publishText
=
''
;
if
(
this
.
props
.
privacy
===
'
private
'
||
this
.
props
.
privacy
===
'
direct
'
)
{
...
...
@@ -198,7 +199,7 @@ export default class ComposeForm extends ImmutablePureComponent {
<
SensitiveButtonContainer
/>
<
SpoilerButtonContainer
/>
<
/div
>
<
div
className
=
'
character-counter__wrapper
'
><
CharacterCounter
max
=
{
500
}
text
=
{
text
}
/></
div
>
<
div
className
=
'
character-counter__wrapper
'
><
CharacterCounter
max
=
{
charLimit
}
text
=
{
text
}
/></
div
>
<
/div
>
<
div
className
=
'
compose-form__publish
'
>
...
...
app/javascript/mastodon/initial_state.js
View file @
02b3cb20
...
...
@@ -11,5 +11,6 @@ export const boostModal = getMeta('boost_modal');
export
const
deleteModal
=
getMeta
(
'
delete_modal
'
);
export
const
me
=
getMeta
(
'
me
'
);
export
const
searchEnabled
=
getMeta
(
'
search_enabled
'
);
export
const
charLimit
=
getMeta
(
'
char_limit
'
)
||
5000
;
export
default
initialState
;
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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