Add some UI for user-defined domain blocks (#6628)
* Keep list of blocked domains Might be overkill, but I'm trying to follow the same logic as for blocked users * Add basic domain block UI * Add the domain blocks UI to Getting Started * Fix undefined URL in `fetchDomainBlocks` * Update all known users' domain_blocking relationship instead of just one's
This commit is contained in:
parent
47cee7cc8e
commit
a6c129ddbd
13 changed files with 271 additions and 17 deletions
|
@ -23,6 +23,14 @@ const normalizeRelationships = (state, relationships) => {
|
|||
return state;
|
||||
};
|
||||
|
||||
const setDomainBlocking = (state, accounts, blocking) => {
|
||||
return state.withMutations(map => {
|
||||
accounts.forEach(id => {
|
||||
map.setIn([id, 'domain_blocking'], blocking);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const initialState = ImmutableMap();
|
||||
|
||||
export default function relationships(state = initialState, action) {
|
||||
|
@ -37,9 +45,9 @@ export default function relationships(state = initialState, action) {
|
|||
case RELATIONSHIPS_FETCH_SUCCESS:
|
||||
return normalizeRelationships(state, action.relationships);
|
||||
case DOMAIN_BLOCK_SUCCESS:
|
||||
return state.setIn([action.accountId, 'domain_blocking'], true);
|
||||
return setDomainBlocking(state, action.accounts, true);
|
||||
case DOMAIN_UNBLOCK_SUCCESS:
|
||||
return state.setIn([action.accountId, 'domain_blocking'], false);
|
||||
return setDomainBlocking(state, action.accounts, false);
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue