Fetch post authors when fetching posts (#6400)
This commit is contained in:
parent
47fe3e2219
commit
86a47e0832
1 changed files with 30 additions and 0 deletions
|
|
@ -410,6 +410,16 @@ export async function fetchPosts(serverUrl: string, channelId: string, page = 0,
|
|||
actionType: ActionType.POSTS.RECEIVED_SINCE,
|
||||
prepareRecordsOnly: true,
|
||||
});
|
||||
|
||||
const {authors} = await fetchPostAuthors(serverUrl, result.posts, true);
|
||||
if (authors?.length) {
|
||||
const userModels = await operator.handleUsers({
|
||||
users: authors,
|
||||
prepareRecordsOnly: true,
|
||||
});
|
||||
models.push(...userModels);
|
||||
}
|
||||
|
||||
if (isCRTEnabled) {
|
||||
const threadModels = await prepareThreadsFromReceivedPosts(operator, result.posts);
|
||||
if (threadModels?.length) {
|
||||
|
|
@ -515,6 +525,16 @@ export async function fetchPostsSince(serverUrl: string, channelId: string, sinc
|
|||
actionType: ActionType.POSTS.RECEIVED_SINCE,
|
||||
prepareRecordsOnly: true,
|
||||
});
|
||||
|
||||
const {authors} = await fetchPostAuthors(serverUrl, result.posts, true);
|
||||
if (authors?.length) {
|
||||
const userModels = await operator.handleUsers({
|
||||
users: authors,
|
||||
prepareRecordsOnly: true,
|
||||
});
|
||||
models.push(...userModels);
|
||||
}
|
||||
|
||||
if (isCRTEnabled) {
|
||||
const threadModels = await prepareThreadsFromReceivedPosts(operator, result.posts);
|
||||
if (threadModels?.length) {
|
||||
|
|
@ -624,6 +644,16 @@ export async function fetchPostThread(serverUrl: string, postId: string, fetchOn
|
|||
actionType: ActionType.POSTS.RECEIVED_IN_THREAD,
|
||||
prepareRecordsOnly: true,
|
||||
});
|
||||
|
||||
const {authors} = await fetchPostAuthors(serverUrl, result.posts, true);
|
||||
if (authors?.length) {
|
||||
const userModels = await operator.handleUsers({
|
||||
users: authors,
|
||||
prepareRecordsOnly: true,
|
||||
});
|
||||
models.push(...userModels);
|
||||
}
|
||||
|
||||
if (isCRTEnabled) {
|
||||
const threadModels = await prepareThreadsFromReceivedPosts(operator, result.posts);
|
||||
if (threadModels?.length) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue