From 5e39c87b8b94eec6df517ab871d0f531e182acea Mon Sep 17 00:00:00 2001 From: Sabeur Thabti Date: Sat, 27 Aug 2016 23:00:56 +0100 Subject: [PATCH 1/3] multi-purpose function update travis to node 6, use node_modules travis says it cannot find modules(eslint, karma) ditto --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index a43dd4f5a..c136131e8 100644 --- a/package.json +++ b/package.json @@ -5,14 +5,14 @@ "repository": "https://github.com/quran/quran.com-frontend", "scripts": { "test": "npm run test:dev:unit", - "test:ci:unit": "karma start --browsers PhantomJS --single-run; npm run test:ci:lint", + "test:ci:unit": "node_modules/.bin/karma start --browsers PhantomJS --single-run; npm run test:ci:lint", "test:ci:functional": "BROWSER=phantomjs bash tests/functional/test.sh start-ci", "posttest:ci:functional": "bash tests/functional/test.sh stop", - "test:dev:unit": "./node_modules/karma/bin/karma start", - "test:ci:lint": "eslint ./src/**/*.js", + "test:dev:unit": "./node_modules/.bin/karma start", + "test:ci:lint": "node_modules/eslint ./src/**/*.js", "test:dev:functional": "BROWSER=chrome bash tests/functional/test.sh start", "posttest:dev:functional": "bash tests/functional/test.sh stop", - "test:dev:lint": "node_modules/eslint/bin/eslint.js ./src/scripts/**/*.js", + "test:dev:lint": "./node_modules/.bin/eslint ./src/scripts/**/*.js", "test:stylelint": "node_modules/stylelint/dist/cli.js './src/**/*.scss' --config webpack/.stylelintrc", "dev": "env NODE_PATH='./src' PORT=8000 UV_THREADPOOL_SIZE=100 node webpack/webpack-dev-server.js & env NODE_PATH='./src' PORT=8000 node ./bin/server.js", "start": "NODE_PATH=\"./src\" node ./start", From f852044606f7c3e496330820a467e01535f8fa9c Mon Sep 17 00:00:00 2001 From: Sabeur Thabti Date: Sun, 28 Aug 2016 23:36:38 +0100 Subject: [PATCH 2/3] fix unit tests fix unit tests --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index c136131e8..a43dd4f5a 100644 --- a/package.json +++ b/package.json @@ -5,14 +5,14 @@ "repository": "https://github.com/quran/quran.com-frontend", "scripts": { "test": "npm run test:dev:unit", - "test:ci:unit": "node_modules/.bin/karma start --browsers PhantomJS --single-run; npm run test:ci:lint", + "test:ci:unit": "karma start --browsers PhantomJS --single-run; npm run test:ci:lint", "test:ci:functional": "BROWSER=phantomjs bash tests/functional/test.sh start-ci", "posttest:ci:functional": "bash tests/functional/test.sh stop", - "test:dev:unit": "./node_modules/.bin/karma start", - "test:ci:lint": "node_modules/eslint ./src/**/*.js", + "test:dev:unit": "./node_modules/karma/bin/karma start", + "test:ci:lint": "eslint ./src/**/*.js", "test:dev:functional": "BROWSER=chrome bash tests/functional/test.sh start", "posttest:dev:functional": "bash tests/functional/test.sh stop", - "test:dev:lint": "./node_modules/.bin/eslint ./src/scripts/**/*.js", + "test:dev:lint": "node_modules/eslint/bin/eslint.js ./src/scripts/**/*.js", "test:stylelint": "node_modules/stylelint/dist/cli.js './src/**/*.scss' --config webpack/.stylelintrc", "dev": "env NODE_PATH='./src' PORT=8000 UV_THREADPOOL_SIZE=100 node webpack/webpack-dev-server.js & env NODE_PATH='./src' PORT=8000 node ./bin/server.js", "start": "NODE_PATH=\"./src\" node ./start", From 67b932f20b6e3748016fb1caf03715043b3daec9 Mon Sep 17 00:00:00 2001 From: Sabeur Thabti Date: Mon, 29 Aug 2016 23:54:36 +0100 Subject: [PATCH 3/3] fix Sentry issues: 148215060 148224454 148214061 148215931 --- src/components/Audioplayer/index.js | 8 +++++-- src/containers/Surah/index.js | 4 +++- src/redux/modules/audioplayer.js | 33 ++++++++++++++++++++--------- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/components/Audioplayer/index.js b/src/components/Audioplayer/index.js index 3725a348c..eaf4a6aa0 100644 --- a/src/components/Audioplayer/index.js +++ b/src/components/Audioplayer/index.js @@ -59,7 +59,11 @@ export class Audioplayer extends Component { return buildOnClient(surah.id); } - return this.handleAddFileListeners(currentFile); + if (currentFile) { + return this.handleAddFileListeners(currentFile); + } + + return false; } componentWillReceiveProps(nextProps) { @@ -247,7 +251,7 @@ export class Audioplayer extends Component { handleAddFileListeners(file) { const { update, currentTime } = this.props; // eslint-disable-line no-shadow - debug('component:Audioplayer', `Attaching listeners to ${file.src}`); + console.log('component:Audioplayer', `Attaching listeners to ${file.src}`); // Preload file file.setAttribute('preload', 'auto'); diff --git a/src/containers/Surah/index.js b/src/containers/Surah/index.js index a9289655b..e754816d1 100644 --- a/src/containers/Surah/index.js +++ b/src/containers/Surah/index.js @@ -161,7 +161,9 @@ class Surah extends Component { if (ayahNum > (this.getLast() + 10) || ayahNum < this.getFirst()) { // This is beyond lazy loading next page. - return actions.push.push(`/${surah.id}/${ayahNum}-${ayahNum + 10}`); + if (actions.push) { + return actions.push.push(`/${surah.id}/${ayahNum}-${ayahNum + 10}`); + } } return this.handleLazyLoadAyahs(() => setTimeout(() => diff --git a/src/redux/modules/audioplayer.js b/src/redux/modules/audioplayer.js index 3c276b9de..e9635c321 100644 --- a/src/redux/modules/audioplayer.js +++ b/src/redux/modules/audioplayer.js @@ -152,19 +152,32 @@ export default function reducer(state = initialState, action = {}) { }; } case PLAY: { - state.currentFile.play(); - return { - ...state, - isPlaying: true - }; + + if (state.currentFile) { + state.currentFile.play(); + return { + ...state, + isPlaying: true + }; + } + + return state; + } case PAUSE: { - state.currentFile.pause(); - return { - ...state, - isPlaying: false - }; + if (state.currentFile) { + state.currentFile.pause(); + + return { + ...state, + isPlaying: false + }; + } + + return state; + + } case NEXT: { const [surahId, ayahNum] = action.currentAyah.split(':');