• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

EcrituresNumeriques / stylo / 15281344514

27 May 2025 05:04PM UTC coverage: 37.39% (-0.2%) from 37.543%
15281344514

push

github

web-flow
chore: vérifie que l'article existe (#1521)

549 of 776 branches covered (70.75%)

Branch coverage included in aggregate %.

1 of 129 new or added lines in 5 files covered. (0.78%)

6 existing lines in 3 files now uncovered.

5319 of 14918 relevant lines covered (35.65%)

2.55 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/front/src/components/collaborative/CollaborativeEditor.jsx
1
import React from 'react'
×
2
import { useParams } from 'react-router'
×
3

NEW
4
import createReduxStore from '../../createReduxStore.js'
×
NEW
5
import { executeQuery } from '../../helpers/graphQL.js'
×
NEW
6
import { getUserProfile } from '../../helpers/user.js'
×
7

8
import ArticleStats from '../ArticleStats.jsx'
×
9
import CollaborativeEditorArticleHeader from './CollaborativeEditorArticleHeader.jsx'
×
10
import CollaborativeEditorMenu from './CollaborativeEditorMenu.jsx'
×
NEW
11
import CollaborativeTextEditor from './CollaborativeTextEditor.jsx'
×
12

NEW
13
import { getArticleInfo } from '../Article.graphql'
×
14

15
import styles from './CollaborativeEditor.module.scss'
×
16

NEW
17
const articleIdRx = /^[a-f\d]{24}$/i
×
18

NEW
19
export async function loader({ params }) {
×
NEW
20
  const { id: articleId } = params
×
NEW
21
  if (articleId && articleIdRx.test(articleId) === false) {
×
NEW
22
    const error = new Error()
×
NEW
23
    error.message = `Invalid article id ${articleId}`
×
NEW
24
    error.status = 404
×
NEW
25
    throw error
×
NEW
26
  }
×
NEW
27
  const store = createReduxStore()
×
NEW
28
  const { sessionToken } = store.getState()
×
NEW
29
  const { user } = await getUserProfile({ sessionToken })
×
NEW
30
  try {
×
NEW
31
    const result = await executeQuery({
×
NEW
32
      query: getArticleInfo,
×
NEW
33
      variables: { articleId },
×
NEW
34
      sessionToken,
×
NEW
35
    })
×
NEW
36
    return { user, result }
×
NEW
37
  } catch (err) {
×
NEW
38
    const errorMessage = err.messages?.[0]?.message ?? err.message
×
NEW
39
    const errorType = err.messages?.[0]?.extensions?.type
×
NEW
40
    if (errorType === 'NOT_FOUND') {
×
NEW
41
      const error = new Error()
×
NEW
42
      error.message = errorMessage
×
NEW
43
      error.status = 404
×
NEW
44
      throw error
×
NEW
45
    }
×
NEW
46
    throw err
×
NEW
47
  }
×
NEW
48
}
×
49

50
export default function CollaborativeEditor({ mode = 'write' }) {
×
51
  const { id: articleId, compareTo, version: versionId } = useParams()
×
52

53
  return (
×
54
    <section className={styles.container}>
×
55
      <div className={styles.editorArea}>
×
56
        <CollaborativeEditorArticleHeader
×
57
          articleId={articleId}
×
58
          versionId={versionId}
×
59
        />
×
60
        <CollaborativeTextEditor
×
61
          mode={mode}
×
62
          articleId={articleId}
×
63
          versionId={versionId}
×
64
        />
×
65
        <ArticleStats />
×
66
      </div>
×
67

68
      <CollaborativeEditorMenu
×
69
        className={styles.sidebarArea}
×
70
        articleId={articleId}
×
71
        versionId={versionId}
×
72
        compareTo={compareTo}
×
73
      />
×
74
    </section>
×
75
  )
76
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc