Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mastofe
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
34
Issues
34
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pleroma
mastofe
Commits
1740c5ef
Verified
Commit
1740c5ef
authored
Feb 17, 2019
by
KokaKiwi
Committed by
Haelwenn
May 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add status content type dropdown to compose box.
parent
8d179134
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
80 additions
and
1 deletion
+80
-1
app/javascript/flavours/glitch/actions/compose.js
app/javascript/flavours/glitch/actions/compose.js
+9
-0
app/javascript/flavours/glitch/features/compose/components/compose_form.js
...avours/glitch/features/compose/components/compose_form.js
+7
-0
app/javascript/flavours/glitch/features/compose/components/options.js
...pt/flavours/glitch/features/compose/components/options.js
+51
-0
app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js
...tch/features/compose/containers/compose_form_container.js
+6
-0
app/javascript/flavours/glitch/features/compose/index.js
app/javascript/flavours/glitch/features/compose/index.js
+1
-1
app/javascript/flavours/glitch/reducers/compose.js
app/javascript/flavours/glitch/reducers/compose.js
+6
-0
No files found.
app/javascript/flavours/glitch/actions/compose.js
View file @
1740c5ef
...
...
@@ -45,6 +45,7 @@ export const COMPOSE_SPOILERNESS_CHANGE = 'COMPOSE_SPOILERNESS_CHANGE';
export
const
COMPOSE_SPOILER_TEXT_CHANGE
=
'
COMPOSE_SPOILER_TEXT_CHANGE
'
;
export
const
COMPOSE_VISIBILITY_CHANGE
=
'
COMPOSE_VISIBILITY_CHANGE
'
;
export
const
COMPOSE_LISTABILITY_CHANGE
=
'
COMPOSE_LISTABILITY_CHANGE
'
;
export
const
COMPOSE_CONTENT_TYPE_CHANGE
=
'
COMPOSE_CONTENT_TYPE_CHANGE
'
;
export
const
COMPOSE_EMOJI_INSERT
=
'
COMPOSE_EMOJI_INSERT
'
;
...
...
@@ -140,6 +141,7 @@ export function submitCompose(routerHistory) {
}
api
(
getState
).
post
(
'
/api/v1/statuses
'
,
{
status
,
content_type
:
getState
().
getIn
([
'
compose
'
,
'
content_type
'
]),
in_reply_to_id
:
getState
().
getIn
([
'
compose
'
,
'
in_reply_to
'
],
null
),
media_ids
:
media
.
map
(
item
=>
item
.
get
(
'
id
'
)),
sensitive
:
getState
().
getIn
([
'
compose
'
,
'
sensitive
'
])
||
(
spoilerText
.
length
>
0
&&
media
.
size
!==
0
),
...
...
@@ -511,6 +513,13 @@ export function changeComposeVisibility(value) {
};
};
export
function
changeComposeContentType
(
value
)
{
return
{
type
:
COMPOSE_CONTENT_TYPE_CHANGE
,
value
,
};
};
export
function
insertEmojiCompose
(
position
,
emoji
)
{
return
{
type
:
COMPOSE_EMOJI_INSERT
,
...
...
app/javascript/flavours/glitch/features/compose/components/compose_form.js
View file @
1740c5ef
...
...
@@ -37,6 +37,7 @@ class ComposeForm extends ImmutablePureComponent {
suggestions
:
ImmutablePropTypes
.
list
,
spoiler
:
PropTypes
.
bool
,
privacy
:
PropTypes
.
string
,
contentType
:
PropTypes
.
string
,
spoilerText
:
PropTypes
.
string
,
focusDate
:
PropTypes
.
instanceOf
(
Date
),
caretPosition
:
PropTypes
.
number
,
...
...
@@ -65,6 +66,7 @@ class ComposeForm extends ImmutablePureComponent {
preselectOnReply
:
PropTypes
.
bool
,
onChangeSpoilerness
:
PropTypes
.
func
,
onChangeVisibility
:
PropTypes
.
func
,
onChangeContentType
:
PropTypes
.
func
,
onMount
:
PropTypes
.
func
,
onUnmount
:
PropTypes
.
func
,
onPaste
:
PropTypes
.
func
,
...
...
@@ -284,10 +286,12 @@ class ComposeForm extends ImmutablePureComponent {
media
,
onChangeSpoilerness
,
onChangeVisibility
,
onChangeContentType
,
onClearSuggestions
,
onFetchSuggestions
,
onPaste
,
privacy
,
contentType
,
sensitive
,
showSearch
,
sideArm
,
...
...
@@ -355,9 +359,11 @@ class ComposeForm extends ImmutablePureComponent {
advancedOptions
=
{
advancedOptions
}
disabled
=
{
isSubmitting
}
onChangeVisibility
=
{
onChangeVisibility
}
onChangeContentType
=
{
onChangeContentType
}
onToggleSpoiler
=
{
spoilersAlwaysOn
?
null
:
onChangeSpoilerness
}
onUpload
=
{
onPaste
}
privacy
=
{
privacy
}
contentType
=
{
contentType
}
sensitive
=
{
sensitive
||
(
spoilersAlwaysOn
&&
spoilerText
&&
spoilerText
.
length
>
0
)}
spoiler
=
{
spoilersAlwaysOn
?
(
spoilerText
&&
spoilerText
.
length
>
0
)
:
spoiler
}
/
>
...
...
@@ -368,6 +374,7 @@ class ComposeForm extends ImmutablePureComponent {
onSecondarySubmit
=
{
handleSecondarySubmit
}
onSubmit
=
{
handleSubmit
}
privacy
=
{
privacy
}
contentType
=
{
contentType
}
sideArm
=
{
sideArm
}
/
>
<
/div
>
...
...
app/javascript/flavours/glitch/features/compose/components/options.js
View file @
1740c5ef
...
...
@@ -29,6 +29,10 @@ const messages = defineMessages({
defaultMessage
:
'
Adjust status privacy
'
,
id
:
'
privacy.change
'
,
},
content_type
:
{
defaultMessage
:
'
Content type
'
,
id
:
'
content-type.change
'
,
},
direct_long
:
{
defaultMessage
:
'
Post to mentioned users only
'
,
id
:
'
privacy.direct.long
'
,
...
...
@@ -41,6 +45,10 @@ const messages = defineMessages({
defaultMessage
:
'
Draw something
'
,
id
:
'
compose.attach.doodle
'
,
},
html
:
{
defaultMessage
:
'
HTML
'
,
id
:
'
compose.content-type.html
'
,
},
local_only_long
:
{
defaultMessage
:
'
Do not post to other instances
'
,
id
:
'
advanced_options.local-only.long
'
,
...
...
@@ -49,6 +57,14 @@ const messages = defineMessages({
defaultMessage
:
'
Local-only
'
,
id
:
'
advanced_options.local-only.short
'
,
},
markdown
:
{
defaultMessage
:
'
Markdown
'
,
id
:
'
compose.content-type.markdown
'
,
},
plain
:
{
defaultMessage
:
'
Plain text
'
,
id
:
'
compose.content-type.plain
'
,
},
private_long
:
{
defaultMessage
:
'
Post to followers only
'
,
id
:
'
privacy.private.long
'
,
...
...
@@ -118,6 +134,7 @@ class ComposerOptions extends ImmutablePureComponent {
onChangeAdvancedOption
:
PropTypes
.
func
,
onChangeSensitivity
:
PropTypes
.
func
,
onChangeVisibility
:
PropTypes
.
func
,
onChangeContentType
:
PropTypes
.
func
,
onTogglePoll
:
PropTypes
.
func
,
onDoodleOpen
:
PropTypes
.
func
,
onModalClose
:
PropTypes
.
func
,
...
...
@@ -125,6 +142,7 @@ class ComposerOptions extends ImmutablePureComponent {
onToggleSpoiler
:
PropTypes
.
func
,
onUpload
:
PropTypes
.
func
,
privacy
:
PropTypes
.
string
,
contentType
:
PropTypes
.
string
,
resetFileKey
:
PropTypes
.
number
,
sensitive
:
PropTypes
.
bool
,
spoiler
:
PropTypes
.
bool
,
...
...
@@ -168,6 +186,7 @@ class ComposerOptions extends ImmutablePureComponent {
const
{
acceptContentTypes
,
advancedOptions
,
contentType
,
disabled
,
allowMedia
,
hasMedia
,
...
...
@@ -176,6 +195,7 @@ class ComposerOptions extends ImmutablePureComponent {
intl
,
onChangeAdvancedOption
,
onChangeSensitivity
,
onChangeContentType
,
onChangeVisibility
,
onTogglePoll
,
onModalClose
,
...
...
@@ -216,6 +236,24 @@ class ComposerOptions extends ImmutablePureComponent {
},
};
const
contentTypeItems
=
{
plain
:
{
icon
:
'
file
'
,
name
:
'
text/plain
'
,
text
:
<
FormattedMessage
{...
messages
.
plain
}
/>
,
},
html
:
{
icon
:
'
file-text
'
,
name
:
'
text/html
'
,
text
:
<
FormattedMessage
{...
messages
.
html
}
/>
,
},
markdown
:
{
icon
:
'
file-text
'
,
name
:
'
text/markdown
'
,
text
:
<
FormattedMessage
{...
messages
.
markdown
}
/>
,
},
};
// The result.
return
(
<
div
className
=
'
composer--options
'
>
...
...
@@ -313,6 +351,19 @@ class ComposerOptions extends ImmutablePureComponent {
title
=
{
intl
.
formatMessage
(
messages
.
change_privacy
)}
value
=
{
privacy
}
/
>
<
Dropdown
icon
=
"
code
"
items
=
{[
contentTypeItems
.
plain
,
contentTypeItems
.
html
,
contentTypeItems
.
markdown
,
]}
onChange
=
{
onChangeContentType
}
onModalClose
=
{
onModalClose
}
onModalOpen
=
{
onModalOpen
}
title
=
{
intl
.
formatMessage
(
messages
.
content_type
)}
value
=
{
contentType
}
/
>
{
onToggleSpoiler
&&
(
<
TextIconButton
active
=
{
spoiler
}
...
...
app/javascript/flavours/glitch/features/compose/containers/compose_form_container.js
View file @
1740c5ef
...
...
@@ -6,6 +6,7 @@ import {
changeComposeSpoilerText
,
changeComposeSpoilerness
,
changeComposeVisibility
,
changeComposeContentType
,
clearComposeSuggestions
,
fetchComposeSuggestions
,
insertEmojiCompose
,
...
...
@@ -57,6 +58,7 @@ function mapStateToProps (state) {
media
:
state
.
getIn
([
'
compose
'
,
'
media_attachments
'
]),
preselectDate
:
state
.
getIn
([
'
compose
'
,
'
preselectDate
'
]),
privacy
:
state
.
getIn
([
'
compose
'
,
'
privacy
'
]),
contentType
:
state
.
getIn
([
'
compose
'
,
'
content_type
'
]),
sideArm
:
sideArmPrivacy
,
sensitive
:
state
.
getIn
([
'
compose
'
,
'
sensitive
'
]),
showSearch
:
state
.
getIn
([
'
search
'
,
'
submitted
'
])
&&
!
state
.
getIn
([
'
search
'
,
'
hidden
'
]),
...
...
@@ -98,6 +100,10 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
dispatch
(
changeComposeSpoilerText
(
text
));
},
onChangeContentType
(
value
)
{
dispatch
(
changeComposeContentType
(
value
));
},
onPaste
(
files
)
{
dispatch
(
uploadCompose
(
files
));
},
...
...
app/javascript/flavours/glitch/features/compose/index.js
View file @
1740c5ef
...
...
@@ -21,7 +21,7 @@ const mapStateToProps = (state, ownProps) => ({
showSearch
:
ownProps
.
multiColumn
?
state
.
getIn
([
'
search
'
,
'
submitted
'
])
&&
!
state
.
getIn
([
'
search
'
,
'
hidden
'
])
:
ownProps
.
isSearchPage
,
});
export
default
@
connect
(
mapStateToProps
,
mapDispatchToProps
)
export
default
@
connect
(
mapStateToProps
)
@
injectIntl
class
Compose
extends
React
.
PureComponent
{
static
propTypes
=
{
...
...
app/javascript/flavours/glitch/reducers/compose.js
View file @
1740c5ef
...
...
@@ -25,6 +25,7 @@ import {
COMPOSE_SPOILERNESS_CHANGE
,
COMPOSE_SPOILER_TEXT_CHANGE
,
COMPOSE_VISIBILITY_CHANGE
,
COMPOSE_CONTENT_TYPE_CHANGE
,
COMPOSE_EMOJI_INSERT
,
COMPOSE_UPLOAD_CHANGE_REQUEST
,
COMPOSE_UPLOAD_CHANGE_SUCCESS
,
...
...
@@ -66,6 +67,7 @@ const initialState = ImmutableMap({
spoiler
:
false
,
spoiler_text
:
''
,
privacy
:
null
,
content_type
:
'
text/plain
'
,
text
:
''
,
focusDate
:
null
,
caretPosition
:
null
,
...
...
@@ -310,6 +312,10 @@ export default function compose(state = initialState, action) {
return
state
.
set
(
'
privacy
'
,
action
.
value
)
.
set
(
'
idempotencyKey
'
,
uuid
());
case
COMPOSE_CONTENT_TYPE_CHANGE
:
return
state
.
set
(
'
content_type
'
,
action
.
value
)
.
set
(
'
idempotencyKey
'
,
uuid
());
case
COMPOSE_CHANGE
:
return
state
.
set
(
'
text
'
,
action
.
text
)
...
...
Write
Preview
Markdown
is supported
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