From 871aeaefff46582a4cfd2402e00c244862ffaf62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abou=20Konat=C3=A9?= <404554+steelstyle@users.noreply.github.com> Date: Fri, 30 Oct 2020 23:57:15 +0100 Subject: [PATCH 1/4] Uses HD thumbnail for opengraph when available. (#696) Co-authored-by: Benjamin Piouffle --- app/components/VideoDebate/index.jsx | 3 ++- app/lib/video_utils.js | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/components/VideoDebate/index.jsx b/app/components/VideoDebate/index.jsx index a02b6c993..ec5c18619 100644 --- a/app/components/VideoDebate/index.jsx +++ b/app/components/VideoDebate/index.jsx @@ -17,6 +17,7 @@ import { resetVideoDebate } from '../../state/video_debate/actions' import { ColumnVideo } from './ColumnVideo' import { ColumnDebate } from './ColumnDebate' import { videoURL, toAbsoluteURL } from '../../lib/cf_routes' +import { getHDThumbnailUrl } from '../../lib/video_utils' @connect( (state) => ({ @@ -55,7 +56,7 @@ export class VideoDebate extends React.PureComponent { renderMeta(video) { const title = `Vérification complète de : ${video.title}` - const image = video.thumbnail + const image = getHDThumbnailUrl(video) const description = `${video.title} vérifiée citation par citation par la communauté CaptainFact` return ( diff --git a/app/lib/video_utils.js b/app/lib/video_utils.js index 6761e3e0d..295473a7d 100644 --- a/app/lib/video_utils.js +++ b/app/lib/video_utils.js @@ -19,6 +19,17 @@ export const getTimecode = (videoPlayer, video, baseTimecode) => { return getTimecodesOffset(video, videoPlayer) + baseTimecode } +/** + * Returns HD thumbnail URL if any, otherwise returns the default thumbnail URL. + */ +export const getHDThumbnailUrl = (video) => { + if (video.youtube_id) { + return `https://img.youtube.com/vi/${video.youtube_id}/hqdefault.jpg` + } + + return video.thumbnail +} + export const THUMBNAILS_SIZES = { MEDIUM: 'MEDIUM', LARGE: 'LARGE', From 6ae3461bce8c8a2d3e38c2fdbc54c6ff943fa16e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 14 Nov 2020 18:12:49 +0100 Subject: [PATCH 2/4] chore(deps): [security] bump npm-user-validate from 1.0.0 to 1.0.1 (#697) Bumps [npm-user-validate](https://github.com/npm/npm-user-validate) from 1.0.0 to 1.0.1. **This update includes a security fix.** - [Release notes](https://github.com/npm/npm-user-validate/releases) - [Commits](https://github.com/npm/npm-user-validate/compare/v1.0.0...v1.0.1) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index da3d1a17d..7907a523c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17091,6 +17091,12 @@ "path-key": "^2.0.0" } }, + "npm-user-validate": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/npm-user-validate/-/npm-user-validate-1.0.1.tgz", + "integrity": "sha512-uQwcd/tY+h1jnEaze6cdX/LrhWhoBxfSknxentoqmIuStxUExxjWd3ULMLFPiFUrZKbOVMowH6Jq2FRWfmhcEw==", + "dev": true + }, "npm-which": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/npm-which/-/npm-which-3.0.1.tgz", @@ -18765,12 +18771,6 @@ } } }, - "npm-user-validate": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/npm-user-validate/-/npm-user-validate-1.0.0.tgz", - "integrity": "sha1-jOyg9c6gTU6TUZ73LQVXp1Ei6VE=", - "dev": true - }, "npmlog": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", From f6c0d8a8ce861dfbb556699121cecef9ce16f73b Mon Sep 17 00:00:00 2001 From: Benjamin Piouffle Date: Sat, 14 Nov 2020 18:20:09 +0100 Subject: [PATCH 3/4] set required reputation to add video to 75 (#701) --- app/constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/constants.js b/app/constants.js index d05f270bb..9316de888 100644 --- a/app/constants.js +++ b/app/constants.js @@ -54,7 +54,7 @@ export const MIN_REPUTATION_REMOVE_STATEMENT = 75 export const MIN_REPUTATION_RESTORE_ENTITY = 75 export const MIN_REPUTATION_REMOVE_SPEAKER = 75 export const MIN_REPUTATION_UPDATE_VIDEO = 75 -export const MIN_REPUTATION_ADD_VIDEO = 15 +export const MIN_REPUTATION_ADD_VIDEO = 75 export const MIN_REPUTATION_MODERATION = 125 /* ------ UI, animations ------ */ From 0f20810fe91a8c2a33a5d3e2c9f58e29fad4e739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abou=20Konat=C3=A9?= <404554+steelstyle@users.noreply.github.com> Date: Sat, 14 Nov 2020 18:21:35 +0100 Subject: [PATCH 4/4] Shows number of actions which are pending moderation. (#698) * Shows number of actions which are pending moderation. * Format code. * Merge mistake on format. * Fixes margin of menu tag. * enhancement(queries/ModerationCount): Add id to the fetch Co-authored-by: Benjamin Piouffle --- app/API/graphql_queries.js | 9 +++++++++ app/components/App/Sidebar.jsx | 22 +++++++++++++++++++--- app/styles/_components/App/sidebar.sass | 4 ++++ 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/app/API/graphql_queries.js b/app/API/graphql_queries.js index 8c3d18ab0..0267b227b 100644 --- a/app/API/graphql_queries.js +++ b/app/API/graphql_queries.js @@ -72,3 +72,12 @@ export const loggedInUserUnreadNotificationsCount = gql` } } ` + +export const loggedInUserPendingModerationCount = gql` + query LoggedInUserUnreadNotificationsCount { + loggedInUser { + id + actions_pending_moderation + } + } +` diff --git a/app/components/App/Sidebar.jsx b/app/components/App/Sidebar.jsx index adc46cd39..55f8ac9f2 100644 --- a/app/components/App/Sidebar.jsx +++ b/app/components/App/Sidebar.jsx @@ -1,8 +1,10 @@ import React from 'react' import { connect } from 'react-redux' import { Link } from 'react-router' +import { Query } from 'react-apollo' import { withNamespaces } from 'react-i18next' import classNames from 'classnames' +import { get } from 'lodash' import capitalize from 'voca/capitalize' import { Flex } from '@rebass/grid' @@ -15,12 +17,14 @@ import { Facebook } from 'styled-icons/fa-brands/Facebook' import { LinkExternal } from 'styled-icons/octicons/LinkExternal' +import { loggedInUserPendingModerationCount } from '../../API/graphql_queries' import { MOBILE_WIDTH_THRESHOLD, MIN_REPUTATION_MODERATION } from '../../constants' import RawIcon from '../Utils/RawIcon' import ReputationGuard from '../Utils/ReputationGuard' import { closeSidebar, toggleSidebar } from '../../state/user_preferences/reducer' import UserLanguageSelector from '../LoggedInUser/UserLanguageSelector' import ExternalLinkNewTab from '../Utils/ExternalLinkNewTab' +import Tag from '../Utils/Tag' @connect((state) => ({ sidebarExpended: state.UserPreferences.sidebarExpended }), { toggleSidebar, @@ -142,9 +146,21 @@ export default class Sidebar extends React.PureComponent { {capitalize(t('entities.video_plural'))} - - {t('menu.moderation')} - + + {({ data }) => { + const pendingCount = get(data, 'loggedInUser.actions_pending_moderation', 0) + return ( + + {t('menu.moderation')} + {pendingCount} + + ) + }} + ) diff --git a/app/styles/_components/App/sidebar.sass b/app/styles/_components/App/sidebar.sass index bcdc8d12b..a04d74200 100644 --- a/app/styles/_components/App/sidebar.sass +++ b/app/styles/_components/App/sidebar.sass @@ -43,6 +43,8 @@ $border-color: lightgrey .menu-content padding: 9px + & .tag + margin: 0 5px .link-with-icon > i width: 20px @@ -104,6 +106,8 @@ $border-color: lightgrey width: 100% &> span display: none + &> .tag + margin: 0 5px .connect-register-buttons margin-bottom: 5px