Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new video hash_id field #200

Merged
merged 2 commits into from
Aug 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/components/Statements/StatementHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default translate('videoDebate')(({
<div className="card-header-icon">
<ReputationGuardTooltip
requiredRep={MIN_REPUTATION_REMOVE_STATEMENT}
tooltipPosition="left"
tooltipPosition="left center"
>
{({hasReputation}) => (
<ClickableIcon
Expand All @@ -41,7 +41,7 @@ export default translate('videoDebate')(({
</ReputationGuardTooltip>
<ReputationGuardTooltip
requiredRep={MIN_REPUTATION_UPDATE_STATEMENT}
tooltipPosition="left"
tooltipPosition="left center"
>
{({hasReputation}) => (
<ClickableIcon
Expand Down
5 changes: 3 additions & 2 deletions app/components/VideoDebate/ColumnVideo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import ReputationGuardTooltip from '../Utils/ReputationGuardTooltip'
import VideoDebatePlayer from './VideoDebatePlayer'
import Presence from './Presence'
import ExternalLinkNewTab from '../Utils/ExternalLinkNewTab'
import { videoURL, videoHistoryURL } from '../../lib/cf_routes'


@connect(state => ({
Expand Down Expand Up @@ -41,13 +42,13 @@ export class ColumnVideo extends React.PureComponent {
<div className="tabs is-toggle is-fullwidth">
<ul>
<li className={classNames({'is-active': isDebate})}>
<Link to={`/videos/${video.id}`}>
<Link to={videoURL(video.hash_id)}>
<Icon size="small" name="check-circle"/>
<span>{ t('debate') }</span>
</Link>
</li>
<li className={classNames({'is-active': !isDebate})}>
<Link to={`/videos/${video.id}/history`}>
<Link to={videoHistoryURL(video.hash_id)}>
<Icon size="small" name="history"/>
<span>{ t('history') }</span>
</Link>
Expand Down
8 changes: 5 additions & 3 deletions app/components/Videos/VideoCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,22 @@ import { Icon, TimeSince } from '../Utils'
import iterateWithSeparators from '../../lib/iterate_with_separators'
import CardLayout from '../Utils/CardLayout'
import RawIcon from '../Utils/RawIcon'
import { videoURL } from '../../lib/cf_routes'


@translate('videoDebate')
export class VideoCard extends React.PureComponent {
render() {
const { t, video } = this.props
const { id, title, provider, provider_id } = video
const { hash_id, title, provider, provider_id } = video
const linkTarget = videoURL(hash_id)

return (
<div className="column is-one-quarter">
<CardLayout
className="video-card"
image={(
<Link to={`/videos/${id}`}>
<Link to={linkTarget}>
<div className="play-overlay">
<RawIcon name="play-circle"/>
</div>
Expand All @@ -29,7 +31,7 @@ export class VideoCard extends React.PureComponent {
</Link>
)}
content={(
<Link to={`/videos/${id}`}>
<Link to={linkTarget}>
<h4 className="title is-5">
{ title }
</h4>
Expand Down
2 changes: 2 additions & 0 deletions app/lib/cf_routes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export const videoURL = videoHashID => `/videos/${videoHashID}`

export const videoHistoryURL = videoHashID => `${videoURL(videoHashID)}/history`

export const statementURL = (videoHashID, statementID) => `${videoURL(videoHashID)}?statement=${statementID}`

export const speakerURL = speakerIDOrSlug => `/s/${speakerIDOrSlug}`
12 changes: 8 additions & 4 deletions app/state/videos/__tests__/__fixtures__/videos.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"posted_at": "2017-12-03T09:07:34.600875",
"language": "fr",
"is_partner": false,
"id": "Gyvg"
"hash_id": "Gyvg",
"id": 4
},
{
"url": "https://www.youtube.com/watch?v=JDRzEdRQF5s",
Expand Down Expand Up @@ -57,7 +58,8 @@
"posted_at": "2017-11-15T11:08:20.616949",
"language": "fr",
"is_partner": false,
"id": "GRjG"
"hash_id": "GRjG",
"id": 3
},
{
"url": "https://www.youtube.com/watch?v=QS951xiGGvI",
Expand Down Expand Up @@ -87,7 +89,8 @@
"posted_at": "2017-11-07T19:39:41.969945",
"language": "fr",
"is_partner": false,
"id": "G3j4"
"hash_id": "G3j4",
"id": 2
},
{
"url": "https://www.youtube.com/watch?v=TxHqU0ICDr4",
Expand Down Expand Up @@ -117,6 +120,7 @@
"posted_at": "2017-10-31T09:32:41.199113",
"language": "fr",
"is_partner": false,
"id": "Jzqg"
"hash_id": "Jzqg",
"id": 1
}
]
12 changes: 8 additions & 4 deletions app/state/videos/__tests__/__snapshots__/reducer.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ Immutable.Record {
"error": null,
"data": Immutable.List [
Immutable.Record {
"id": "Gyvg",
"id": 4,
"hash_id": "Gyvg",
"posted_at": 2017-12-03T09:07:34.600Z,
"provider": "youtube",
"provider_id": "8xL6XxKTieA",
Expand Down Expand Up @@ -145,7 +146,8 @@ Immutable.Record {
"is_partner": false,
},
Immutable.Record {
"id": "GRjG",
"id": 3,
"hash_id": "GRjG",
"posted_at": 2017-11-15T11:08:20.616Z,
"provider": "youtube",
"provider_id": "JDRzEdRQF5s",
Expand Down Expand Up @@ -175,7 +177,8 @@ Immutable.Record {
"is_partner": false,
},
Immutable.Record {
"id": "G3j4",
"id": 2,
"hash_id": "G3j4",
"posted_at": 2017-11-07T19:39:41.969Z,
"provider": "youtube",
"provider_id": "QS951xiGGvI",
Expand Down Expand Up @@ -205,7 +208,8 @@ Immutable.Record {
"is_partner": false,
},
Immutable.Record {
"id": "Jzqg",
"id": 1,
"hash_id": "Jzqg",
"posted_at": 2017-10-31T09:32:41.199Z,
"provider": "youtube",
"provider_id": "TxHqU0ICDr4",
Expand Down
1 change: 1 addition & 0 deletions app/state/videos/record.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Record, List } from 'immutable'

const Video = new Record({
id: 0,
hash_id: null,
posted_at: 0,
provider: '',
provider_id: 0,
Expand Down