Seperating username and bio flags

This commit is contained in:
David Jay
2017-01-04 16:11:31 -05:00
parent 7a239c02ab
commit 9ba0176b3c
4 changed files with 7 additions and 7 deletions
@@ -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>
);
+5 -2
View File
@@ -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));
+1 -1
View File
@@ -52,7 +52,7 @@ class FlagButton extends Component {
break;
}
const action = {
action_type: 'flag',
action_type: `flag_${field}`,
metadata: {
field,
reason,
-3
View File
@@ -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'
},