|
|
|
@ -6,6 +6,7 @@ import {
|
|
|
|
|
importFetchedAccounts,
|
|
|
|
|
importErrorWhileFetchingAccountByUsername,
|
|
|
|
|
} from './importer';
|
|
|
|
|
import { isLoggedIn } from 'soapbox/utils/accounts';
|
|
|
|
|
|
|
|
|
|
export const ACCOUNT_FETCH_REQUEST = 'ACCOUNT_FETCH_REQUEST';
|
|
|
|
|
export const ACCOUNT_FETCH_SUCCESS = 'ACCOUNT_FETCH_SUCCESS';
|
|
|
|
@ -162,7 +163,7 @@ export function fetchAccountFail(id, error) {
|
|
|
|
|
|
|
|
|
|
export function followAccount(id, reblogs = true) {
|
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
|
if (!getState().get('me')) return;
|
|
|
|
|
if (!isLoggedIn(getState)) return;
|
|
|
|
|
|
|
|
|
|
const alreadyFollowing = getState().getIn(['relationships', id, 'following']);
|
|
|
|
|
const locked = getState().getIn(['accounts', id, 'locked'], false);
|
|
|
|
@ -179,7 +180,7 @@ export function followAccount(id, reblogs = true) {
|
|
|
|
|
|
|
|
|
|
export function unfollowAccount(id) {
|
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
|
if (!getState().get('me')) return;
|
|
|
|
|
if (!isLoggedIn(getState)) return;
|
|
|
|
|
|
|
|
|
|
dispatch(unfollowAccountRequest(id));
|
|
|
|
|
|
|
|
|
@ -245,7 +246,7 @@ export function unfollowAccountFail(error) {
|
|
|
|
|
|
|
|
|
|
export function blockAccount(id) {
|
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
|
if (!getState().get('me')) return;
|
|
|
|
|
if (!isLoggedIn(getState)) return;
|
|
|
|
|
|
|
|
|
|
dispatch(blockAccountRequest(id));
|
|
|
|
|
|
|
|
|
@ -260,7 +261,7 @@ export function blockAccount(id) {
|
|
|
|
|
|
|
|
|
|
export function unblockAccount(id) {
|
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
|
if (!getState().get('me')) return;
|
|
|
|
|
if (!isLoggedIn(getState)) return;
|
|
|
|
|
|
|
|
|
|
dispatch(unblockAccountRequest(id));
|
|
|
|
|
|
|
|
|
@ -318,7 +319,7 @@ export function unblockAccountFail(error) {
|
|
|
|
|
|
|
|
|
|
export function muteAccount(id, notifications) {
|
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
|
if (!getState().get('me')) return;
|
|
|
|
|
if (!isLoggedIn(getState)) return;
|
|
|
|
|
|
|
|
|
|
dispatch(muteAccountRequest(id));
|
|
|
|
|
|
|
|
|
@ -333,7 +334,7 @@ export function muteAccount(id, notifications) {
|
|
|
|
|
|
|
|
|
|
export function unmuteAccount(id) {
|
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
|
if (!getState().get('me')) return;
|
|
|
|
|
if (!isLoggedIn(getState)) return;
|
|
|
|
|
|
|
|
|
|
dispatch(unmuteAccountRequest(id));
|
|
|
|
|
|
|
|
|
@ -391,7 +392,7 @@ export function unmuteAccountFail(error) {
|
|
|
|
|
|
|
|
|
|
export function fetchFollowers(id) {
|
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
|
if (!getState().get('me')) return;
|
|
|
|
|
if (!isLoggedIn(getState)) return;
|
|
|
|
|
|
|
|
|
|
dispatch(fetchFollowersRequest(id));
|
|
|
|
|
|
|
|
|
@ -433,7 +434,7 @@ export function fetchFollowersFail(id, error) {
|
|
|
|
|
|
|
|
|
|
export function expandFollowers(id) {
|
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
|
if (!getState().get('me')) return;
|
|
|
|
|
if (!isLoggedIn(getState)) return;
|
|
|
|
|
|
|
|
|
|
const url = getState().getIn(['user_lists', 'followers', id, 'next']);
|
|
|
|
|
|
|
|
|
@ -481,7 +482,7 @@ export function expandFollowersFail(id, error) {
|
|
|
|
|
|
|
|
|
|
export function fetchFollowing(id) {
|
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
|
if (!getState().get('me')) return;
|
|
|
|
|
if (!isLoggedIn(getState)) return;
|
|
|
|
|
|
|
|
|
|
dispatch(fetchFollowingRequest(id));
|
|
|
|
|
|
|
|
|
@ -523,7 +524,7 @@ export function fetchFollowingFail(id, error) {
|
|
|
|
|
|
|
|
|
|
export function expandFollowing(id) {
|
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
|
if (!getState().get('me')) return;
|
|
|
|
|
if (!isLoggedIn(getState)) return;
|
|
|
|
|
|
|
|
|
|
const url = getState().getIn(['user_lists', 'following', id, 'next']);
|
|
|
|
|
|
|
|
|
@ -571,7 +572,7 @@ export function expandFollowingFail(id, error) {
|
|
|
|
|
|
|
|
|
|
export function fetchRelationships(accountIds) {
|
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
|
if (!getState().get('me')) return;
|
|
|
|
|
if (!isLoggedIn(getState)) return;
|
|
|
|
|
|
|
|
|
|
const loadedRelationships = getState().get('relationships');
|
|
|
|
|
const newAccountIds = accountIds.filter(id => loadedRelationships.get(id, null) === null);
|
|
|
|
@ -616,7 +617,7 @@ export function fetchRelationshipsFail(error) {
|
|
|
|
|
|
|
|
|
|
export function fetchFollowRequests() {
|
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
|
if (!getState().get('me')) return;
|
|
|
|
|
if (!isLoggedIn(getState)) return;
|
|
|
|
|
|
|
|
|
|
dispatch(fetchFollowRequestsRequest());
|
|
|
|
|
|
|
|
|
@ -651,7 +652,7 @@ export function fetchFollowRequestsFail(error) {
|
|
|
|
|
|
|
|
|
|
export function expandFollowRequests() {
|
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
|
if (!getState().get('me')) return;
|
|
|
|
|
if (!isLoggedIn(getState)) return;
|
|
|
|
|
|
|
|
|
|
const url = getState().getIn(['user_lists', 'follow_requests', 'next']);
|
|
|
|
|
|
|
|
|
@ -692,7 +693,7 @@ export function expandFollowRequestsFail(error) {
|
|
|
|
|
|
|
|
|
|
export function authorizeFollowRequest(id) {
|
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
|
if (!getState().get('me')) return;
|
|
|
|
|
if (!isLoggedIn(getState)) return;
|
|
|
|
|
|
|
|
|
|
dispatch(authorizeFollowRequestRequest(id));
|
|
|
|
|
|
|
|
|
@ -728,7 +729,7 @@ export function authorizeFollowRequestFail(id, error) {
|
|
|
|
|
|
|
|
|
|
export function rejectFollowRequest(id) {
|
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
|
if (!getState().get('me')) return;
|
|
|
|
|
if (!isLoggedIn(getState)) return;
|
|
|
|
|
|
|
|
|
|
dispatch(rejectFollowRequestRequest(id));
|
|
|
|
|
|
|
|
|
@ -763,7 +764,7 @@ export function rejectFollowRequestFail(id, error) {
|
|
|
|
|
|
|
|
|
|
export function pinAccount(id) {
|
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
|
if (!getState().get('me')) return;
|
|
|
|
|
if (!isLoggedIn(getState)) return;
|
|
|
|
|
|
|
|
|
|
dispatch(pinAccountRequest(id));
|
|
|
|
|
|
|
|
|
@ -777,7 +778,7 @@ export function pinAccount(id) {
|
|
|
|
|
|
|
|
|
|
export function unpinAccount(id) {
|
|
|
|
|
return (dispatch, getState) => {
|
|
|
|
|
if (!getState().get('me')) return;
|
|
|
|
|
if (!isLoggedIn(getState)) return;
|
|
|
|
|
|
|
|
|
|
dispatch(unpinAccountRequest(id));
|
|
|
|
|
|
|
|
|
|