about summary refs log tree commit diff
path: root/app/javascript/mastodon/actions/onboarding.js
blob: 90f1da7bd42a309d0341a223af3aa5f7f1c0f080 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { changeSetting, saveSettings } from './settings';
import { requestBrowserPermission } from './notifications';

export const INTRODUCTION_VERSION = 20181216044202;

export const closeOnboarding = () => dispatch => {
  dispatch(changeSetting(['introductionVersion'], INTRODUCTION_VERSION));
  dispatch(saveSettings());

  dispatch(requestBrowserPermission((permission) => {
    if (permission === 'granted') {
      dispatch(changeSetting(['notifications', 'alerts', 'follow'], true));
      dispatch(changeSetting(['notifications', 'alerts', 'favourite'], true));
      dispatch(changeSetting(['notifications', 'alerts', 'reblog'], true));
      dispatch(changeSetting(['notifications', 'alerts', 'mention'], true));
      dispatch(changeSetting(['notifications', 'alerts', 'poll'], true));
      dispatch(saveSettings());
    }
  }));
};