mirror of
https://github.com/wassname/talk.git
synced 2026-07-05 19:59:34 +08:00
Seperating username and bio flags
This commit is contained in:
@@ -53,7 +53,7 @@ const UserAction = props => {
|
||||
</div>
|
||||
}
|
||||
<div className={styles.flagCount}>
|
||||
{`${action.count} ${lang.t('user.bio_flags')}`}
|
||||
{`${action.count} ${action.action_type === 'flag_bio' ? lang.t('user.bio_flags') : lang.t('user.username_flags')}`}
|
||||
</div>
|
||||
</li>
|
||||
);
|
||||
|
||||
@@ -15,9 +15,12 @@ export default (state = initialState, action) => {
|
||||
};
|
||||
|
||||
const addActions = (state, action) => {
|
||||
const ids = action.actions.map(action => action.item_id);
|
||||
|
||||
// Make ids that are unique by item_id and by action type
|
||||
const typeId = (action) => `${action.action_type}_${action.item_id}`;
|
||||
const ids = action.actions.map(action => typeId(action));
|
||||
const map = action.actions.reduce((memo, action) => {
|
||||
memo[action.item_id] = action;
|
||||
memo[typeId(action)] = action;
|
||||
return memo;
|
||||
}, {});
|
||||
return state.set('byId', fromJS(map)).set('ids', new Set(ids));
|
||||
|
||||
@@ -52,7 +52,7 @@ class FlagButton extends Component {
|
||||
break;
|
||||
}
|
||||
const action = {
|
||||
action_type: 'flag',
|
||||
action_type: `flag_${field}`,
|
||||
metadata: {
|
||||
field,
|
||||
reason,
|
||||
|
||||
@@ -134,9 +134,6 @@ ActionSchema.statics.getActionSummaries = function(item_ids, current_user_id = '
|
||||
item_type: {
|
||||
$last: '$item_type'
|
||||
},
|
||||
metadata: {
|
||||
$push: '$metadata'
|
||||
},
|
||||
created_at: {
|
||||
$min: '$created_at'
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user