gab-social/app/javascript/gabsocial/actions/chats.js
mgabdev f4512b4411 Added/removed some functionality to better handle requests/load
- Removed status counting in dashboard for admins
- Added limit to notifications to only 7 days ago
- Removed ability for non-logged in users to view group, group-collection timelines
- Limited account realtime search on compose, list, chat actions
- Removed fetching of user suggestions
- Removed fetching of shortcuts
- Removed featured groups, user suggestions timeline injections
- Removed group featured panel from explore layout for non logged in users
- Removed media gallery panel from profile layout
- Removed lists, suggestions, groups panel from home page
- Removed user suggestions to list page
- Updated pro_timelie in status.rb to find only from 1 hour ago
- Updated home timeline to not include groups and to find only latest from 5 days ago
- Removed search for non logged in users
2021-01-08 21:46:03 -05:00

70 lines
1.8 KiB
JavaScript

import debounce from 'lodash.debounce'
import api, { getLinks } from '../api'
import { importFetchedAccounts } from './importer'
import { me } from '../initial_state'
export const CHAT_CONVERSATION_CREATE_SEARCH_ACCOUNTS_SUCCESS = 'CHAT_CONVERSATION_CREATE_SEARCH_ACCOUNTS_SUCCESS'
export const CLEAR_CHAT_CONVERSATION_CREATE_SEARCH_ACCOUNTS = 'CLEAR_CHAT_CONVERSATION_CREATE_SEARCH_ACCOUNTS'
export const SET_CHAT_CONVERSATION_SELECTED = 'SET_CHAT_CONVERSATION_SELECTED'
export const SET_CHAT_CONVERSATION_SEARCH_VALUE = 'SET_CHAT_CONVERSATION_SEARCH_VALUE'
/**
*
*/
export const fetchChatConversationAccountSuggestions = (query) => (dispatch, getState) => {
if (!query) return
debouncedFetchChatConversationAccountSuggestions(query, dispatch, getState)
}
export const debouncedFetchChatConversationAccountSuggestions = debounce((query, dispatch, getState) => {
if (!query) return
return false
api(getState).get('/api/v1/accounts/search', {
params: {
q: query,
resolve: false,
limit: 4,
},
}).then((response) => {
dispatch(importFetchedAccounts(response.data))
dispatch(fetchChatConversationAccountSuggestionsSuccess(response.data))
}).catch((error) => {
//
})
}, 650, { leading: true })
const fetchChatConversationAccountSuggestionsSuccess = (accounts) => ({
type: CHAT_CONVERSATION_CREATE_SEARCH_ACCOUNTS_SUCCESS,
accounts,
})
/**
*
*/
export const clearChatConversationAccountSuggestions = () => (dispatch) => {
dispatch({ type: CLEAR_CHAT_CONVERSATION_CREATE_SEARCH_ACCOUNTS })
}
/**
*
*/
export const setChatConversationSelected = (chatConversationId) => (dispatch) => {
dispatch({
type: SET_CHAT_CONVERSATION_SELECTED,
chatConversationId,
})
}
/**
*
*/
export const onChangeSearch = (value) => (dispatch) => {
dispatch({
type: SET_CHAT_CONVERSATION_SEARCH_VALUE,
value,
})
}