kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
More isLoggedIn refactoring
rodzic
9cd06a15d5
commit
1e531f472e
|
@ -1,6 +1,7 @@
|
|||
import api from '../api';
|
||||
import { importFetchedAccounts, importFetchedStatus } from './importer';
|
||||
import { favourite, unfavourite } from './interactions';
|
||||
import { isLoggedIn } from 'soapbox/utils/accounts';
|
||||
|
||||
export const EMOJI_REACT_REQUEST = 'EMOJI_REACT_REQUEST';
|
||||
export const EMOJI_REACT_SUCCESS = 'EMOJI_REACT_SUCCESS';
|
||||
|
@ -44,7 +45,7 @@ export const simpleEmojiReact = (status, emoji) => {
|
|||
|
||||
export function fetchEmojiReacts(id, emoji) {
|
||||
return (dispatch, getState) => {
|
||||
if (!getState().get('me')) return dispatch(noOp());
|
||||
if (!isLoggedIn(getState)) return dispatch(noOp());
|
||||
|
||||
dispatch(fetchEmojiReactsRequest(id, emoji));
|
||||
|
||||
|
@ -65,7 +66,7 @@ export function fetchEmojiReacts(id, emoji) {
|
|||
|
||||
export function emojiReact(status, emoji) {
|
||||
return function(dispatch, getState) {
|
||||
if (!getState().get('me')) return dispatch(noOp());
|
||||
if (!isLoggedIn(getState)) return dispatch(noOp());
|
||||
|
||||
dispatch(emojiReactRequest(status, emoji));
|
||||
|
||||
|
@ -82,7 +83,7 @@ export function emojiReact(status, emoji) {
|
|||
|
||||
export function unEmojiReact(status, emoji) {
|
||||
return (dispatch, getState) => {
|
||||
if (!getState().get('me')) return dispatch(noOp());
|
||||
if (!isLoggedIn(getState)) return dispatch(noOp());
|
||||
|
||||
dispatch(unEmojiReactRequest(status, emoji));
|
||||
|
||||
|
|
|
@ -257,9 +257,9 @@ export function setFilter(filterType) {
|
|||
|
||||
export function markReadNotifications() {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
if (!state.get('me')) return;
|
||||
if (!isLoggedIn(getState)) return;
|
||||
|
||||
const state = getState();
|
||||
const topNotification = state.getIn(['notifications', 'items'], ImmutableOrderedMap()).first(ImmutableMap()).get('id');
|
||||
const lastRead = state.getIn(['notifications', 'lastRead']);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ import { debounce } from 'lodash';
|
|||
import { showAlertForError } from './alerts';
|
||||
import { patchMe } from 'soapbox/actions/me';
|
||||
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
||||
import { isLoggedIn } from 'soapbox/utils/accounts';
|
||||
import uuid from '../uuid';
|
||||
|
||||
export const SETTING_CHANGE = 'SETTING_CHANGE';
|
||||
|
@ -147,8 +148,9 @@ export function changeSetting(path, value) {
|
|||
};
|
||||
|
||||
const debouncedSave = debounce((dispatch, getState) => {
|
||||
if (!isLoggedIn(getState)) return;
|
||||
|
||||
const state = getState();
|
||||
if (!state.get('me')) return;
|
||||
if (getSettings(state).getIn(['saved'])) return;
|
||||
|
||||
const data = state.get('settings').delete('saved').toJS();
|
||||
|
|
Ładowanie…
Reference in New Issue