forked from mastodon/mastodon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit b85a468 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 10:50:03 2020 +0900 Changed to remove restrictions on privacy options and allow users to switch circles when replying commit 0a8c014 Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Sep 5 09:33:07 2020 +0900 Change limited visibility icon commit b64adf1 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Aug 31 06:50:56 2020 +0900 Fix a change to limited-visibility-bearcaps replies commit ed36140 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Aug 27 15:53:18 2020 +0900 Fix composer text when change visibility commit 4da3add Author: noellabo <noel.yoshiba@gmail.com> Date: Sat Aug 22 22:34:23 2020 +0900 Fix wrong circle_id when changing visibility commit 752d7fc Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Aug 9 13:12:51 2020 +0900 Add circle reply and redraft commit 5978bc0 Author: noellabo <noel.yoshiba@gmail.com> Date: Mon Jul 27 01:07:52 2020 +0900 Fix remove unused props commit 7970f69 Author: noellabo <noel.yoshiba@gmail.com> Date: Sun Jul 26 21:17:07 2020 +0900 Separate circle choice from privacy commit 36f6a68 Author: noellabo <noel.yoshiba@gmail.com> Date: Thu Jul 23 10:54:25 2020 +0900 Add UI for posting to circles commit 7ef4800 Author: noellabo <noel.yoshiba@gmail.com> Date: Fri Jul 24 12:55:10 2020 +0900 Fix silent mention by circle
- Loading branch information
Showing
16 changed files
with
282 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
app/javascript/mastodon/features/compose/components/circle_dropdown.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import React from 'react'; | ||
import { connect } from 'react-redux'; | ||
import PropTypes from 'prop-types'; | ||
import ImmutablePropTypes from 'react-immutable-proptypes'; | ||
import { injectIntl, defineMessages } from 'react-intl'; | ||
import classNames from 'classnames'; | ||
import IconButton from 'mastodon/components/icon_button'; | ||
import { createSelector } from 'reselect'; | ||
|
||
const messages = defineMessages({ | ||
circle_unselect: { id: 'circle.unselect', defaultMessage: '(Select circle)' }, | ||
circle_reply: { id: 'circle.reply', defaultMessage: '(Reply to circle context)' }, | ||
circle_open_circle_column: { id: 'circle.open_circle_column', defaultMessage: 'Open circle column' }, | ||
circle_add_new_circle: { id: 'circle.add_new_circle', defaultMessage: '(Add new circle)' }, | ||
circle_select: { id: 'circle.select', defaultMessage: 'Select circle' }, | ||
}); | ||
|
||
const getOrderedCircles = createSelector([state => state.get('circles')], circles => { | ||
if (!circles) { | ||
return circles; | ||
} | ||
|
||
return circles.toList().filter(item => !!item).sort((a, b) => a.get('title').localeCompare(b.get('title'))); | ||
}); | ||
|
||
const mapStateToProps = (state) => { | ||
return { | ||
circles: getOrderedCircles(state), | ||
}; | ||
}; | ||
|
||
export default @connect(mapStateToProps) | ||
@injectIntl | ||
class CircleDropdown extends React.PureComponent { | ||
|
||
static contextTypes = { | ||
router: PropTypes.object, | ||
}; | ||
|
||
static propTypes = { | ||
circles: ImmutablePropTypes.list, | ||
value: PropTypes.string.isRequired, | ||
visible: PropTypes.bool.isRequired, | ||
limitedReply: PropTypes.bool.isRequired, | ||
onChange: PropTypes.func.isRequired, | ||
onOpenCircleColumn: PropTypes.func.isRequired, | ||
intl: PropTypes.object.isRequired, | ||
}; | ||
|
||
handleChange = e => { | ||
this.props.onChange(e.target.value); | ||
}; | ||
|
||
handleOpenCircleColumn = () => { | ||
this.props.onOpenCircleColumn(this.context.router ? this.context.router.history : null); | ||
}; | ||
|
||
render () { | ||
const { circles, value, visible, limitedReply, intl } = this.props; | ||
|
||
return ( | ||
<div className={classNames('circle-dropdown', { 'circle-dropdown--visible': visible })}> | ||
<IconButton icon='user-circle' className='circle-dropdown__icon' title={intl.formatMessage(messages.circle_open_circle_column)} style={{ width: 'auto', height: 'auto' }} onClick={this.handleOpenCircleColumn} /> | ||
|
||
{circles.isEmpty() && !limitedReply ? | ||
<button className='circle-dropdown__menu' onClick={this.handleOpenCircleColumn}>{intl.formatMessage(messages.circle_add_new_circle)}</button> | ||
: | ||
/* eslint-disable-next-line jsx-a11y/no-onchange */ | ||
<select className='circle-dropdown__menu' title={intl.formatMessage(messages.circle_select)} value={value} onChange={this.handleChange}> | ||
<option value='' key='unselect'>{intl.formatMessage(limitedReply ? messages.circle_reply : messages.circle_unselect)}</option> | ||
{circles.map(circle => | ||
<option value={circle.get('id')} key={circle.get('id')}>{circle.get('title')}</option>, | ||
)} | ||
</select> | ||
} | ||
</div> | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
app/javascript/mastodon/features/compose/containers/circle_dropdown_container.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { connect } from 'react-redux'; | ||
import CircleDropdown from '../components/circle_dropdown'; | ||
import { changeComposeCircle } from '../../../actions/compose'; | ||
|
||
const mapStateToProps = state => { | ||
let value = state.getIn(['compose', 'circle_id']); | ||
value = value === null ? '' : value; | ||
|
||
return { | ||
value: value, | ||
visible: state.getIn(['compose', 'privacy']) === 'limited', | ||
limitedReply: state.getIn(['compose', 'privacy']) === 'limited' && state.getIn(['compose', 'reply_status', 'visibility']) === 'limited', | ||
}; | ||
}; | ||
|
||
const mapDispatchToProps = dispatch => ({ | ||
|
||
onChange (value) { | ||
dispatch(changeComposeCircle(value)); | ||
}, | ||
|
||
onOpenCircleColumn (router) { | ||
if(router && router.location.pathname !== '/circles') { | ||
router.push('/circles'); | ||
} | ||
}, | ||
|
||
}); | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(CircleDropdown); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.