decord/source/modules/search/SearchActionCreators.tsx

214 lines
8.6 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 11567
// Function ID: 11568
// Dependencies: [11560, 11568, 709, 12, 7567, 11571, 1374, 2]
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 11567
import set from "set" /* 2 */;
import dispatcherDefault from "dispatcher" /* 709 */;
import updateUserGuildSettings from "updateUserGuildSettings" /* 1374 */;
import createRequestPayloadDefault from "createRequestPayload" /* 11568 */;
let result = set.fileFinishedImporting("modules/search/SearchActionCreators.tsx");
2026-07-20 16:05:17 +00:00
export default {
fetchTabMessages(searchContext) {
searchContext = searchContext.searchContext;
2026-07-23 10:11:24 +00:00
({ searchTabs, searchQueryString, getId: importDefault, onFetchStart, onFetchSuccess: dependencyMap } = searchContext);
2026-07-29 08:29:29 +00:00
let guildIdFromSearchContext;
2026-07-20 16:05:17 +00:00
let mapped;
({ pagination, trackExactTotalHits, getLimit, searchMode } = searchContext);
2026-08-24 06:08:38 +00:00
let obj = searchContext(11560);
obj1 = searchContext(11560);
2026-07-20 16:05:17 +00:00
const searchQueryFromTokens = obj1.getSearchQueryFromTokens(obj.tokenizeQuery(searchQueryString));
2026-07-29 08:29:29 +00:00
if (Array.isArray(searchQueryFromTokens.pinned)) {
const pinned = searchQueryFromTokens.pinned;
searchQueryFromTokens.pinned = pinned.some((arg0) => true === arg0);
}
2026-08-24 06:08:38 +00:00
let tmpResult = tmp(11560);
2026-07-29 08:29:29 +00:00
const result = tmpResult.searchModeToSearchQueryParams(searchMode);
2026-07-20 16:05:17 +00:00
obj = {};
const merged = Object.assign(searchQueryFromTokens);
const merged1 = Object.assign(result);
2026-08-24 06:08:38 +00:00
tmpResult = tmp(11560);
2026-07-29 08:29:29 +00:00
guildIdFromSearchContext = tmpResult.getGuildIdFromSearchContext(searchContext);
2026-07-20 16:05:17 +00:00
if (null != guildIdFromSearchContext) {
2026-08-24 06:08:38 +00:00
tmp(11560).setIncludeNSFW(obj, guildIdFromSearchContext);
const tmpResult1 = tmp(11560);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const tmp10 = importDefault;
const tokenizeQueryResult = obj.tokenizeQuery(searchQueryString);
obj = { id: null, searchContext: null, searchQuery: null, searchTabs: null, getLimit: null, pagination: null, trackExactTotalHits: null };
2026-08-24 06:08:38 +00:00
const obj7 = createRequestPayloadDefault;
obj[0] = searchContext(11560).getSearchContextId(searchContext);
2026-07-29 08:29:29 +00:00
obj[1] = searchContext;
obj[2] = obj;
obj[3] = searchTabs;
obj[4] = getLimit;
obj[5] = pagination;
obj[6] = trackExactTotalHits;
2026-07-20 16:05:17 +00:00
obj1 = obj7.create(obj);
2026-07-29 08:29:29 +00:00
if (onFetchStart != null) {
let obj2 = { searchContext: null, searchQueryString: null, searchQuery: null };
obj2[0] = searchContext;
obj2[1] = searchQueryString;
obj2[2] = obj;
2026-07-20 16:05:17 +00:00
onFetchStart(obj2);
}
mapped = searchTabs.map((arg0) => callback(arg0));
2026-08-24 06:08:38 +00:00
const tmpResult2 = searchContext(11560);
dispatcherDefault.dispatch({ type: "SEARCH_MESSAGES_START", ids: mapped });
2026-07-20 16:05:17 +00:00
const response = obj1.fetch((body) => {
body = body.body;
const entries = Object.entries(body.tabs);
2026-08-24 06:08:38 +00:00
let obj = closure_1_1(closure_1_2[2]);
2026-07-20 16:05:17 +00:00
obj = {
type: "SEARCH_MESSAGES_SUCCESS",
guildId: guildIdFromSearchContext,
data: entries.map((arg0) => {
[tmp, tmp2] = arg0;
const cursor = tmp2.cursor;
2026-08-24 06:08:38 +00:00
const obj = { id: closure_1_1(tmp), analyticsId: body.analytics_id, totalResults: tmp2.total_results, cursor: null, messages: null, channels: null, threads: null, members: null, doingHistoricalIndex: null, documentsIndexed: null };
2026-07-20 16:05:17 +00:00
if (null == cursor) {
2026-07-29 08:29:29 +00:00
let tmp6 = cursor;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
tmp6 = null;
2026-08-24 06:08:38 +00:00
const obj2 = closure_2_1(closure_2_2[3]);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[3] = tmp6;
({ messages: obj[4], channels } = tmp2);
if (channels == null) {
2026-07-20 16:05:17 +00:00
channels = [];
}
2026-07-29 08:29:29 +00:00
obj[5] = channels;
2026-07-20 16:05:17 +00:00
let threads = tmp2.threads;
2026-07-29 08:29:29 +00:00
if (threads == null) {
2026-07-20 16:05:17 +00:00
threads = [];
}
2026-07-29 08:29:29 +00:00
obj[6] = threads;
2026-07-20 16:05:17 +00:00
let members = tmp2.members;
2026-07-29 08:29:29 +00:00
if (members == null) {
2026-07-20 16:05:17 +00:00
members = [];
}
2026-07-29 08:29:29 +00:00
obj[7] = members.map((arg0) => callback(table[4])(arg0));
({ doing_deep_historical_index: obj[8], documents_indexed: obj[9] } = body);
2026-07-20 16:05:17 +00:00
return obj;
})
};
obj.dispatch(obj);
2026-07-29 08:29:29 +00:00
if (closure_2 != null) {
obj = { searchContext: null, tabEntries: null };
obj[0] = body;
obj[1] = entries;
tmp2(obj);
2026-07-20 16:05:17 +00:00
}
}, () => {
2026-08-24 06:08:38 +00:00
let obj = closure_1_1(closure_1_2[2]);
2026-07-20 16:05:17 +00:00
obj = { type: "SEARCH_MESSAGES_INDEXING", ids: mapped };
obj.dispatch(obj);
}, (error) => {
2026-08-24 06:08:38 +00:00
let obj = closure_1_1(closure_1_2[2]);
2026-07-20 16:05:17 +00:00
obj = { type: "SEARCH_MESSAGES_FAILURE", ids: mapped, error };
obj.dispatch(obj);
});
return true;
},
fetchMessages(arg0) {
({ searchContext, searchQueryString, onFetchStart } = arg0);
2026-07-29 08:29:29 +00:00
let guildIdFromSearchContext;
2026-07-23 10:11:24 +00:00
let searchContextId;
2026-07-20 16:05:17 +00:00
({ pagination, searchMode, searchEverywhere } = arg0);
2026-08-24 06:08:38 +00:00
let obj = guildIdFromSearchContext(11560);
2026-07-20 16:05:17 +00:00
obj = {};
2026-08-24 06:08:38 +00:00
let obj2 = guildIdFromSearchContext(11560);
2026-07-20 16:05:17 +00:00
const merged = Object.assign(obj2.getSearchQueryFromTokens(obj.tokenizeQuery(searchQueryString)));
const tokenizeQueryResult = obj.tokenizeQuery(searchQueryString);
2026-08-24 06:08:38 +00:00
const merged1 = Object.assign(guildIdFromSearchContext(11560).searchModeToSearchQueryParams(searchMode));
2026-07-29 08:29:29 +00:00
obj.offset = pagination.offset;
2026-08-24 06:08:38 +00:00
const obj4 = guildIdFromSearchContext(11560);
guildIdFromSearchContext = guildIdFromSearchContext(11560).getGuildIdFromSearchContext(searchContext);
2026-07-20 16:05:17 +00:00
if (null != guildIdFromSearchContext) {
2026-08-24 06:08:38 +00:00
let tmpResult = tmp(11560);
2026-07-29 08:29:29 +00:00
tmpResult.setIncludeNSFW(obj, guildIdFromSearchContext);
2026-07-20 16:05:17 +00:00
}
if (searchEverywhere) {
obj.search_everywhere = true;
}
2026-08-24 06:08:38 +00:00
tmpResult = tmp(11560);
2026-07-29 08:29:29 +00:00
searchContextId = tmpResult.getSearchContextId(searchContext);
2026-08-24 06:08:38 +00:00
const obj5 = guildIdFromSearchContext(11560);
2026-07-29 08:29:29 +00:00
const tmp9 = searchContextId;
2026-07-20 16:05:17 +00:00
obj = { id: searchContextId, searchType: searchContext.type, searchQuery: obj };
2026-08-24 06:08:38 +00:00
const obj8 = searchContextId(11571);
2026-07-29 08:29:29 +00:00
if (onFetchStart != null) {
obj2 = { searchContext: null, searchQueryString: null, searchQuery: null };
obj2[0] = searchContext;
obj2[1] = searchQueryString;
obj2[2] = obj;
2026-07-20 16:05:17 +00:00
onFetchStart(obj2);
}
2026-08-24 06:08:38 +00:00
obj1 = searchContextId(11571).create(obj);
2026-07-23 10:11:24 +00:00
let items = [searchContextId];
2026-07-29 08:29:29 +00:00
tmp9(709).dispatch({ type: "SEARCH_MESSAGES_START", ids: items });
2026-07-20 16:05:17 +00:00
const response = obj1.fetch((analyticsId) => {
2026-08-24 06:08:38 +00:00
let obj = searchContextId(closure_1_2[2]);
2026-07-29 08:29:29 +00:00
obj = { type: "SEARCH_MESSAGES_SUCCESS", guildId: guildIdFromSearchContext, data: null };
obj = { id: searchContextId, analyticsId: analyticsId.body.analytics_id, totalResults: analyticsId.body.total_results, messages: analyticsId.body.messages, threads: null, members: null, doingHistoricalIndex: null, documentsIndexed: null, channels: null, cursor: null };
2026-07-20 16:05:17 +00:00
let threads = analyticsId.body.threads;
2026-07-29 08:29:29 +00:00
if (threads == null) {
2026-07-20 16:05:17 +00:00
threads = [];
}
2026-07-29 08:29:29 +00:00
obj[4] = threads;
2026-07-20 16:05:17 +00:00
let members = analyticsId.body.members;
2026-07-29 08:29:29 +00:00
if (members == null) {
2026-07-20 16:05:17 +00:00
members = [];
}
2026-07-29 08:29:29 +00:00
obj[5] = members.map((arg0) => callback(table[4])(arg0));
obj[6] = analyticsId.body.doing_deep_historical_index;
obj[7] = analyticsId.body.documents_indexed;
2026-07-20 16:05:17 +00:00
let channels = analyticsId.body.channels;
2026-07-29 08:29:29 +00:00
if (channels == null) {
2026-07-20 16:05:17 +00:00
channels = [];
}
2026-07-29 08:29:29 +00:00
obj[8] = channels;
2026-07-20 16:05:17 +00:00
const items = [obj];
2026-07-29 08:29:29 +00:00
obj[2] = items;
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
}, () => {
const items = [searchContextId];
2026-08-24 06:08:38 +00:00
searchContextId(closure_1_2[2]).dispatch({ type: "SEARCH_MESSAGES_INDEXING", ids: items });
2026-07-20 16:05:17 +00:00
}, (error) => {
2026-08-24 06:08:38 +00:00
let obj = searchContextId(closure_1_2[2]);
2026-07-20 16:05:17 +00:00
obj = { type: "SEARCH_MESSAGES_FAILURE", ids: items, error };
2026-07-23 10:11:24 +00:00
items = [searchContextId];
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
});
},
clearSearchRecentMessages() {
2026-08-24 06:08:38 +00:00
dispatcherDefault.dispatch({ type: "SEARCH_RECENT_MESSAGES_CLEAR" });
2026-07-20 16:05:17 +00:00
},
clearAllSearchMesssages() {
2026-08-24 06:08:38 +00:00
dispatcherDefault.dispatch({ type: "SEARCH_MESSAGES_CLEAR_ALL" });
2026-07-20 16:05:17 +00:00
},
clearSearchMessages(id) {
2026-08-24 06:08:38 +00:00
let obj = dispatcherDefault;
2026-07-20 16:05:17 +00:00
obj = { type: "SEARCH_MESSAGES_CLEAR", id };
obj.dispatch(obj);
},
initializeAutocomplete(channelDetailsSearchContext) {
2026-08-24 06:08:38 +00:00
let obj = dispatcherDefault;
2026-07-20 16:05:17 +00:00
obj = { type: "SEARCH_AUTOCOMPLETE_INITIALIZE", searchContext: channelDetailsSearchContext };
obj.dispatch(obj);
},
updateAutocompleteQuery(arg0) {
({ queryString, searchContext, tokens, cursorScope } = arg0);
if (queryString.trim().length > 0) {
2026-08-24 06:08:38 +00:00
const FrecencyUserSettingsActionCreators = updateUserGuildSettings.FrecencyUserSettingsActionCreators;
2026-07-20 16:05:17 +00:00
const ifNecessary = FrecencyUserSettingsActionCreators.loadIfNecessary();
}
2026-08-24 06:08:38 +00:00
dispatcherDefault.dispatch({ type: "SEARCH_AUTOCOMPLETE_QUERY_UPDATE", searchContext, tokens, cursorScope });
2026-07-20 16:05:17 +00:00
},
markSearchTokensRefreshed() {
2026-08-24 06:08:38 +00:00
dispatcherDefault.dispatch({ type: "SEARCH_TOKENS_REFRESHED" });
2026-07-20 16:05:17 +00:00
}
};