This commit is contained in:
mgabdev 2020-05-14 23:36:10 -04:00
parent a1977ba450
commit 805012ab72
13 changed files with 27 additions and 16 deletions

View File

@ -81,11 +81,11 @@ export const ensureComposeIsVisible = (getState, routerHistory) => {
} }
}; };
export function changeCompose(text, markdown, replyId) { export function changeCompose(text, markdown, replyId, isStandalone) {
return function (dispatch, getState) { return function (dispatch, getState) {
const reduxReplyToId = getState().getIn(['compose', 'in_reply_to']) const reduxReplyToId = getState().getIn(['compose', 'in_reply_to'])
const existingText = getState().getIn(['compose', 'text']).trim() const existingText = getState().getIn(['compose', 'text']).trim()
const isModalOpen = getState().getIn(['modal', 'modalType']) === 'COMPOSE' const isModalOpen = getState().getIn(['modal', 'modalType']) === 'COMPOSE' || isStandalone
let status let status
if (!!replyId) { if (!!replyId) {
@ -299,7 +299,7 @@ export function submitCompose(group, replyToId = null, router) {
const scheduled_at = getState().getIn(['compose', 'scheduled_at'], null); const scheduled_at = getState().getIn(['compose', 'scheduled_at'], null);
if (scheduled_at !== null) scheduled_at = moment.utc(scheduled_at).toDate(); if (scheduled_at !== null) scheduled_at = moment.utc(scheduled_at).toDate();
if (isMobile(window)) { if (isMobile(window.innerWidth) && router) {
router.history.goBack() router.history.goBack()
} }

View File

@ -157,7 +157,7 @@ export function expandNotifications({ maxId } = {}, done = noOp) {
return; return;
} }
console.log("activeFilter:", activeFilter) // console.log("activeFilter:", activeFilter)
const params = { const params = {
max_id: maxId, max_id: maxId,

View File

@ -21,8 +21,7 @@ class ProPanel extends PureComponent {
render() { render() {
const { intl, isPro } = this.props const { intl, isPro } = this.props
// : todo : if (isPro) return null
// if (isPro) return null
return ( return (
<PanelLayout <PanelLayout

View File

@ -14,6 +14,7 @@ import {
deleteStatus, deleteStatus,
editStatus, editStatus,
} from '../../actions/statuses'; } from '../../actions/statuses';
import { quoteCompose } from '../../actions/compose'
import { import {
fetchGroupRelationships, fetchGroupRelationships,
createRemovedAccount, createRemovedAccount,
@ -257,6 +258,10 @@ class StatusOptionsPopover extends ImmutablePureComponent {
this.props.onRepost(this.props.status, e) this.props.onRepost(this.props.status, e)
} }
handleQuoteClick = (e) => {
this.props.onQuote(this.props.status, this.context.router)
}
render() { render() {
const { const {
status, status,
@ -293,7 +298,7 @@ class StatusOptionsPopover extends ImmutablePureComponent {
icon: 'pencil', icon: 'pencil',
hideArrow: true, hideArrow: true,
title: intl.formatMessage(messages.repostWithComment), title: intl.formatMessage(messages.repostWithComment),
onClick: this.handleRepostClick, onClick: this.handleQuoteClick,
}) })
} }

View File

@ -177,7 +177,7 @@ class Status extends ImmutablePureComponent {
if (snapshot !== null && this.props.updateScrollBottom) { if (snapshot !== null && this.props.updateScrollBottom) {
if (this.node && this.node.offsetTop < snapshot.top) { if (this.node && this.node.offsetTop < snapshot.top) {
console.log("updateScrollBottom") // console.log("updateScrollBottom")
this.props.updateScrollBottom(snapshot.height - snapshot.top) this.props.updateScrollBottom(snapshot.height - snapshot.top)
} }
} }

View File

@ -123,7 +123,7 @@ class StatusList extends ImmutablePureComponent {
} }
fetchContextsForInitialStatuses = (statusIds) => { fetchContextsForInitialStatuses = (statusIds) => {
console.log("fetchContextsForInitialStatuses:", statusIds) // console.log("fetchContextsForInitialStatuses:", statusIds)
for (let i = 0; i < statusIds.length; i++) { for (let i = 0; i < statusIds.length; i++) {
const statusId = statusIds[i]; const statusId = statusIds[i];
this.props.onFetchContext(statusId) this.props.onFetchContext(statusId)

View File

@ -41,6 +41,10 @@ export default
@injectIntl @injectIntl
class ComposeForm extends ImmutablePureComponent { class ComposeForm extends ImmutablePureComponent {
static contextTypes = {
router: PropTypes.object,
}
state = { state = {
composeFocused: false, composeFocused: false,
} }

View File

@ -28,6 +28,9 @@ const mapStateToProps = (state, { replyToId, isStandalone }) => {
if (isModalOpen) isMatch = true if (isModalOpen) isMatch = true
// console.log("isMatch:", isMatch, reduxReplyToId, replyToId, state.getIn(['compose', 'text']))
// console.log("reduxReplyToId:", reduxReplyToId, isModalOpen, isStandalone)
if (!isMatch) { if (!isMatch) {
return { return {
isMatch, isMatch,
@ -81,10 +84,10 @@ const mapStateToProps = (state, { replyToId, isStandalone }) => {
} }
} }
const mapDispatchToProps = (dispatch, { reduxReplyToId, replyToId }) => ({ const mapDispatchToProps = (dispatch, { reduxReplyToId, replyToId, isStandalone }) => ({
onChange(text, markdown, newReplyToId) { onChange(text, markdown, newReplyToId) {
dispatch(changeCompose(text, markdown, newReplyToId)) dispatch(changeCompose(text, markdown, newReplyToId, isStandalone))
}, },
onSubmit(group, replyToId, router) { onSubmit(group, replyToId, router) {

View File

@ -71,7 +71,7 @@ class ListTimeline extends ImmutablePureComponent {
} }
handleEditClick = () => { handleEditClick = () => {
console.log("handleEditClick:", this.props.params.id) // console.log("handleEditClick:", this.props.params.id)
this.props.dispatch(openModal('LIST_EDITOR', { id: this.props.params.id })) this.props.dispatch(openModal('LIST_EDITOR', { id: this.props.params.id }))
} }

View File

@ -117,7 +117,7 @@ class Notifications extends ImmutablePureComponent {
// : todo : include follow requests // : todo : include follow requests
console.log('--0--notifications:', hasMore) // console.log('--0--notifications:', hasMore)
if (isLoading && this.scrollableContent) { if (isLoading && this.scrollableContent) {
scrollableContent = this.scrollableContent scrollableContent = this.scrollableContent

View File

@ -37,7 +37,7 @@ class Search extends ImmutablePureComponent {
const { results, location } = this.props const { results, location } = this.props
const { isSmallScreen } = this.state const { isSmallScreen } = this.state
console.log("results:", results) // console.log("results:", results)
if (results.isEmpty() && isSmallScreen) { if (results.isEmpty() && isSmallScreen) {
return null return null

View File

@ -146,7 +146,7 @@ class SwitchingArea extends PureComponent {
<Redirect from='/' to='/home' exact /> <Redirect from='/' to='/home' exact />
<WrappedRoute path='/home' exact page={HomePage} component={HomeTimeline} content={children} /> <WrappedRoute path='/home' exact page={HomePage} component={HomeTimeline} content={children} />
<WrappedRoute path='/compose' exact page={BasicPage} component={Compose} content={children} componentParams={{ title: 'Gab' }} /> <WrappedRoute path='/compose' exact page={BasicPage} component={Compose} content={children} componentParams={{ title: 'Compose' }} />
<WrappedRoute path='/timeline/all' exact page={CommunityPage} component={CommunityTimeline} content={children} componentParams={{ title: 'Community Feed' }} /> <WrappedRoute path='/timeline/all' exact page={CommunityPage} component={CommunityTimeline} content={children} componentParams={{ title: 'Community Feed' }} />

View File

@ -173,7 +173,7 @@ const insertEmoji = (state, position, emojiData, needsSpace) => {
const oldText = state.get('text') const oldText = state.get('text')
const emoji = needsSpace ? ' ' + emojiData.native : emojiData.native const emoji = needsSpace ? ' ' + emojiData.native : emojiData.native
const text = `${oldText.slice(0, position)}${emoji} ${oldText.slice(position)}` const text = `${oldText.slice(0, position)}${emoji} ${oldText.slice(position)}`
console.log("insertEmoji reducer:", emoji, position, emojiData, needsSpace, text) // console.log("insertEmoji reducer:", emoji, position, emojiData, needsSpace, text)
return state.merge({ return state.merge({
text, text,