Commit 816492ca authored by Marek Veselý's avatar Marek Veselý
Browse files

Merge branch '615-overlay-injects-should-not-mark-channel-as-unread' into 'main'

fix: overlay check for questionnaires

Closes #615

See merge request inject/frontend!522
parents 425cbda5 f7f61467
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ import { useTypedQuery } from '@inject/graphql/graphql'
import { WriteReadReceipt } from '@inject/graphql/mutations.client'
import { GetSingleActionLog } from '@inject/graphql/queries'
import { useClient } from '@inject/graphql/urql/client'
import isOverlay from '@inject/graphql/utils/isOverlay'
import Message from '@inject/shared/components/Message'
import HeaderItem from '@inject/shared/components/Message/HeaderItem'
import Timestamp from '@inject/shared/components/StyledTag/Timestamp'
@@ -72,12 +73,6 @@ const InjectMessage: FC<InjectMessageProps> = ({
    }
  }, [actionLogSimple.id, client, initialReadReceipt])

  const showOverlay = useMemo(
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    () => inInstructor && actionLog && !!(actionLog.details as any)?.overlay,
    [actionLog, inInstructor]
  )

  const titleProps: EntityTitleProps = useMemo(
    () => ({
      icon: 'applications',
@@ -94,8 +89,8 @@ const InjectMessage: FC<InjectMessageProps> = ({
  return (
    <Message
      fill={fill}
      titleProps={showOverlay ? titleProps : undefined}
      warning={showOverlay}
      titleProps={isOverlay(actionLog) ? titleProps : undefined}
      warning={isOverlay(actionLog)}
      header={
        <>
          <HeaderItem>
+3 −3
Original line number Diff line number Diff line
@@ -61,12 +61,12 @@ const getContent = (actionLog: ActionLogFragment) => {
    case 'TeamQuestionnaireStateType':
      return actionLog.details.questionnaire.title
    case 'EmailType': {
      const senderId = actionLog.details.sender.id
      const senderAddress = actionLog.details.sender.address
      const recipients = actionLog.details.thread.participants
        .filter(participant => participant.id !== senderId)
        .filter(participant => participant.address !== senderAddress)
        .map(participant => participant.address)
        .join(', ')
      return `${actionLog.details.sender.address}${recipients}: ${textFromRenderedContent(actionLog.details.content.rendered)}`
      return `${senderAddress}${recipients}: ${textFromRenderedContent(actionLog.details.content.rendered)}`
    }
    default:
      throw new Error(`unknown actionLog type`)
+6 −0
Original line number Diff line number Diff line
@@ -137,6 +137,12 @@ export const ActionLogLookup = graphql(
        }
        ... on TeamQuestionnaireStateType {
          id
          questionnaire {
            id
            overlay {
              id
            }
          }
        }
      }
    }
+42 −38

File changed.

Preview size limit exceeded, changes collapsed.

+2 −2
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ import {
import { teamAction } from '../../subscriptions'
import { useClient } from '../../urql/client'
import type { ActionLogPayload } from '../../urql/events'
import isOverlay from '../isOverlay'
import useExerciseLoopStatusSubscription from '../useExerciseLoopStatusSubscription'
import { isInCurrentContext, useGenericActionLogEvent } from './utils'

@@ -64,8 +65,7 @@ const useActionLogSubscriptionTrainee = ({
      if (
        !actionLog.readReceipt &&
        !isInCurrentContext(actionLog) &&
        // eslint-disable-next-line @typescript-eslint/no-explicit-any
        !(actionLog.details as any)?.overlay &&
        !isOverlay(actionLog) &&
        !(
          actionLog.details.__typename === 'EmailType' &&
          actionLog.details.readReceipt
Loading