diff --git a/.eslintrc.yml b/.eslintrc.yml index 0f7b095ff..24fba74b0 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -95,6 +95,10 @@ rules: react/react-in-jsx-scope: off # Generates erros in tests react/sort-comp: off react/require-default-props: off + react/jsx-one-expression-per-line: off globals: - snapshot: false # For tests + # For tests + snapshot: false + snapshotReducer: false + snapshotComponent: false diff --git a/Dockerfile b/Dockerfile index c7e831ed9..f0e73d126 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # CaptainFact frontend container # You must attach a volume containing cert.pem + privkey.pem at /etc/nginx/cert/ -FROM betree/centos-nginx-nodejs-brunch-sass:latest +FROM betree/centos-nginx-nodejs-sass:latest MAINTAINER Benjamin Piouffle WORKDIR /opt/app diff --git a/app/assets/assets/help/en/privileges.md b/app/assets/assets/help/en/privileges.md index 7e268585a..191a40fb0 100644 --- a/app/assets/assets/help/en/privileges.md +++ b/app/assets/assets/help/en/privileges.md @@ -16,17 +16,18 @@ Judgement actions such as voting and flagging are limited to avoid abusing them | 0 | Create statements | 0 | Vote Up | 15 | Vote Down -| 30 | Update statement -| 75 | Add / create speakers -| 75 | Update speaker -| 75 | Flag inappropriate content -| 125 | Remove / restore statement -| 125 | No more new user restrictions -| 200 | Shift all video's statements -| 200 | Remove / restore speaker -| 200 | Add videos (weekly limitation) -| 200 | Access to the moderation platform - +| 15 | Update statement +| 15 | Update speaker +| 15 | Flag inappropriate content +| 30 | Add / create speakers +| 75 | Remove / restore statement +| 75 | Shift all video's statements +| 75 | Remove speaker +| 125 | No more new user restrictions +| 125 | Access to the moderation platform +| 125 | Restore speaker +| 200 | Add videos (weekly limitation) +| 200 | Self-vote # New user restrictions diff --git a/app/assets/assets/help/fr/privileges.md b/app/assets/assets/help/fr/privileges.md index 3ea4f29a5..e37b0b29d 100644 --- a/app/assets/assets/help/fr/privileges.md +++ b/app/assets/assets/help/fr/privileges.md @@ -16,17 +16,18 @@ renforcer leur signification. | 0 | Ajouter des citations | 0 | Voter positivement | 15 | Voter négativement -| 30 | Mettre à jour une citation -| 75 | Ajouter ou créer des intervenants -| 75 | Mettre à jour un intervenant -| 75 | Signaler un contenu inapproprié -| 125 | Supprimer / restaurer une citation -| 125 | Plus de restrictions spécifiques aux nouveaux utilisateurs -| 200 | Déplacer toutes les citations d'une vidéo (time shift) -| 200 | Supprimer / restaurer un intervenant -| 200 | Ajouter une vidéo -| 200 | Accès aux outils de modération - +| 15 | Mettre à jour une citation +| 15 | Mettre à jour un intervenant +| 15 | Signaler un contenu inapproprié +| 30 | Ajouter ou créer des intervenants +| 75 | Supprimer / restaurer une citation +| 75 | Déplacer toutes les citations d'une vidéo (time shift) +| 75 | Supprimer un intervenant +| 125 | Moins de restrictions spécifiques aux nouveaux utilisateurs +| 125 | Accès aux outils de modération collective +| 125 | Restaurer un intervenant +| 200 | Ajouter une vidéo (limitation hebdomadaire) +| 200 | Voter pour soi-même # Restrictions spécifiques aux nouveaux utilisateurs diff --git a/app/assets/assets/help/fr/reputation.md b/app/assets/assets/help/fr/reputation.md index 97aff0e00..76e0059ed 100644 --- a/app/assets/assets/help/fr/reputation.md +++ b/app/assets/assets/help/fr/reputation.md @@ -24,7 +24,7 @@ montée du nombre d'utilisateurs. | Un de vos commentaires recoit un vote positif | +2pts | Un de vos commentaires **sourcé** recoit un vote positif | +3pts | Quelqu'un approuve une de vos modifications dans l'historique | +5pts -| Un de vos signalements est comfirmé | +3pts +| Un de vos signalements est confirmé | +3pts # Vous perdez de la réputation quand... diff --git a/app/components/Utils/__tests__/Icon.spec.jsx b/app/components/Utils/__tests__/Icon.spec.jsx index 01594b67a..1adfec9ab 100644 --- a/app/components/Utils/__tests__/Icon.spec.jsx +++ b/app/components/Utils/__tests__/Icon.spec.jsx @@ -1,13 +1,13 @@ import Icon from '../Icon' test('render icon', () => { - snapshot() + snapshotComponent() }) test('set size', () => { - snapshot() + snapshotComponent() }) test('other props get passed to container', () => { - snapshot() + snapshotComponent() }) diff --git a/app/components/Utils/__tests__/Message.spec.jsx b/app/components/Utils/__tests__/Message.spec.jsx index 14bb45b17..f66044148 100644 --- a/app/components/Utils/__tests__/Message.spec.jsx +++ b/app/components/Utils/__tests__/Message.spec.jsx @@ -1,17 +1,17 @@ import Message from '../Message' test('render message', () => { - snapshot(Hello) + snapshotComponent(Hello) }) test('can set type', () => { - snapshot(Alert !) + snapshotComponent(Alert !) }) test('can set header', () => { - snapshot(Hellooow) + snapshotComponent(Hellooow) }) test('without body', () => { - snapshot() + snapshotComponent() }) diff --git a/app/components/Utils/__tests__/Notification.spec.jsx b/app/components/Utils/__tests__/Notification.spec.jsx index d41df9708..0b768ed34 100644 --- a/app/components/Utils/__tests__/Notification.spec.jsx +++ b/app/components/Utils/__tests__/Notification.spec.jsx @@ -1,17 +1,17 @@ import Notification from '../Notification' test('render message', () => { - snapshot(Hello) + snapshotComponent(Hello) }) test('can set type', () => { - snapshot(Alert !) + snapshotComponent(Alert !) }) test('pass props', () => { - snapshot(Hellooow) + snapshotComponent(Hellooow) }) test('without body', () => { - snapshot() + snapshotComponent() }) diff --git a/app/components/Utils/__tests__/RawIcon.spec.jsx b/app/components/Utils/__tests__/RawIcon.spec.jsx index b5e5be948..2b162c530 100644 --- a/app/components/Utils/__tests__/RawIcon.spec.jsx +++ b/app/components/Utils/__tests__/RawIcon.spec.jsx @@ -1,5 +1,5 @@ import RawIcon from '../RawIcon' test('render icon', () => { - snapshot() + snapshotComponent() }) diff --git a/app/components/Utils/__tests__/Tag.spec.jsx b/app/components/Utils/__tests__/Tag.spec.jsx index 7acf45b12..02462dff2 100644 --- a/app/components/Utils/__tests__/Tag.spec.jsx +++ b/app/components/Utils/__tests__/Tag.spec.jsx @@ -1,9 +1,9 @@ import Tag from '../Tag' test('render tag', () => { - snapshot(Test) + snapshotComponent(Test) }) test('set size', () => { - snapshot(Test) + snapshotComponent(Test) }) diff --git a/app/components/Videos/AddVideoForm.jsx b/app/components/Videos/AddVideoForm.jsx index 0bc9034d4..6d346135b 100644 --- a/app/components/Videos/AddVideoForm.jsx +++ b/app/components/Videos/AddVideoForm.jsx @@ -20,15 +20,16 @@ const validate = ({ url }) => { @withRouter @connect((state, props) => ({ - initialValues: {url: props.params.videoUrl}, + initialValues: {url: props.params.videoUrl || props.location.query.url}, isSubmitting: state.Videos.isSubmitting, isAuthenticated: isAuthenticated(state) }), {postVideo, searchVideo}) @reduxForm({form: 'AddVideo', validate}) export class AddVideoForm extends React.PureComponent { componentDidMount() { - if (this.props.params.videoUrl) { - this.props.searchVideo(decodeURI(this.props.params.videoUrl)).then(action => { + const videoUrl = this.props.params.videoUrl || this.props.location.query.url + if (videoUrl) { + this.props.searchVideo(decodeURI(videoUrl)).then(action => { if (!action.error && action.payload !== null) this.props.router.push(`/videos/${action.payload.id}`) }) diff --git a/app/components/Videos/FilterOnlyFromPartners.jsx b/app/components/Videos/FilterOnlyFromPartners.jsx index a47bdcf80..02b1ad2e1 100644 --- a/app/components/Videos/FilterOnlyFromPartners.jsx +++ b/app/components/Videos/FilterOnlyFromPartners.jsx @@ -1,18 +1,16 @@ import React from 'react' import { translate } from 'react-i18next' +import { ALL_VIDEOS, ONLY_PARTNERS, ONLY_COMMUNITY } from '../../constants' - -const PARTNERS_KEY = 'partners' -const USERS_KEY = 'users' - -const FilterOnlyFromPartners = ({value, onChange, t}) => ( +const FilterOnlyFromPartners = ({ value, onChange, t }) => (
) diff --git a/app/components/Videos/PublicVideos.jsx b/app/components/Videos/PublicVideos.jsx index 1d8c6f569..92987cc74 100644 --- a/app/components/Videos/PublicVideos.jsx +++ b/app/components/Videos/PublicVideos.jsx @@ -1,11 +1,11 @@ import React from 'react' -import { Map } from 'immutable' +import { merge, Map } from 'immutable' import { connect } from 'react-redux' import { Link } from 'react-router' import { translate } from 'react-i18next' import capitalize from 'voca/capitalize' -import { MIN_REPUTATION_ADD_VIDEO } from '../../constants' +import { MIN_REPUTATION_ADD_VIDEO, ALL_VIDEOS, ONLY_PARTNERS, ONLY_COMMUNITY } from '../../constants' import ReputationGuard from '../Utils/ReputationGuard' import { VideosGrid } from '../Videos' import { LoadingFrame, Icon } from '../Utils' @@ -23,7 +23,7 @@ import FilterOnlyFromPartners from './FilterOnlyFromPartners' error: state.Videos.error, languageFilter: state.UserPreferences.videosLanguageFilter, onlyFromPartners: state.UserPreferences.videosOnlyFromPartners, -}), {fetchPublicVideos, reset, changeVideosLanguageFilter, setVideosOnlyFromPartners}) +}), { fetchPublicVideos, reset, changeVideosLanguageFilter, setVideosOnlyFromPartners }) @translate('main') export class PublicVideos extends React.PureComponent { componentDidMount() { @@ -36,7 +36,7 @@ export class PublicVideos extends React.PureComponent { componentDidUpdate(oldProps) { if (oldProps.languageFilter !== this.props.languageFilter || - oldProps.onlyFromPartners !== this.props.onlyFromPartners) { + oldProps.onlyFromPartners !== this.props.onlyFromPartners) { this.props.fetchPublicVideos(this.buildFilters()) } } @@ -46,12 +46,12 @@ export class PublicVideos extends React.PureComponent {

- + {capitalize(this.props.t('entities.video_plural'))}

- + {this.props.t('videos.add')} @@ -65,7 +65,7 @@ export class PublicVideos extends React.PureComponent { renderFilterBar() { return (