Skip to content

Commit

Permalink
Merge pull request #154 from CaptainFact/staging
Browse files Browse the repository at this point in the history
Release 0.8.12
  • Loading branch information
Betree authored Jul 19, 2018
2 parents eae2033 + a5efd7b commit e6e9a0a
Show file tree
Hide file tree
Showing 59 changed files with 6,977 additions and 6,854 deletions.
6 changes: 5 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>

WORKDIR /opt/app
Expand Down
23 changes: 12 additions & 11 deletions app/assets/assets/help/en/privileges.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
23 changes: 12 additions & 11 deletions app/assets/assets/help/fr/privileges.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion app/assets/assets/help/fr/reputation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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...

Expand Down
6 changes: 3 additions & 3 deletions app/components/Utils/__tests__/Icon.spec.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Icon from '../Icon'

test('render icon', () => {
snapshot(<Icon name="plus"/>)
snapshotComponent(<Icon name="plus"/>)
})

test('set size', () => {
snapshot(<Icon name="plus" size="large"/>)
snapshotComponent(<Icon name="plus" size="large"/>)
})

test('other props get passed to container', () => {
snapshot(<Icon name="plus" title="Add some stuff"/>)
snapshotComponent(<Icon name="plus" title="Add some stuff"/>)
})
8 changes: 4 additions & 4 deletions app/components/Utils/__tests__/Message.spec.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import Message from '../Message'

test('render message', () => {
snapshot(<Message>Hello</Message>)
snapshotComponent(<Message>Hello</Message>)
})

test('can set type', () => {
snapshot(<Message type="warning">Alert !</Message>)
snapshotComponent(<Message type="warning">Alert !</Message>)
})

test('can set header', () => {
snapshot(<Message header="Awesome title">Hellooow</Message>)
snapshotComponent(<Message header="Awesome title">Hellooow</Message>)
})

test('without body', () => {
snapshot(<Message/>)
snapshotComponent(<Message/>)
})
8 changes: 4 additions & 4 deletions app/components/Utils/__tests__/Notification.spec.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import Notification from '../Notification'

test('render message', () => {
snapshot(<Notification>Hello</Notification>)
snapshotComponent(<Notification>Hello</Notification>)
})

test('can set type', () => {
snapshot(<Notification type="warning">Alert !</Notification>)
snapshotComponent(<Notification type="warning">Alert !</Notification>)
})

test('pass props', () => {
snapshot(<Notification title="my title">Hellooow</Notification>)
snapshotComponent(<Notification title="my title">Hellooow</Notification>)
})

test('without body', () => {
snapshot(<Notification/>)
snapshotComponent(<Notification/>)
})
2 changes: 1 addition & 1 deletion app/components/Utils/__tests__/RawIcon.spec.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import RawIcon from '../RawIcon'

test('render icon', () => {
snapshot(<RawIcon name="plus"/>)
snapshotComponent(<RawIcon name="plus"/>)
})
4 changes: 2 additions & 2 deletions app/components/Utils/__tests__/Tag.spec.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Tag from '../Tag'

test('render tag', () => {
snapshot(<Tag>Test</Tag>)
snapshotComponent(<Tag>Test</Tag>)
})

test('set size', () => {
snapshot(<Tag type="info">Test</Tag>)
snapshotComponent(<Tag type="info">Test</Tag>)
})
7 changes: 4 additions & 3 deletions app/components/Videos/AddVideoForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
})
Expand Down
16 changes: 7 additions & 9 deletions app/components/Videos/FilterOnlyFromPartners.jsx
Original file line number Diff line number Diff line change
@@ -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 }) => (
<div className="select">
<select
value={value ? PARTNERS_KEY : USERS_KEY}
onChange={e => onChange(e.target.value === PARTNERS_KEY)}
value={value}
onChange={e => onChange(e.target.value)}
>
<option value={PARTNERS_KEY}>{t(PARTNERS_KEY)}</option>
<option value={USERS_KEY}>{t(USERS_KEY)}</option>
<option value={ALL_VIDEOS}>{t('all')}</option>
<option value={ONLY_PARTNERS}>{t('partners')}</option>
<option value={ONLY_COMMUNITY}>{t('users')}</option>
</select>
</div>
)
Expand Down
34 changes: 20 additions & 14 deletions app/components/Videos/PublicVideos.jsx
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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() {
Expand All @@ -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())
}
}
Expand All @@ -46,12 +46,12 @@ export class PublicVideos extends React.PureComponent {
<div className="videos-page">
<section className="header">
<h2 className="title is-2">
<Icon name="television"/>
<Icon name="television" />
<span> {capitalize(this.props.t('entities.video_plural'))}</span>
</h2>
<ReputationGuard requiredRep={MIN_REPUTATION_ADD_VIDEO}>
<Link to="/videos/add" className="button is-primary">
<Icon name="plus-circle"/>
<Icon name="plus-circle" />
<span>{this.props.t('videos.add')}</span>
</Link>
</ReputationGuard>
Expand All @@ -65,7 +65,7 @@ export class PublicVideos extends React.PureComponent {
renderFilterBar() {
return (
<nav className="level videos-filter">
<div className="level-left"/>
<div className="level-left" />
<div className="level-right">
<div className="filter">
<span>Source:</span>
Expand Down Expand Up @@ -94,11 +94,11 @@ export class PublicVideos extends React.PureComponent {
if (this.props.isLoading)
return <LoadingFrame />
else if (this.props.error)
return <ErrorView error={this.props.error}/>
return <ErrorView error={this.props.error} />
else if (this.props.videos.size === 0)
return <h2>{this.props.t('errors:client.noVideoAvailable')}</h2>

return <VideosGrid videos={this.props.videos}/>
return <VideosGrid videos={this.props.videos} />
}

onVideosFilterChange(value) {
Expand All @@ -107,10 +107,16 @@ export class PublicVideos extends React.PureComponent {
}

buildFilters() {
const {languageFilter, onlyFromPartners} = this.props
const filters = {is_partner: onlyFromPartners}
if (languageFilter)
filters.language = languageFilter
return filters
const { languageFilter, onlyFromPartners } = this.props

const partnerFilter = {
[ALL_VIDEOS]: {},
[ONLY_PARTNERS]: { is_partner: true },
[ONLY_COMMUNITY]: { is_partner: false }
}[onlyFromPartners]

const languageVideosFilter = languageFilter ? { language: languageFilter } : {}

return merge({}, partnerFilter, languageVideosFilter)
}
}
Loading

0 comments on commit e6e9a0a

Please sign in to comment.