diff --git a/src/components/Actions/index.js b/src/components/Actions/index.js index a87c908..e6e6d1c 100644 --- a/src/components/Actions/index.js +++ b/src/components/Actions/index.js @@ -27,6 +27,7 @@ const Actions = ({ groupGuid, isFavourite, actionsComponent, + name, }) => { const [showActions, setShowActions] = useState(false) const tasks = useSelector(state => state.tasks) @@ -90,6 +91,7 @@ const Actions = ({ task_guid: guid, user_guid: userGuid, completion_status: COMPLETION_STATUS.COMPLETED, + group_leader_name: name, } await postMemberTaskEntry(update) setShowActions(false) diff --git a/src/components/ListItem/index.js b/src/components/ListItem/index.js index 9f31aa4..2d4835d 100644 --- a/src/components/ListItem/index.js +++ b/src/components/ListItem/index.js @@ -153,6 +153,7 @@ const ListItem = ({ actionsComponent={actionsComponent} userGuid={userGuid} groupGuid={groupGuid} + name={user.name} /> ))} diff --git a/src/components/Notifications/TaskNotification.js b/src/components/Notifications/TaskNotification.js index 6fe78a2..0b164cb 100644 --- a/src/components/Notifications/TaskNotification.js +++ b/src/components/Notifications/TaskNotification.js @@ -34,24 +34,14 @@ const getStateMessage = state => { const TaskNotification = ({ notification, markRead }) => { const itemsByGuid = useSelector(state => state.itemsByGuid) - const groups = useSelector(state => state.user.userGroups) const task = itemsByGuid[notification.item_guid] const timestamp = getTimestamp(notification.created_at) - const user = groups.reduce((cur, group) => { - if (cur) { - return cur - } - const found = group.members.find(member => { - return member.memberId.toString() === notification.created_by - }) - return found - }, null) return ( - Ryhmänjohtaja {user.memberName} on{' '} + Ryhmänjohtaja {notification.group_leader_name} on{' '} {getStateMessage(notification.notification_type)} tehtäväsi{' '}