diff --git a/Procfile b/Procfile
index c2c566e8c..6cdd89518 100644
--- a/Procfile
+++ b/Procfile
@@ -1 +1,2 @@
web: bundle exec puma -C config/puma.rb
+worker: bundle exec sidekiq -q default -q mailers -q push
diff --git a/app/assets/javascripts/components/actions/notifications.jsx b/app/assets/javascripts/components/actions/notifications.jsx
index 1e5b2c382..8688267f4 100644
--- a/app/assets/javascripts/components/actions/notifications.jsx
+++ b/app/assets/javascripts/components/actions/notifications.jsx
@@ -24,17 +24,21 @@ const fetchRelatedRelationships = (dispatch, notifications) => {
export function updateNotifications(notification, intlMessages, intlLocale) {
return (dispatch, getState) => {
+ const showAlert = getState().getIn(['notifications', 'settings', 'alerts', notification.type], false);
+ const playSound = getState().getIn(['notifications', 'settings', 'sounds', notification.type], false);
+
dispatch({
type: NOTIFICATIONS_UPDATE,
notification,
account: notification.account,
- status: notification.status
+ status: notification.status,
+ meta: playSound ? { sound: 'boop' } : null
});
fetchRelatedRelationships(dispatch, [notification]);
// Desktop notifications
- if (typeof window.Notification !== 'undefined' && getState().getIn(['notifications', 'settings', 'alerts', notification.type], false)) {
+ if (typeof window.Notification !== 'undefined' && showAlert) {
const title = new IntlMessageFormat(intlMessages[`notification.${notification.type}`], intlLocale).format({ name: notification.account.display_name.length > 0 ? notification.account.display_name : notification.account.username });
const body = $('
').html(notification.status ? notification.status.content : '').text();
diff --git a/app/assets/javascripts/components/components/column_collapsable.jsx b/app/assets/javascripts/components/components/column_collapsable.jsx
index 8d74fd8a7..203dc5e0c 100644
--- a/app/assets/javascripts/components/components/column_collapsable.jsx
+++ b/app/assets/javascripts/components/components/column_collapsable.jsx
@@ -45,7 +45,7 @@ const ColumnCollapsable = React.createClass({
-
+
{({ opacity, height }) =>
{children}
diff --git a/app/assets/javascripts/components/features/notifications/components/column_settings.jsx b/app/assets/javascripts/components/features/notifications/components/column_settings.jsx
index dfb59713c..b63c1881a 100644
--- a/app/assets/javascripts/components/features/notifications/components/column_settings.jsx
+++ b/app/assets/javascripts/components/features/notifications/components/column_settings.jsx
@@ -36,15 +36,17 @@ const ColumnSettings = React.createClass({
const alertStr =
;
const showStr =
;
+ const soundStr =
;
return (
-
+
+
@@ -52,6 +54,7 @@ const ColumnSettings = React.createClass({
+
@@ -59,6 +62,7 @@ const ColumnSettings = React.createClass({
+
@@ -66,6 +70,7 @@ const ColumnSettings = React.createClass({
+
diff --git a/app/assets/javascripts/components/reducers/settings.jsx b/app/assets/javascripts/components/reducers/settings.jsx
index 8bd9edae2..8acc3faca 100644
--- a/app/assets/javascripts/components/reducers/settings.jsx
+++ b/app/assets/javascripts/components/reducers/settings.jsx
@@ -23,6 +23,13 @@ const initialState = Immutable.Map({
favourite: true,
reblog: true,
mention: true
+ }),
+
+ sounds: Immutable.Map({
+ follow: true,
+ favourite: true,
+ reblog: true,
+ mention: true
})
})
});
@@ -30,7 +37,7 @@ const initialState = Immutable.Map({
export default function settings(state = initialState, action) {
switch(action.type) {
case STORE_HYDRATE:
- return state.merge(action.state.get('settings'));
+ return state.mergeDeep(action.state.get('settings'));
case SETTING_CHANGE:
return state.setIn(action.key, action.value);
default:
diff --git a/app/assets/javascripts/components/store/configureStore.jsx b/app/assets/javascripts/components/store/configureStore.jsx
index 87f469999..6f0823bf0 100644
--- a/app/assets/javascripts/components/store/configureStore.jsx
+++ b/app/assets/javascripts/components/store/configureStore.jsx
@@ -3,10 +3,18 @@ import thunk from 'redux-thunk';
import appReducer from '../reducers';
import loadingBarMiddleware from '../middleware/loading_bar';
import errorsMiddleware from '../middleware/errors';
+import soundsMiddleware from 'redux-sounds';
import Immutable from 'immutable';
-export default function configureStore() {
- return createStore(appReducer, compose(applyMiddleware(thunk, loadingBarMiddleware({
- promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAIL'],
- }), errorsMiddleware()), window.devToolsExtension ? window.devToolsExtension() : f => f));
+const soundsData = {
+ boop: '/sounds/boop.mp3'
+};
+
+export default function configureStore() {
+ return createStore(appReducer, compose(applyMiddleware(
+ thunk,
+ loadingBarMiddleware({ promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAIL'] }),
+ errorsMiddleware(),
+ soundsMiddleware(soundsData)
+ ), window.devToolsExtension ? window.devToolsExtension() : f => f));
};
diff --git a/config/puma.rb b/config/puma.rb
index e6b0da91b..550129bdc 100644
--- a/config/puma.rb
+++ b/config/puma.rb
@@ -1,52 +1,18 @@
-# Puma can serve each request in a thread from an internal thread pool.
-# The `threads` method setting takes two numbers a minimum and maximum.
-# Any libraries that use thread pools should be configured to match
-# the maximum value specified for Puma. Default is set to 5 threads for minimum
-# and maximum, this matches the default thread size of Active Record.
-#
-threads_count = ENV.fetch("MAX_THREADS") { 5 }.to_i
+threads_count = ENV.fetch('MAX_THREADS') { 5 }.to_i
threads threads_count, threads_count
-# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
-#
-port ENV.fetch("PORT") { 3000 }
+port ENV.fetch('PORT') { 3000 }
+environment ENV.fetch('RAILS_ENV') { 'development' }
+workers ENV.fetch('WEB_CONCURRENCY') { 2 }
-# Specifies the `environment` that Puma will run in.
-#
-environment ENV.fetch("RAILS_ENV") { "development" }
-
-# Specifies the number of `workers` to boot in clustered mode.
-# Workers are forked webserver processes. If using threads and workers together
-# the concurrency of the application would be max `threads` * `workers`.
-# Workers do not work on JRuby or Windows (both of which do not support
-# processes).
-#
-workers ENV.fetch("WEB_CONCURRENCY") { 2 }
-
-# Use the `preload_app!` method when specifying a `workers` number.
-# This directive tells Puma to first boot the application and load code
-# before forking the application. This takes advantage of Copy On Write
-# process behavior so workers use less memory. If you use this option
-# you need to make sure to reconnect any threads in the `on_worker_boot`
-# block.
-#
preload_app!
-# The code in the `on_worker_boot` will be called if you are using
-# clustered mode by specifying a number of `workers`. After each worker
-# process is booted this block will be run, if you are using `preload_app!`
-# option you will want to use this block to reconnect to any threads
-# or connections that may have been created at application boot, Ruby
-# cannot share connections between processes.
-#
on_worker_boot do
-
- if ENV["HEROKU"] #Spwan the workers from Puma, to only use one dyno
+ if ENV['HEROKU'] # Spawn the workers from Puma, to only use one dyno
@sidekiq_pid ||= spawn('bundle exec sidekiq -q default -q mailers -q push')
end
ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
end
-# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart
diff --git a/package.json b/package.json
index 194bcfeba..dbcc032c6 100644
--- a/package.json
+++ b/package.json
@@ -49,6 +49,7 @@
"react-toggle": "^2.1.1",
"redux": "^3.6.0",
"redux-immutable": "^3.0.8",
+ "redux-sounds": "^1.1.1",
"redux-thunk": "^2.1.0",
"reselect": "^2.5.4",
"sass-loader": "^4.0.2",
diff --git a/public/sounds/boop.mp3 b/public/sounds/boop.mp3
new file mode 100644
index 000000000..02a035d91
Binary files /dev/null and b/public/sounds/boop.mp3 differ
diff --git a/yarn.lock b/yarn.lock
index f681b8f14..ee3e57783 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2499,6 +2499,10 @@ hosted-git-info@^2.1.4:
version "2.1.5"
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.1.5.tgz#0ba81d90da2e25ab34a332e6ec77936e1598118b"
+howler@^1.1.28:
+ version "1.1.29"
+ resolved "https://registry.yarnpkg.com/howler/-/howler-1.1.29.tgz#9a3a7fa69e9b9d805c65ad98f66e35893a597b63"
+
html-comment-regex@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/html-comment-regex/-/html-comment-regex-1.1.1.tgz#668b93776eaae55ebde8f3ad464b307a4963625e"
@@ -4466,6 +4470,12 @@ redux-immutable@^3.0.8:
dependencies:
immutable "^3.7.6"
+redux-sounds@^1.1.1:
+ version "1.1.1"
+ resolved "https://registry.yarnpkg.com/redux-sounds/-/redux-sounds-1.1.1.tgz#7a31052dbc617d419c53056215865762f44adb7e"
+ dependencies:
+ howler "^1.1.28"
+
redux-thunk@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/redux-thunk/-/redux-thunk-2.1.0.tgz#c724bfee75dbe352da2e3ba9bc14302badd89a98"