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.
Fix mastodon#61 - Add list of blocked users to the UI; clean up faile…
…d push notifications API Try to fix Travis CI setup
- Loading branch information
Showing
16 changed files
with
186 additions
and
69 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
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,82 @@ | ||
import api, { getLinks } from '../api' | ||
import { fetchRelationships } from './accounts'; | ||
|
||
export const BLOCKS_FETCH_REQUEST = 'BLOCKS_FETCH_REQUEST'; | ||
export const BLOCKS_FETCH_SUCCESS = 'BLOCKS_FETCH_SUCCESS'; | ||
export const BLOCKS_FETCH_FAIL = 'BLOCKS_FETCH_FAIL'; | ||
|
||
export const BLOCKS_EXPAND_REQUEST = 'BLOCKS_EXPAND_REQUEST'; | ||
export const BLOCKS_EXPAND_SUCCESS = 'BLOCKS_EXPAND_SUCCESS'; | ||
export const BLOCKS_EXPAND_FAIL = 'BLOCKS_EXPAND_FAIL'; | ||
|
||
export function fetchBlocks() { | ||
return (dispatch, getState) => { | ||
dispatch(fetchBlocksRequest()); | ||
|
||
api(getState).get('/api/v1/blocks').then(response => { | ||
const next = getLinks(response).refs.find(link => link.rel === 'next'); | ||
dispatch(fetchBlocksSuccess(response.data, next ? next.uri : null)); | ||
dispatch(fetchRelationships(response.data.map(item => item.id))); | ||
}).catch(error => dispatch(fetchBlocksFail(error))); | ||
}; | ||
}; | ||
|
||
export function fetchBlocksRequest() { | ||
return { | ||
type: BLOCKS_FETCH_REQUEST | ||
}; | ||
}; | ||
|
||
export function fetchBlocksSuccess(accounts, next) { | ||
return { | ||
type: BLOCKS_FETCH_SUCCESS, | ||
accounts, | ||
next | ||
}; | ||
}; | ||
|
||
export function fetchBlocksFail(error) { | ||
return { | ||
type: BLOCKS_FETCH_FAIL, | ||
error | ||
}; | ||
}; | ||
|
||
export function expandBlocks() { | ||
return (dispatch, getState) => { | ||
const url = getState().getIn(['user_lists', 'blocks', 'next']); | ||
|
||
if (url === null) { | ||
return; | ||
} | ||
|
||
dispatch(expandBlocksRequest()); | ||
|
||
api(getState).get(url).then(response => { | ||
const next = getLinks(response).refs.find(link => link.rel === 'next'); | ||
dispatch(expandBlocksSuccess(response.data, next ? next.uri : null)); | ||
dispatch(fetchRelationships(response.data.map(item => item.id))); | ||
}).catch(error => dispatch(expandBlocksFail(error))); | ||
}; | ||
}; | ||
|
||
export function expandBlocksRequest() { | ||
return { | ||
type: BLOCKS_EXPAND_REQUEST | ||
}; | ||
}; | ||
|
||
export function expandBlocksSuccess(accounts, next) { | ||
return { | ||
type: BLOCKS_EXPAND_SUCCESS, | ||
accounts, | ||
next | ||
}; | ||
}; | ||
|
||
export function expandBlocksFail(error) { | ||
return { | ||
type: BLOCKS_EXPAND_FAIL, | ||
error | ||
}; | ||
}; |
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
68 changes: 68 additions & 0 deletions
68
app/assets/javascripts/components/features/blocks/index.jsx
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,68 @@ | ||
import { connect } from 'react-redux'; | ||
import PureRenderMixin from 'react-addons-pure-render-mixin'; | ||
import ImmutablePropTypes from 'react-immutable-proptypes'; | ||
import LoadingIndicator from '../../components/loading_indicator'; | ||
import { ScrollContainer } from 'react-router-scroll'; | ||
import Column from '../ui/components/column'; | ||
import ColumnBackButtonSlim from '../../components/column_back_button_slim'; | ||
import AccountContainer from '../../containers/account_container'; | ||
import { fetchBlocks, expandBlocks } from '../../actions/blocks'; | ||
import { defineMessages, injectIntl } from 'react-intl'; | ||
|
||
const messages = defineMessages({ | ||
heading: { id: 'column.blocks', defaultMessage: 'Blocked' } | ||
}); | ||
|
||
const mapStateToProps = state => ({ | ||
accountIds: state.getIn(['user_lists', 'blocks', 'items']) | ||
}); | ||
|
||
const Blocks = React.createClass({ | ||
propTypes: { | ||
params: React.PropTypes.object.isRequired, | ||
dispatch: React.PropTypes.func.isRequired, | ||
accountIds: ImmutablePropTypes.list, | ||
intl: React.PropTypes.object.isRequired | ||
}, | ||
|
||
mixins: [PureRenderMixin], | ||
|
||
componentWillMount () { | ||
this.props.dispatch(fetchBlocks()); | ||
}, | ||
|
||
handleScroll (e) { | ||
const { scrollTop, scrollHeight, clientHeight } = e.target; | ||
|
||
if (scrollTop === scrollHeight - clientHeight) { | ||
this.props.dispatch(expandBlocks()); | ||
} | ||
}, | ||
|
||
render () { | ||
const { intl, accountIds } = this.props; | ||
|
||
if (!accountIds) { | ||
return ( | ||
<Column> | ||
<LoadingIndicator /> | ||
</Column> | ||
); | ||
} | ||
|
||
return ( | ||
<Column icon='users' heading={intl.formatMessage(messages.heading)}> | ||
<ColumnBackButtonSlim /> | ||
<ScrollContainer scrollKey='blocks'> | ||
<div className='scrollable' onScroll={this.handleScroll}> | ||
{accountIds.map(id => | ||
<AccountContainer key={id} id={id} /> | ||
)} | ||
</div> | ||
</ScrollContainer> | ||
</Column> | ||
); | ||
} | ||
}); | ||
|
||
export default connect(mapStateToProps)(injectIntl(Blocks)); |
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 was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,5 @@ | ||
class RemoveDevices < ActiveRecord::Migration[5.0] | ||
def change | ||
drop_table :devices | ||
end | ||
end |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.