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

Release 0.8.10 #125

Merged
merged 45 commits into from
May 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
f3ffb2e
Integrate ESLint with soft values
Betree Apr 13, 2018
4b060d8
[+] Initial webpack config and required plugins
NGambini Apr 16, 2018
e9eab32
[+] Bundling javascript - first version
NGambini Apr 18, 2018
6a9a8a0
[+] Working SASS bundle
NGambini Apr 18, 2018
24c0231
[+] Copying images with CopyWebpackPlugin
NGambini Apr 19, 2018
3b69626
[+] Splitting vendor file
NGambini Apr 20, 2018
e0c7982
[+] Gzipping webpack bundles
NGambini Apr 21, 2018
de0c65d
[+] Improved bundle size and production config, also added comments
NGambini Apr 21, 2018
0415733
[~] Auto opening new tab on webpack start
NGambini Apr 21, 2018
ee4b436
[+] Chunkhash was missing in app.css
NGambini Apr 22, 2018
37f6829
[~] Changing package.json scripts
NGambini Apr 22, 2018
1756763
[~] Switched the cleanup plugin to a maintained one
NGambini Apr 22, 2018
d173212
[-] Removed brunch dependencies
NGambini Apr 23, 2018
d244791
change constants to allow 255 characters length in comments
najeal Apr 24, 2018
fb5391f
Webpack dotenv setup
NGambini May 1, 2018
00238e9
Fix CI by removing ReputationGuard spec
Betree May 2, 2018
4b53267
Add missing package
Betree May 2, 2018
c16737e
Adapt env build
Betree May 3, 2018
9f9996e
Add test config
Betree May 3, 2018
c350aef
Fix CI build
Betree May 3, 2018
50706e8
Merge pull request #113 from CaptainFact/improvement/webpack
Betree May 3, 2018
2d1f0f1
Fix previous build error included in webpack merge, add locale to inv…
Betree May 3, 2018
8176d6c
Add discord link to verification Inteface
Betree May 7, 2018
c4097e0
Add security.txt - see http://securitytxt.org for more info
Betree May 7, 2018
dab33bf
Merge pull request #115 from CaptainFact/feature/security-txt
Betree May 7, 2018
019a51a
Merge pull request #114 from CaptainFact/feature/discord-link
Betree May 7, 2018
1d1ac61
Patch updates
Betree May 7, 2018
8ea96ee
Minor updates and remove version from font import
Betree May 7, 2018
6d82940
Merge pull request #116 from CaptainFact/improvement/update-dependencies
Betree May 7, 2018
4ae2e32
Fix eslinter
Betree May 8, 2018
e26cb5f
[#117] - Fonts and other assets are not included in build with new we…
fbn-ngambini May 15, 2018
c2cd247
GZip compress html files
Betree May 15, 2018
348b98a
Add fonts versionning
Betree May 15, 2018
0c349d0
Add missing file-loader dependency
Betree May 15, 2018
1b08206
Add missing url-loader dependency
Betree May 15, 2018
b51e734
Merge pull request #118 from CaptainFact/fix/webpackCopyPlugin
Betree May 15, 2018
8bf1ddb
SASS hot reload + CSS minify
Betree May 15, 2018
d7e1dde
Merge pull request #120 from CaptainFact/improvement/sass-hmr
Betree May 15, 2018
0481080
Add Ambassadors Discord link to help pages + small fix in contributio…
Betree May 15, 2018
37e827a
Merge pull request #121 from CaptainFact/improvement/help-pages
Betree May 15, 2018
1b1f7df
Merge pull request #122 from CaptainFact/improvement/change-comment-l…
Betree May 16, 2018
798023f
Eslint enforcement (#123)
Betree May 18, 2018
2e92325
Add filter for partners videos (#124)
Betree May 18, 2018
8ee864d
Bump version to 0.8.10
Betree May 18, 2018
f39de14
Fix bundles public path
Betree May 18, 2018
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
1 change: 1 addition & 0 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"presets": ["es2015", "react"],
"plugins": [
"transform-decorators-legacy",
"transform-runtime",
"transform-class-properties",
"transform-object-rest-spread",
["inline-json-import", {}]
Expand Down
100 changes: 100 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
env:
browser: true
es6: true
jest: true
node: true
extends: 'airbnb'
parser: babel-eslint
parserOptions:
ecmaFeatures:
experimentalObjectRestSpread: true
jsx: true
sourceType: module
plugins:
- react
- jsx-a11y
- import
rules:
max-len:
- warn
- code: 85
ignoreStrings: true
ignoreTemplateLiterals: true
ignoreRegExpLiterals: true
indent: ['warn', 2]
linebreak-style: ['error', 'unix']
quotes: ['warn', 'single', {avoidEscape: true}]
semi: ['error', 'never']
import/first: ['warn']
no-trailing-spaces: ['warn']
no-continue: off
no-plusplus: off
radix: off
eol-last: ['warn']
no-nested-ternary: ['warn']
prefer-const: ['warn']
import/no-named-as-default: ['warn']
no-restricted-globals: ["error", "event", "fdescribe"]
no-mixed-operators: ['warn']
react/no-multi-comp: ['warn']
react/jsx-no-bind: ['warn']
react/jsx-indent-props: ['warn']
react/jsx-first-prop-new-line: ['warn']
react/jsx-closing-bracket-location: ['warn']
react/jsx-curly-spacing: ['warn']
react/jsx-tag-spacing: ['warn', {beforeSelfClosing: 'allow'}]
react/jsx-wrap-multilines: ['warn']
react/no-unused-state: ['warn']
react/jsx-max-props-per-line: ['warn', {when: 'multiline'}]
react/jsx-closing-tag-location: ['warn']
react/no-unescaped-entities: ['warn']
react/no-unused-prop-types: ['warn']
react/self-closing-comp: ['warn']
react/jsx-indent: ['warn']
react/no-array-index-key: ['warn']
jsx-a11y/anchor-is-valid:
- warn
- components: ['Link']
specialLink: ['To']
jsx-a11y/alt-text: ['warn']
jsx-a11y/label-has-for: ['warn']
jsx-a11y/click-events-have-key-events: ['warn']
jsx-a11y/no-static-element-interactions: ['warn']
jsx-a11y/media-has-caption: ['warn']
jsx-a11y/anchor-has-content: off

# Following rule haves been disabled for compatibility with
# existing code. Some of them should be re-activated in the future.
no-console: off
no-shadow: off
object-curly-spacing: off
object-curly-newline: off
object-property-newline: off
comma-dangle: off
function-paren-newline: off
arrow-parens: off
arrow-body-style: off
curly: off
no-use-before-define: off
no-param-reassign: off
camelcase: off
no-underscore-dangle: off
no-restricted-syntax: off
prefer-destructuring: off
consistent-return: off
class-methods-use-this: off
prefer-promise-reject-errors: off
import/prefer-default-export: off
import/export: off
block-spacing: off
brace-style: off
no-multi-spaces: off
# React-specific temporarily disabled rules
react/prop-types: off
react/no-string-refs: off
react/react-in-jsx-scope: off # Generates erros in tests
react/sort-comp: off
react/require-default-props: off

globals:
snapshot: false # For tests
39 changes: 20 additions & 19 deletions app/API/http_api.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,46 @@
import "isomorphic-fetch"
import trimRight from 'voca/trim_right'
import 'isomorphic-fetch'
import trimRight from 'voca/trim_right'

import { SocketApi } from "./socket_api"
import { HTTP_API_URL } from "../config"
import { parseServerError } from './server_error'
import SocketApi from './socket_api'
import { HTTP_API_URL } from '../config'
import parseServerError from './server_error'
import flashNoInternetError from './no_internet_error'
import { optionsToQueryString } from '../lib/url_utils'


class CaptainFactHttpApi {
constructor(baseUrl, token) {
this.baseUrl = trimRight(baseUrl, '/') + '/'
this.baseUrl = `${trimRight(baseUrl, '/')}/`
this.hasToken = !!token
this.headers = {'Content-Type': 'application/json'}
if (token)
this.headers['authorization'] = `Bearer ${token}`
this.headers.authorization = `Bearer ${token}`
}

setAuthorizationToken(token) {
this.hasToken = true
localStorage.token = token
if (token)
this.headers['authorization'] = `Bearer ${token}`
this.headers.authorization = `Bearer ${token}`
SocketApi.setAuthorizationToken(token)
}

resetToken() {
this.hasToken = false
delete(this.headers['authorization'])
localStorage.removeItem("token")
delete (this.headers.authorization)
localStorage.removeItem('token')
SocketApi.resetToken()
}

prepareResponse(promise) {
return new Promise((fulfill, reject) => {
return promise.then(response => {
return response.text().then((body) => {
body = body ? JSON.parse(body) : null
const parsedBody = body ? JSON.parse(body) : null
if (!response.ok)
reject(parseServerError(body))
reject(parseServerError(parsedBody))
else
fulfill(body)
fulfill(parsedBody)
})
}).catch(e => {
console.error(e)
Expand All @@ -64,31 +63,33 @@ class CaptainFactHttpApi {
/**
* Send a get request against the given `resourceUrl`.
* @param {string} resourceUrl
* @param {object} [options] - A map of options to convert to query string http://url?option1=xxx&option2=yyy
* @param {object} [options] - A map of options to convert to query
* string http://url?option1=xxx&option2=yyy
* @returns {Promise}
*/
get(resourceUrl, options) {
const queryString = optionsToQueryString(options)
const response = fetch(this.baseUrl + resourceUrl + queryString, {headers: this.headers})
const url = this.baseUrl + resourceUrl + queryString
const response = fetch(url, {headers: this.headers})
return this.prepareResponse(response)
}

post(resourceUrl, data) {
return this.makeRequest(resourceUrl, "POST", data)
return this.makeRequest(resourceUrl, 'POST', data)
}

put(resourceUrl, data) {
return this.makeRequest(resourceUrl, "PUT", data)
return this.makeRequest(resourceUrl, 'PUT', data)
}

delete(resourceUrl, data) {
return this.makeRequest(resourceUrl, "DELETE", data)
return this.makeRequest(resourceUrl, 'DELETE', data)
}
}


// Configure HttpApi
const token = typeof localStorage === "undefined" ? null : localStorage.token
const token = typeof localStorage === 'undefined' ? null : localStorage.token
const HttpApi = new CaptainFactHttpApi(HTTP_API_URL, token)

export default HttpApi
4 changes: 2 additions & 2 deletions app/API/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export {default as HttpApi} from "./http_api"
export * from "./socket_api"
export {default as HttpApi} from './http_api'
export {default as SocketApi} from './socket_api'
2 changes: 1 addition & 1 deletion app/API/no_internet_error.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export default function noInternetError() {
timeLeft: 999999999999,
infoText: 'actions.reload'
}))
}
}
2 changes: 1 addition & 1 deletion app/API/server_error.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function parseServerError(responseBody) {
export default function parseServerError(responseBody) {
if (responseBody.error)
return responseBody.error
if (responseBody.errors)
Expand Down
32 changes: 16 additions & 16 deletions app/API/socket_api.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Socket } from "phoenix"
import { WS_API_URL } from "../config"
import { parseServerError } from './server_error'
import { Socket } from 'phoenix'
import { WS_API_URL } from '../config'
import parseServerError from './server_error'
import noInternetError from './no_internet_error'


class CaptainFactSocketApi {
constructor(url) {
const token = typeof localStorage === "undefined" ? null : localStorage.token
const token = typeof localStorage === 'undefined' ? null : localStorage.token
this.socketUrl = url
this.channels = {}
this.createSocket(token)
Expand All @@ -33,19 +33,19 @@ class CaptainFactSocketApi {
* @param {{}} mapEventsToFuncs - functions to call when events are triggered
* @return {Promise} promise
*/
joinChannel(identifier, channelAddress, mapEventsToFuncs={}) {
joinChannel(identifier, channelAddress, mapEventsToFuncs = {}) {
return new Promise((fulfill, reject) => {
if (["closed", "closing"].includes(this.socket.connectionState())) {
if (['closed', 'closing'].includes(this.socket.connectionState())) {
this.socket.connect()
}
const channel = this.socket.channel(channelAddress)
this.channels[identifier] = channel
for (let [event, func] of Object.entries(mapEventsToFuncs))
for (const [event, func] of Object.entries(mapEventsToFuncs))
channel.on(event, func)
channel.join()
.receive("ok", fulfill)
.receive("error", () => reject('noInternet'))
.receive("timeout", () => reject('noInternet'))
.receive('ok', fulfill)
.receive('error', () => reject('noInternet'))
.receive('timeout', () => reject('noInternet'))
})
}

Expand All @@ -59,10 +59,10 @@ class CaptainFactSocketApi {
// Leave channel gracefully
if (this.channels[identifier]) {
this.channels[identifier].leave()
delete(this.channels[identifier])
delete (this.channels[identifier])
}
// If no more channels, close the socket
if (!Object.keys(this.channels).length && ["connecting", "open"].includes(socketState))
if (!Object.keys(this.channels).length && ['connecting', 'open'].includes(socketState))
this.socket.disconnect()
}

Expand All @@ -73,14 +73,14 @@ class CaptainFactSocketApi {
* @param {Object} params
* @return {Promise} channel
*/
push(channelIdentifier, message, params={}) {
push(channelIdentifier, message, params = {}) {
return new Promise((fulfill, reject) => {
return this.channels[channelIdentifier].push(message, params)
.receive("ok", (data) => fulfill(data))
.receive("error", (err) => reject(parseServerError(err)))
.receive('ok', (data) => fulfill(data))
.receive('error', (err) => reject(parseServerError(err)))
})
}
}


export const SocketApi = new CaptainFactSocketApi(WS_API_URL)
export default new CaptainFactSocketApi(WS_API_URL)
52 changes: 52 additions & 0 deletions app/assets/.well-known/pgp-key.txt
Original file line number Diff line number Di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hxMdC8VTqFphvvr91WWkfWYcqzlAbcvUIRBBZjMQ4m6To4PO51Pr93RWgdaYzl
cAlPKxe3UCyOkE/sDzxXh/noftW9OW4fOYwGrgHfnK2JxLurqp5FC1w9LIz9lXvY
PSmv7tdkSoB1eHyUzVdpaPkiN9Gh2sJigofBeKKFzgMP12mp2olcpwARAQABiQIf
BBgBAgAJBQJXxIRxAhsMAAoJECB5nOcVEj/7TfoP/j/Z9GEUE3QkknyRZ8rn+NMm
n8CVMbA8vjhUpvd+VQ4iD5HA1pdEyUGhzG0g9ZSJZ8/u0+8F81chZCqr3q5+fiym
WT9B9sq7wB2e/3IYgUPCGl8epJCHZ2Beoys+wCxtnHmTbCe7/Jsp/MPtNIclAWl2
k/CkWY2e6QGbM+sFdK4StJXn3TNm0sqS+EkqbhlINqnhrkMu8pokUaJxKTuVVDDo
dnRmp/sSSHm5E5Wlr8lQdwHo4pyIJaOcytl4148vC0s4RKyi3Ifuqh1uJI+uMBOo
YDLgwSU0hrbPa9zTaykbYhGcKG1UXNztJvPVqbWW8p/xEVFrKzjUA6IZUReJqRRZ
vA+ccvnI1J+B16G+QhS8jJmFc3IgIIha8IJLAbtLK37GVgyZHLaXsxLKdnXJedzx
5DHUWTrZH9v2nL9pX7tQaRLVnz+KXs81Py2X0SuGNAxWvmQAImx+aYsY4ilLYqvc
dEyfYWfRliyCOt65d8nreyw6FKJIkVwMavDeGEf5cu1RJ3vd/7eIctaEvou1FWTF
s0vvk+E70S1AJk5bWpsAUgGZKS/0lGWpmWBd7K830eBQ4fYZzPoA0Sq7cYrA1TGZ
bSzwtjlannPTgfIcxNdt8pobcuuAu8jJIB6g02yIwa5sPP1zYbf6YZDwuwFBXS7W
WfEstI5xkkqQDP+lI43K
=qB43
-----END PGP PUBLIC KEY BLOCK-----
4 changes: 4 additions & 0 deletions app/assets/.well-known/security.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Contact: mailto:security@captainfact.io
Encryption: https://captainfact.io/.well-known/pgp-key.txt
Policy: https://captainfact.io/help/bug_report
Hiring: https://captainfact.io/help/jobs
4 changes: 2 additions & 2 deletions app/assets/assets/help/en/contributionGuidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ value (best, worst, stupid...etc) by `[...]`.

For example :

> This social measure was the worst. It disgusts me. It has created a massive increase in unemployment, which is madness.
> This social measure was the worst. It disgusts me. It has created an increase in unemployment, which is madness.

Can become:

> This social measure \[...] has created a massive increase in unemployment
> This social measure \[...] has created an increase in unemployment
1 change: 1 addition & 0 deletions app/assets/assets/help/fr/ambassadors.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ contributions importantes sur la plateforme en termes de qualité et
d'implication.

C'est eux qui ont la responsabilité de nommer les futurs ambassadeurs.
Pour candidater, rendez-vous sur le [Discord spécifique aux ambassadeurs](https://discord.gg/gXhwS4m).

# Charte des ambassadeurs

Expand Down
4 changes: 2 additions & 2 deletions app/assets/assets/help/fr/contributionGuidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ valeur (le mieux, le pire, stupide...etc) par des `[...]`.

Par exemple :

> Cette mesure sociale a été un désastre le la pensée, ça ne m'évoque que du dégoût. Elle n'a fait que créer une augmentation massive du chômage, c'est pour moi une pure folie
> Cette mesure sociale a été un désastre le la pensée, ça ne m'évoque que du dégoût. Elle n'a fait que créer une augmentation du chômage, c'est pour moi une pure folie

Peut devenir :

> Cette mesure sociale \[...] n'a fait que créer une augmentation massive du chômage
> Cette mesure sociale \[...] n'a fait que créer une augmentation du chômage
Loading