Files: 509333eccb040df5c7319d97b3f2f23c53a7e3e9 / app / sync / initialise / settings.js
793 bytesRaw
1 | const nest = require('depnest') |
2 | const merge = require('lodash/merge') |
3 | |
4 | exports.gives = nest('app.sync.initialise') |
5 | |
6 | exports.needs = nest({ |
7 | 'settings.sync.set': 'first', |
8 | 'settings.sync.get': 'first', |
9 | }) |
10 | |
11 | const defaults = { |
12 | filter: { |
13 | exclude: { |
14 | channels: "" |
15 | }, |
16 | only: { |
17 | peopleIFollow: false |
18 | }, |
19 | show: { |
20 | post: true, |
21 | vote: false, // a.k.a. like |
22 | about: true, |
23 | contact: false, |
24 | channel: false, |
25 | pub: false, |
26 | chess: false |
27 | } |
28 | } |
29 | } |
30 | |
31 | exports.create = function (api) { |
32 | return nest('app.sync.initialise', initialiseSettings) |
33 | |
34 | function initialiseSettings () { |
35 | const { get, set } = api.settings.sync |
36 | const settings = merge({}, defaults, get()) |
37 | settings.filter.defaults = defaults.filter |
38 | |
39 | set(settings) |
40 | } |
41 | } |
42 | |
43 |
Built with git-ssb-web