cleaner method chain per review

This commit is contained in:
blackcathacker
2017-10-31 16:50:35 -07:00
parent 5e7ee344ec
commit 21f6caa942
@@ -14,9 +14,11 @@ function isUserFlagged(actions) {
function getUserFlaggedType(actions) {
return actions
.filter((action) => action.__typename === 'FlagAction' && action.user)
.map((action) => action.user.roles.some((role) => staffRoles.includes(role)))
.some((staff) => staff) ? 'Staff' : 'User';
.some((action) =>
action.__typename === 'FlagAction' &&
action.user &&
action.user.roles.some((role) => staffRoles.includes(role))
) ? 'Staff' : 'User';
}
function hasSuspectedWords(actions) {