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

CaptainFact / captain-fact-frontend / 12936416000

23 Jan 2025 08:45AM UTC coverage: 5.515% (-1.4%) from 6.953%
12936416000

push

github

Betree
chore: Migrate to tailwind

43 of 1641 branches covered (2.62%)

Branch coverage included in aggregate %.

6 of 301 new or added lines in 93 files covered. (1.99%)

93 existing lines in 38 files now uncovered.

192 of 2620 relevant lines covered (7.33%)

0.17 hits per line

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

0.0
/app/components/Utils/ReputationGuard.jsx
1
import PropTypes from 'prop-types'
2
import React from 'react'
3

4
import { withLoggedInUser } from '../LoggedInUser/UserProvider'
5
import { ErrorView } from './ErrorView'
6
import { LoadingFrame } from './LoadingFrame'
7

NEW
8
const DumbReputationGuard = ({
×
9
  loggedInUser,
10
  loggedInUserLoading,
11
  checkReputation,
12
  requiredRep,
13
  showLoading,
14
  showNotEnough,
15
  children,
16
  verifyFunc = null,
×
17
}) => {
18
  if (showLoading && loggedInUserLoading) {
×
19
    return <LoadingFrame />
×
20
  }
21

22
  const hasReputation = checkReputation(requiredRep)
×
23
  if (verifyFunc ? verifyFunc(loggedInUser, hasReputation) : hasReputation) {
×
24
    return children
×
25
  }
26

27
  return showNotEnough ? <ErrorView error="notEnoughReputation" /> : null
×
28
}
29

30
const ReputationGuard = withLoggedInUser(DumbReputationGuard)
×
31

32
ReputationGuard.propTypes = {
×
33
  requiredRep: PropTypes.number.isRequired,
34
  showLoading: PropTypes.bool,
35
  showNotEnough: PropTypes.bool,
36
  verifyFunc: PropTypes.func,
37
}
38

39
export const withReputationGuard =
40
  (requiredRep, showLoading = true, showNotEnough = true, props = {}) =>
×
41
  (WrappedComponent) =>
×
42
  (wrappedComponentProps) => (
×
43
    <ReputationGuard
×
44
      requiredRep={requiredRep}
45
      showLoading={showLoading}
46
      showNotEnough={showNotEnough}
47
      {...props}
48
    >
49
      <WrappedComponent {...wrappedComponentProps} />
50
    </ReputationGuard>
51
  )
52

53
export default ReputationGuard
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