aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-06-24 17:50:05 +0200
committerlain <lain@soykaf.club>2020-06-24 17:50:05 +0200
commit143da55c56a932e4e88b4959511c59f1d73d37b9 (patch)
tree598cce65273b759d7b064fceaaab20b172d541d3 /src/lib
parent7dfa734665bbb74058e221af0f71a88b4f37936d (diff)
parentbbb91d8ae3f1c3d5374de7610e723e63121e8222 (diff)
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma-fe into remove-twitterapi-config
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/notification-i18n-loader.js12
-rw-r--r--src/lib/persisted_state.js5
2 files changed, 14 insertions, 3 deletions
diff --git a/src/lib/notification-i18n-loader.js b/src/lib/notification-i18n-loader.js
new file mode 100644
index 00000000..71f9156a
--- /dev/null
+++ b/src/lib/notification-i18n-loader.js
@@ -0,0 +1,12 @@
+// This somewhat mysterious module will load a json string
+// and then extract only the 'notifications' part. This is
+// meant to be used to load the partial i18n we need for
+// the service worker.
+module.exports = function (source) {
+ var object = JSON.parse(source)
+ var smol = {
+ notifications: object.notifications || {}
+ }
+
+ return JSON.stringify(smol)
+}
diff --git a/src/lib/persisted_state.js b/src/lib/persisted_state.js
index cad7ea25..8ecb66a8 100644
--- a/src/lib/persisted_state.js
+++ b/src/lib/persisted_state.js
@@ -1,13 +1,12 @@
import merge from 'lodash.merge'
-import objectPath from 'object-path'
import localforage from 'localforage'
-import { each } from 'lodash'
+import { each, get, set } from 'lodash'
let loaded = false
const defaultReducer = (state, paths) => (
paths.length === 0 ? state : paths.reduce((substate, path) => {
- objectPath.set(substate, path, objectPath.get(state, path))
+ set(substate, path, get(state, path))
return substate
}, {})
)