Commiting

This commit is contained in:
mgabdev
2020-11-25 15:22:37 -06:00
parent fb612f60c8
commit b4e370d3d3
136 changed files with 4171 additions and 3231 deletions

View File

@@ -80,7 +80,7 @@ class Account extends ImmutablePureComponent {
</Button>
) : <AccountActionButton account={account} isSmall />
const avatarSize = compact ? 42 : 52
const avatarSize = compact ? 40 : 52
const dismissBtn = !showDismiss ? null : (
<Button
isNarrow

View File

@@ -230,7 +230,7 @@ const mapDispatchToProps = (dispatch) => ({
onOpenStatusOptions(targetRef, status) {
dispatch(openPopover('STATUS_OPTIONS', {
targetRef,
status,
statusId: status.get('id'),
position: 'top',
}))
},

View File

@@ -126,7 +126,7 @@ const messages = defineMessages({
down: { id: 'keyboard_shortcuts.down', defaultMessage: 'move down in the list' },
column: { id: 'keyboard_shortcuts.column', defaultMessage: 'focus a status in one of the columns' },
compose: { id: 'keyboard_shortcuts.compose', defaultMessage: 'focus the compose textarea' },
gab: { id: 'keyboard_shortcuts.toot', defaultMessage: 'start a brand new gab' },
gab: { id: 'keyboard_shortcuts.gab', defaultMessage: 'start a brand new gab' },
back: { id: 'keyboard_shortcuts.back', defaultMessage: 'navigate back' },
search: { id: 'keyboard_shortcuts.search', defaultMessage: 'focus search' },
unfocus: { id: 'keyboard_shortcuts.unfocus', defaultMessage: 'un-focus compose textarea/search' },

View File

@@ -4,7 +4,7 @@ import { connect } from 'react-redux'
import ImmutablePropTypes from 'react-immutable-proptypes'
import ImmutablePureComponent from 'react-immutable-pure-component'
import { defineMessages, injectIntl } from 'react-intl'
import { fetchGroups } from '../../actions/groups'
import { fetchGroupsByTab } from '../../actions/groups'
import PanelLayout from './panel_layout'
import GroupListItem from '../group_list_item'
import ScrollableList from '../scrollable_list'
@@ -26,13 +26,13 @@ class GroupsPanel extends ImmutablePureComponent {
componentDidUpdate(prevProps, prevState, snapshot) {
if (!prevState.fetched && this.state.fetched) {
this.props.onFetchGroups(this.props.groupType)
this.props.onFetchGroupsByTab(this.props.groupType)
}
}
componentDidMount() {
if (!this.props.isLazy) {
this.props.onFetchGroups(this.props.groupType)
this.props.onFetchGroupsByTab(this.props.groupType)
this.setState({ fetched: true })
}
}
@@ -93,7 +93,7 @@ const mapStateToProps = (state, { groupType }) => ({
})
const mapDispatchToProps = (dispatch) => ({
onFetchGroups: (type) => dispatch(fetchGroups(type))
onFetchGroupsByTab: (type) => dispatch(fetchGroupsByTab(type))
})
GroupsPanel.propTypes = {

View File

@@ -5,13 +5,16 @@ import ImmutablePropTypes from 'react-immutable-proptypes'
import ImmutablePureComponent from 'react-immutable-pure-component'
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl'
import { me, isStaff, boostModal, deleteModal } from '../../initial_state'
import { makeGetStatus } from '../../selectors'
import {
repost,
unrepost,
pin,
unpin,
isPin,
bookmark,
unbookmark,
isBookmark,
} from '../../actions/interactions';
import {
deleteStatus,
@@ -24,6 +27,7 @@ import {
groupRemoveStatus,
pinGroupStatus,
unpinGroupStatus,
isPinnedGroupStatus,
} from '../../actions/groups'
import { initReport } from '../../actions/reports'
import { openModal } from '../../actions/modal'
@@ -51,11 +55,23 @@ class StatusOptionsPopover extends ImmutablePureComponent {
]
componentDidMount() {
const {
status,
statusId,
groupRelationships,
} = this.props
if (status.get('pinnable')) {
this.props.fetchIsPin(statusId)
}
this.props.fetchIsBookmark(statusId)
if (!!status.get('group')) {
this.props.fetchIsPinnedGroupStatus(status.getIn(['group', 'id'], null), statusId)
}
if (!this.props.groupRelationships && this.props.groupId) {
this.props.onFetchGroupRelationships(this.props.groupId)
// : todo :
// check if pin
// check if bookmark
}
}
@@ -131,11 +147,15 @@ class StatusOptionsPopover extends ImmutablePureComponent {
isXS,
} = this.props
if (!status) return <div />
const mutingConversation = status.get('muted')
const publicStatus = ['public', 'unlisted'].includes(status.get('visibility'))
const isReply = !!status.get('in_reply_to_id')
const withGroupAdmin = !!groupRelationships ? (groupRelationships.get('admin') || groupRelationships.get('moderator')) : false
console.log("publicStatus:", status, publicStatus)
let menu = []
if (me) {
@@ -296,13 +316,15 @@ const messages = defineMessages({
share: { id: 'status.share_gab', defaultMessage: 'Share gab' },
})
const mapStateToProps = (state, { status }) => {
const mapStateToProps = (state, { statusId }) => {
if (!me) return null
const status = statusId ? makeGetStatus()(state, { id: statusId }) : undefined
const groupId = status ? status.getIn(['group', 'id']) : undefined
const groupRelationships = state.getIn(['group_relationships', groupId])
return {
status,
groupId,
groupRelationships,
isPro: state.getIn(['accounts', me, 'is_pro']),
@@ -311,6 +333,18 @@ const mapStateToProps = (state, { status }) => {
const mapDispatchToProps = (dispatch) => ({
fetchIsPin(statusId) {
dispatch(isPin(statusId))
},
fetchIsBookmark(statusId) {
dispatch(isBookmark(statusId))
},
fetchIsPinnedGroupStatus(groupId, statusId) {
dispatch(isPinnedGroupStatus(groupId, statusId))
},
onPin(status) {
dispatch(closePopover())
@@ -440,7 +474,8 @@ const mapDispatchToProps = (dispatch) => ({
})
StatusOptionsPopover.propTypes = {
status: ImmutablePropTypes.map.isRequired,
status: ImmutablePropTypes.map,
statusId: PropTypes.string.isRequired,
groupRelationships: ImmutablePropTypes.map,
groupId: PropTypes.string,
onQuote: PropTypes.func.isRequired,
@@ -454,6 +489,9 @@ StatusOptionsPopover.propTypes = {
onFetchGroupRelationships: PropTypes.func.isRequired,
onOpenProUpgradeModal: PropTypes.func.isRequired,
onClosePopover: PropTypes.func.isRequired,
fetchIsPinnedGroupStatus: PropTypes.func.isRequired,
fetchIsBookmark: PropTypes.func.isRequired,
fetchIsPin: PropTypes.func.isRequired,
isXS: PropTypes.bool,
isPro: PropTypes.bool,
}

View File

@@ -11,7 +11,7 @@ import { CX } from '../constants'
class StatusActionBar extends ImmutablePureComponent {
updateOnProps = ['status']
// updateOnProps = ['status']
handleShareClick = () => {
this.props.onShare(this.shareButton, this.props.status)

View File

@@ -4,7 +4,7 @@ import { connect } from 'react-redux'
import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { Set as ImmutableSet } from 'immutable';
import noop from 'lodash/noop';
import noop from 'lodash.noop'
import { toggleStatusReport } from '../actions/reports';
import { MediaGallery, Video } from '../features/ui/util/async_components';
import Bundle from '../features/ui/util/bundle';

View File

@@ -216,7 +216,7 @@ const mapDispatchToProps = (dispatch) => ({
onOpenStatusOptionsPopover(targetRef, status) {
dispatch(openPopover('STATUS_OPTIONS', {
targetRef,
status,
statusId: status.get('id'),
position: 'left-start',
}))
},

View File

@@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import ImmutablePropTypes from 'react-immutable-proptypes'
import ImmutablePureComponent from 'react-immutable-pure-component'
import { fetchGroups } from '../../actions/groups'
import { fetchGroupsByTab } from '../../actions/groups'
import GroupCollectionItem from '../group_collection_item'
import TimelineInjectionLayout from './timeline_injection_layout'
@@ -11,7 +11,7 @@ class FeaturedGroupsInjection extends ImmutablePureComponent {
componentDidMount() {
if (!this.props.isFetched) {
this.props.onFetchGroups('featured')
this.props.onFetchGroupsByTap('featured')
}
}
@@ -59,14 +59,14 @@ const mapStateToProps = (state) => ({
})
const mapDispatchToProps = (dispatch) => ({
onFetchGroups: (tab) => dispatch(fetchGroups(tab)),
onFetchGroupsByTap: (tab) => dispatch(fetchGroupsByTab(tab)),
})
FeaturedGroupsInjection.propTypes = {
groupIds: ImmutablePropTypes.list,
isFetched: PropTypes.bool.isRequired,
isLoading: PropTypes.bool.isRequired,
onFetchGroups: PropTypes.func.isRequired,
onFetchGroupsByTab: PropTypes.func.isRequired,
injectionId: PropTypes.string.isRequired,
}