mirror of
https://github.com/nextcloud/spreed.git
synced 2025-12-18 05:20:50 +01:00
Merge pull request #15334 from nextcloud/fix/noid/file-services-ts
This commit is contained in:
commit
20d8150d0d
27 changed files with 187 additions and 188 deletions
|
|
@ -37,7 +37,7 @@ import LoadingComponent from './components/LoadingComponent.vue'
|
|||
import { useGetToken } from './composables/useGetToken.ts'
|
||||
import { useSessionIssueHandler } from './composables/useSessionIssueHandler.ts'
|
||||
import { EventBus } from './services/EventBus.ts'
|
||||
import { getFileConversation } from './services/filesIntegrationServices.js'
|
||||
import { getFileConversation } from './services/filesIntegrationServices.ts'
|
||||
import {
|
||||
leaveConversationSync,
|
||||
} from './services/participantsService.js'
|
||||
|
|
@ -228,7 +228,7 @@ export default {
|
|||
this.cancelGetFileConversation = cancel
|
||||
// Make the request
|
||||
try {
|
||||
const response = await request({ fileId: this.fileId })
|
||||
const response = await request(this.fileId)
|
||||
this.tokenStore.updateTokenAndFileIdForToken(response.data.ocs.data.token, this.fileId)
|
||||
} catch (exception) {
|
||||
if (Axios.isCancel(exception)) {
|
||||
|
|
@ -296,7 +296,7 @@ export default {
|
|||
// FIXME If the file is shared this will create the conversation
|
||||
// if it does not exist yet.
|
||||
try {
|
||||
this.isTalkSidebarSupportedForFile = (await getFileConversation({ fileId: fileInfo.id })) || false
|
||||
this.isTalkSidebarSupportedForFile = (await getFileConversation(fileInfo.id)) || false
|
||||
} catch (error) {
|
||||
this.isTalkSidebarSupportedForFile = false
|
||||
}
|
||||
|
|
@ -324,7 +324,7 @@ export default {
|
|||
// FIXME If the file is shared this will create the conversation
|
||||
// if it does not exist yet.
|
||||
try {
|
||||
this.isTalkSidebarSupportedForFile = (await getFileConversation({ fileId: fileInfo.id })) || false
|
||||
this.isTalkSidebarSupportedForFile = (await getFileConversation(fileInfo.id)) || false
|
||||
} catch (error) {
|
||||
this.isTalkSidebarSupportedForFile = false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import { t } from '@nextcloud/l10n'
|
|||
import { Fragment } from 'vue-frag'
|
||||
import NcButton from '@nextcloud/vue/components/NcButton'
|
||||
import { useGetToken } from './composables/useGetToken.ts'
|
||||
import { getPublicShareAuthConversationToken } from './services/publicShareAuthService.js'
|
||||
import { getPublicShareAuthConversationToken } from './services/filesIntegrationServices.ts'
|
||||
import { useTokenStore } from './stores/token.ts'
|
||||
import { checkBrowser } from './utils/browserCheck.ts'
|
||||
|
||||
|
|
@ -83,9 +83,9 @@ export default {
|
|||
this.isRequestLoading = true
|
||||
|
||||
try {
|
||||
const token = await getPublicShareAuthConversationToken(this.shareToken)
|
||||
const response = await getPublicShareAuthConversationToken(this.shareToken)
|
||||
|
||||
this.tokenStore.updateToken(token)
|
||||
this.tokenStore.updateToken(response.data.ocs.data.token)
|
||||
} catch (exception) {
|
||||
this.hasRequestFailed = true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ import { useHashCheck } from './composables/useHashCheck.js'
|
|||
import { useIsInCall } from './composables/useIsInCall.js'
|
||||
import { useSessionIssueHandler } from './composables/useSessionIssueHandler.ts'
|
||||
import { EventBus } from './services/EventBus.ts'
|
||||
import { getPublicShareConversationData } from './services/filesIntegrationServices.js'
|
||||
import { getPublicShareConversationData } from './services/filesIntegrationServices.ts'
|
||||
import {
|
||||
leaveConversationSync,
|
||||
} from './services/participantsService.js'
|
||||
|
|
@ -206,11 +206,11 @@ export default {
|
|||
},
|
||||
|
||||
async getPublicShareConversationData() {
|
||||
const data = await getPublicShareConversationData(this.shareToken)
|
||||
const response = await getPublicShareConversationData(this.shareToken)
|
||||
|
||||
this.tokenStore.updateToken(data.token)
|
||||
this.tokenStore.updateToken(response.data.ocs.data.token)
|
||||
|
||||
if (data.userId) {
|
||||
if (response.data.ocs.data.userId) {
|
||||
// Instead of using "getCurrentUser()" the current user is set
|
||||
// from the data returned by the controller (as the public share
|
||||
// page uses the incognito mode, and thus it always returns an
|
||||
|
|
@ -226,8 +226,8 @@ export default {
|
|||
// so at some point the anonymous user will have been overriden
|
||||
// with the current user and the connection will succeed.
|
||||
this.actorStore.setCurrentUser({
|
||||
uid: data.userId,
|
||||
displayName: data.displayName,
|
||||
uid: response.data.ocs.data.userId,
|
||||
displayName: response.data.ocs.data.userDisplayName,
|
||||
})
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ import IconUpload from 'vue-material-design-icons/Upload.vue'
|
|||
import { VIRTUAL_BACKGROUND } from '../../constants.ts'
|
||||
import BrowserStorage from '../../services/BrowserStorage.js'
|
||||
import { getTalkConfig } from '../../services/CapabilitiesManager.ts'
|
||||
import { getDavClient } from '../../services/DavClient.js'
|
||||
import { getDavClient } from '../../services/DavClient.ts'
|
||||
import { useActorStore } from '../../stores/actor.ts'
|
||||
import { useSettingsStore } from '../../stores/settings.js'
|
||||
import { findUniquePath } from '../../utils/fileUpload.js'
|
||||
|
|
|
|||
|
|
@ -495,7 +495,7 @@ export default {
|
|||
this.text = this.chatInput
|
||||
}
|
||||
// update the silent chat state
|
||||
this.silentChat = BrowserStorage.getItem('silentChat_' + this.token)
|
||||
this.silentChat = !!BrowserStorage.getItem('silentChat_' + this.token)
|
||||
},
|
||||
|
||||
text(newValue) {
|
||||
|
|
@ -661,8 +661,6 @@ export default {
|
|||
}
|
||||
}
|
||||
|
||||
const options = { silent: this.silentChat }
|
||||
|
||||
if (this.hasText) {
|
||||
this.text = parseSpecialSymbols(this.text)
|
||||
}
|
||||
|
|
@ -675,6 +673,7 @@ export default {
|
|||
const temporaryMessage = this.createTemporaryMessage({
|
||||
message: this.text.trim(),
|
||||
token: this.token,
|
||||
silent: this.silentChat,
|
||||
})
|
||||
this.text = ''
|
||||
// Scrolls the message list to the last added message
|
||||
|
|
@ -683,24 +682,24 @@ export default {
|
|||
this.chatExtrasStore.removeParentIdToReply(this.token)
|
||||
|
||||
this.dialog
|
||||
? await this.submitMessage(this.token, temporaryMessage, options)
|
||||
: await this.postMessage(this.token, temporaryMessage, options)
|
||||
? await this.submitMessage(this.token, temporaryMessage)
|
||||
: await this.postMessage(this.token, temporaryMessage)
|
||||
this.resetTypingIndicator()
|
||||
}
|
||||
},
|
||||
|
||||
// Post message to conversation
|
||||
async postMessage(token, temporaryMessage, options) {
|
||||
async postMessage(token, temporaryMessage) {
|
||||
try {
|
||||
await this.$store.dispatch('postNewMessage', { token, temporaryMessage, options })
|
||||
await this.$store.dispatch('postNewMessage', { token, temporaryMessage })
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
},
|
||||
|
||||
// Broadcast message to all breakout rooms
|
||||
async submitMessage(token, temporaryMessage, options) {
|
||||
this.$emit('submit', { token, temporaryMessage, options })
|
||||
async submitMessage(token, temporaryMessage) {
|
||||
this.$emit('submit', { token, temporaryMessage })
|
||||
},
|
||||
|
||||
async handleSubmitSpam(numberOfMessages) {
|
||||
|
|
|
|||
|
|
@ -193,21 +193,21 @@ export default {
|
|||
})
|
||||
},
|
||||
|
||||
async handleUpload({ token, temporaryMessage, options }) {
|
||||
async handleUpload({ token, temporaryMessage }) {
|
||||
if (this.files.length) {
|
||||
// Create a share with optional caption
|
||||
await this.$store.dispatch('uploadFiles', {
|
||||
token,
|
||||
uploadId: this.currentUploadId,
|
||||
caption: temporaryMessage.message,
|
||||
options,
|
||||
options: { silent: temporaryMessage.silent },
|
||||
})
|
||||
} else {
|
||||
this.$store.dispatch('discardUpload', this.currentUploadId)
|
||||
if (temporaryMessage.message.trim()) {
|
||||
// Proceed as a normal message
|
||||
try {
|
||||
await this.$store.dispatch('postNewMessage', { token, temporaryMessage, options })
|
||||
await this.$store.dispatch('postNewMessage', { token, temporaryMessage })
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
import axios from '@nextcloud/axios'
|
||||
import { generateOcsUrl } from '@nextcloud/router'
|
||||
import { shareFile } from './filesSharingServices.ts'
|
||||
import { shareFile } from '../filesSharingServices.ts'
|
||||
|
||||
jest.mock('@nextcloud/axios', () => ({
|
||||
post: jest.fn(),
|
||||
|
|
@ -136,8 +136,8 @@ describe('messagesService', () => {
|
|||
actorDisplayName: 'actor-display-name',
|
||||
referenceId: 'reference-id',
|
||||
parent: { id: 111 },
|
||||
}, {
|
||||
silent: false,
|
||||
}, {
|
||||
dummyOption: true,
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import type { AxiosRequestConfig } from '@nextcloud/axios'
|
||||
import type {
|
||||
banActorParams,
|
||||
banActorResponse,
|
||||
|
|
@ -17,10 +18,10 @@ import { generateOcsUrl } from '@nextcloud/router'
|
|||
* Get information about configured bans for this conversation
|
||||
*
|
||||
* @param token - the conversation token
|
||||
* @param [options] - request options
|
||||
* @param [options] - Axios request options
|
||||
*/
|
||||
const getConversationBans = async function(token: string, options?: object): getBansResponse {
|
||||
return axios.get(generateOcsUrl('/apps/spreed/api/v1/ban/{token}', { token }, options), options)
|
||||
const getConversationBans = async function(token: string, options?: AxiosRequestConfig): getBansResponse {
|
||||
return axios.get(generateOcsUrl('/apps/spreed/api/v1/ban/{token}', { token }), options)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -28,10 +29,10 @@ const getConversationBans = async function(token: string, options?: object): get
|
|||
*
|
||||
* @param token - the conversation token
|
||||
* @param payload - banned actor information
|
||||
* @param [options] - request options
|
||||
* @param [options] - Axios request options
|
||||
*/
|
||||
const banActor = async function(token: string, payload: banActorParams, options?: object): banActorResponse {
|
||||
return axios.post(generateOcsUrl('/apps/spreed/api/v1/ban/{token}', { token }, options), payload, options)
|
||||
const banActor = async function(token: string, payload: banActorParams, options?: AxiosRequestConfig): banActorResponse {
|
||||
return axios.post(generateOcsUrl('/apps/spreed/api/v1/ban/{token}', { token }), payload, options)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -39,10 +40,10 @@ const banActor = async function(token: string, payload: banActorParams, options?
|
|||
*
|
||||
* @param token - the conversation token
|
||||
* @param banId - ban id
|
||||
* @param [options] - request options
|
||||
* @param [options] - Axios request options
|
||||
*/
|
||||
const unbanActor = async function(token: string, banId: number, options?: object): unbanActorResponse {
|
||||
return axios.delete(generateOcsUrl('/apps/spreed/api/v1/ban/{token}/{banId}', { token, banId }, options), options)
|
||||
const unbanActor = async function(token: string, banId: number, options?: AxiosRequestConfig): unbanActorResponse {
|
||||
return axios.delete(generateOcsUrl('/apps/spreed/api/v1/ban/{token}/{banId}', { token, banId }), options)
|
||||
}
|
||||
|
||||
export {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import type { AxiosRequestConfig } from '@nextcloud/axios'
|
||||
import type {
|
||||
addConversationToFavoritesResponse,
|
||||
archiveConversationResponse,
|
||||
|
|
@ -61,9 +62,9 @@ import { hasTalkFeature } from './CapabilitiesManager.ts'
|
|||
/**
|
||||
* Fetches all conversations from the server.
|
||||
* @param params parameters
|
||||
* @param options options
|
||||
* @param [options] Axios request options
|
||||
*/
|
||||
async function fetchConversations(params: getAllConversationsParams, options?: object): getAllConversationsResponse {
|
||||
async function fetchConversations(params: getAllConversationsParams, options?: AxiosRequestConfig): getAllConversationsResponse {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v4/room'), {
|
||||
...options,
|
||||
params,
|
||||
|
|
@ -81,9 +82,9 @@ async function fetchConversation(token: string): getSingleConversationResponse {
|
|||
/**
|
||||
* Fetch listed conversations
|
||||
* @param searchTerm The string that will be used in the search query.
|
||||
* @param options options
|
||||
* @param [options] Axios request options
|
||||
*/
|
||||
async function searchListedConversations(searchTerm: string, options?: object): getListedConversationsResponse {
|
||||
async function searchListedConversations(searchTerm: string, options?: AxiosRequestConfig): getListedConversationsResponse {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v4/listed-room'), {
|
||||
...options,
|
||||
params: {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import type { AxiosRequestConfig } from '@nextcloud/axios'
|
||||
import type {
|
||||
AutocompleteParams,
|
||||
AutocompleteResponse,
|
||||
|
|
@ -43,14 +44,14 @@ type SearchPayload = {
|
|||
* @param [payload.token] The token of the conversation (if any) | 'new' for new conversations
|
||||
* @param [payload.onlyUsers] Whether to return only registered users
|
||||
* @param [payload.forceTypes] Whether to force some types to be included in query
|
||||
* @param options options
|
||||
* @param [options] Axios request options
|
||||
*/
|
||||
const autocompleteQuery = async function({
|
||||
searchText,
|
||||
token = 'new',
|
||||
onlyUsers = false,
|
||||
forceTypes = [],
|
||||
}: SearchPayload, options: object): AutocompleteResponse {
|
||||
}: SearchPayload, options?: AxiosRequestConfig): AutocompleteResponse {
|
||||
const shareTypes: ShareType[] = onlyUsers
|
||||
? [SHARE.TYPE.USER]
|
||||
: [
|
||||
|
|
@ -72,19 +73,19 @@ const autocompleteQuery = async function({
|
|||
})
|
||||
}
|
||||
|
||||
const getUserProfile = async function(userId: string, options?: object): UserProfileResponse {
|
||||
const getUserProfile = async function(userId: string, options?: AxiosRequestConfig): UserProfileResponse {
|
||||
return axios.get(generateOcsUrl('profile/{userId}', { userId }), options)
|
||||
}
|
||||
|
||||
const getTaskById = async function(id: number, options?: object): TaskProcessingResponse {
|
||||
const getTaskById = async function(id: number, options?: AxiosRequestConfig): TaskProcessingResponse {
|
||||
return axios.get(generateOcsUrl('taskprocessing/task/{id}', { id }), options)
|
||||
}
|
||||
|
||||
const deleteTaskById = async function(id: number, options?: object): Promise<null> {
|
||||
const deleteTaskById = async function(id: number, options?: AxiosRequestConfig): Promise<null> {
|
||||
return axios.delete(generateOcsUrl('taskprocessing/task/{id}', { id }), options)
|
||||
}
|
||||
|
||||
const searchMessages = async function(params: SearchMessagePayload, options: object): UnifiedSearchResponse {
|
||||
const searchMessages = async function(params: SearchMessagePayload, options?: AxiosRequestConfig): UnifiedSearchResponse {
|
||||
return axios.get(generateOcsUrl('search/providers/talk-message-current/search'), {
|
||||
...options,
|
||||
params,
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import type { AxiosRequestConfig } from '@nextcloud/axios'
|
||||
import type { acceptShareResponse, getCapabilitiesResponse, getSharesResponse, rejectShareResponse } from '../types/index.ts'
|
||||
|
||||
import axios from '@nextcloud/axios'
|
||||
|
|
@ -11,40 +12,40 @@ import { generateOcsUrl } from '@nextcloud/router'
|
|||
/**
|
||||
* Fetches list of shares for a current user
|
||||
*
|
||||
* @param [options] options;
|
||||
* @param [options] Axios request options
|
||||
*/
|
||||
const getShares = async function(options?: object): getSharesResponse {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v1/federation/invitation', undefined, options), options)
|
||||
const getShares = async function(options?: AxiosRequestConfig): getSharesResponse {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v1/federation/invitation'), options)
|
||||
}
|
||||
|
||||
/**
|
||||
* Accept an invitation by provided id.
|
||||
*
|
||||
* @param id invitation id;
|
||||
* @param [options] options;
|
||||
* @param [options] Axios request options
|
||||
*/
|
||||
const acceptShare = async function(id: string | number, options?: object): acceptShareResponse {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/federation/invitation/{id}', { id }, options), {}, options)
|
||||
const acceptShare = async function(id: string | number, options?: AxiosRequestConfig): acceptShareResponse {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/federation/invitation/{id}', { id }), {}, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* Reject an invitation by provided id.
|
||||
*
|
||||
* @param id invitation id;
|
||||
* @param [options] options;
|
||||
* @param [options] Axios request options
|
||||
*/
|
||||
const rejectShare = async function(id: string | number, options?: object): rejectShareResponse {
|
||||
return axios.delete(generateOcsUrl('apps/spreed/api/v1/federation/invitation/{id}', { id }, options), options)
|
||||
const rejectShare = async function(id: string | number, options?: AxiosRequestConfig): rejectShareResponse {
|
||||
return axios.delete(generateOcsUrl('apps/spreed/api/v1/federation/invitation/{id}', { id }), options)
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches capabilities of remote server by local conversation token
|
||||
*
|
||||
* @param token local conversation token;
|
||||
* @param [options] options;
|
||||
* @param [options] Axios request options
|
||||
*/
|
||||
const getRemoteCapabilities = async function(token: string, options?: object): getCapabilitiesResponse {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v4/room/{token}/capabilities', { token }, options), options)
|
||||
const getRemoteCapabilities = async function(token: string, options?: AxiosRequestConfig): getCapabilitiesResponse {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v4/room/{token}/capabilities', { token }), options)
|
||||
}
|
||||
|
||||
export {
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
/**
|
||||
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import axios from '@nextcloud/axios'
|
||||
import { generateOcsUrl } from '@nextcloud/router'
|
||||
|
||||
/**
|
||||
* Gets the conversation token for a given file id
|
||||
*
|
||||
* @param {object} data the wrapping object;
|
||||
* @param {number} data.fileId The file id to get the conversation for
|
||||
* @param {object} options unused
|
||||
* @return {string} the conversation token
|
||||
*/
|
||||
const getFileConversation = async function({ fileId }, options) {
|
||||
const response = await axios.get(generateOcsUrl('apps/spreed/api/v1/file/{fileId}', { fileId }))
|
||||
return response
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the public share conversation token for a given share token.
|
||||
*
|
||||
* @param {string} shareToken the token of the share
|
||||
* @return {string} the conversation token
|
||||
*/
|
||||
const getPublicShareConversationData = async function(shareToken) {
|
||||
const response = await axios.get(generateOcsUrl('apps/spreed/api/v1/publicshare/{shareToken}', { shareToken }))
|
||||
return response.data.ocs.data
|
||||
}
|
||||
|
||||
export {
|
||||
getFileConversation,
|
||||
getPublicShareConversationData,
|
||||
}
|
||||
51
src/services/filesIntegrationServices.ts
Normal file
51
src/services/filesIntegrationServices.ts
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/**
|
||||
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import type { AxiosRequestConfig } from '@nextcloud/axios'
|
||||
import type {
|
||||
createVideoVerificationRoomParams,
|
||||
createVideoVerificationRoomResponse,
|
||||
getRoomDataByFileIdResponse,
|
||||
getRoomDataByShareTokenResponse,
|
||||
} from '../types/index.ts'
|
||||
|
||||
import axios from '@nextcloud/axios'
|
||||
import { generateOcsUrl } from '@nextcloud/router'
|
||||
|
||||
/**
|
||||
* Gets the conversation token for a given file id
|
||||
*
|
||||
* @param fileId The file id to get the conversation for
|
||||
* @param [options] Axios request options
|
||||
*/
|
||||
const getFileConversation = async function(fileId: number, options?: AxiosRequestConfig): getRoomDataByFileIdResponse {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v1/file/{fileId}', { fileId }), options)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the public share conversation token for a given share token.
|
||||
*
|
||||
* @param shareToken the token of the share
|
||||
* @param [options] Axios request options
|
||||
*/
|
||||
const getPublicShareConversationData = async function(shareToken: string, options?: AxiosRequestConfig): getRoomDataByShareTokenResponse {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v1/publicshare/{shareToken}', { shareToken }), options)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the public share auth conversation token for a given share token.
|
||||
*
|
||||
* @param shareToken the token of the share
|
||||
* @param [options] Axios request options
|
||||
*/
|
||||
const getPublicShareAuthConversationToken = async function(shareToken: createVideoVerificationRoomParams['shareToken'], options?: AxiosRequestConfig): createVideoVerificationRoomResponse {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/publicshareauth'), { shareToken } as createVideoVerificationRoomParams, options)
|
||||
}
|
||||
|
||||
export {
|
||||
getFileConversation,
|
||||
getPublicShareAuthConversationToken,
|
||||
getPublicShareConversationData,
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import type { AxiosRequestConfig } from '@nextcloud/axios'
|
||||
import type {
|
||||
getMutualEventsResponse,
|
||||
OutOfOfficeResponse,
|
||||
|
|
@ -54,10 +55,10 @@ const getMutualEvents = async function(token: string): getMutualEventsResponse {
|
|||
* @param payload.title Title or summary of the event, falling back to the conversation name if none is given
|
||||
* @param payload.description Description of the event, falling back to the conversation description if none is given
|
||||
* @param payload.attendeeIds List of attendee ids to invite (null - everyone, [] - only actor)
|
||||
* @param options options object destructured
|
||||
* @param [options] Axios request options
|
||||
*/
|
||||
const scheduleMeeting = async function(token: string, { calendarUri, start, end, title, description, attendeeIds }: scheduleMeetingParams, options?: object): scheduleMeetingResponse {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v4/room/{token}/meeting', { token }, options), {
|
||||
const scheduleMeeting = async function(token: string, { calendarUri, start, end, title, description, attendeeIds }: scheduleMeetingParams, options?: AxiosRequestConfig): scheduleMeetingResponse {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v4/room/{token}/meeting', { token }), {
|
||||
calendarUri,
|
||||
start,
|
||||
end,
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import type { AxiosRequestConfig } from '@nextcloud/axios'
|
||||
import type {
|
||||
ChatMessage,
|
||||
clearHistoryResponse,
|
||||
|
|
@ -33,7 +34,6 @@ import { CHAT } from '../constants.ts'
|
|||
type ReceiveMessagesPayload = Partial<receiveMessagesParams> & { token: string }
|
||||
type GetMessageContextPayload = getMessageContextParams & { token: string, messageId: number }
|
||||
type PostNewMessagePayload = Omit<postNewMessageParams, 'replyTo'> & { token: string, parent: ChatMessage }
|
||||
type PostNewMessageOptions = Pick<postNewMessageParams, 'silent'> & object
|
||||
type DeleteMessagePayload = { token: string, id: number }
|
||||
type EditMessagePayload = { token: string, messageId: number, updatedMessage: editMessageParams['message'] }
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ type EditMessagePayload = { token: string, messageId: number, updatedMessage: ed
|
|||
* @param data.includeLastKnown whether to include the last known message in the response;
|
||||
* @param [data.lookIntoFuture=0] direction of message fetch
|
||||
* @param [data.limit=100] Number of messages to load
|
||||
* @param options options;
|
||||
* @param [options] Axios request options
|
||||
*/
|
||||
const fetchMessages = async function({
|
||||
token,
|
||||
|
|
@ -55,8 +55,8 @@ const fetchMessages = async function({
|
|||
includeLastKnown,
|
||||
lookIntoFuture = CHAT.FETCH_OLD,
|
||||
limit = 100,
|
||||
}: ReceiveMessagesPayload, options?: object): receiveMessagesResponse {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v1/chat/{token}', { token }, options), {
|
||||
}: ReceiveMessagesPayload, options?: AxiosRequestConfig): receiveMessagesResponse {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v1/chat/{token}', { token }), {
|
||||
...options,
|
||||
params: {
|
||||
setReadMarker: 0,
|
||||
|
|
@ -76,14 +76,14 @@ const fetchMessages = async function({
|
|||
* @param data.lastKnownMessageId The id of the last message in the store.
|
||||
* @param data.token The conversation token;
|
||||
* @param [data.limit=100] Number of messages to load
|
||||
* @param options options
|
||||
* @param [options] Axios request options
|
||||
*/
|
||||
const pollNewMessages = async ({
|
||||
token,
|
||||
lastKnownMessageId,
|
||||
limit = 100,
|
||||
}: ReceiveMessagesPayload, options?: object): receiveMessagesResponse => {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v1/chat/{token}', { token }, options), {
|
||||
}: ReceiveMessagesPayload, options?: AxiosRequestConfig): receiveMessagesResponse => {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v1/chat/{token}', { token }), {
|
||||
...options,
|
||||
params: {
|
||||
setReadMarker: 0,
|
||||
|
|
@ -105,10 +105,10 @@ const pollNewMessages = async ({
|
|||
* @param data.token the conversation token;
|
||||
* @param data.messageId last known message id;
|
||||
* @param [data.limit=50] Number of messages to load
|
||||
* @param options options;
|
||||
* @param [options] Axios request options
|
||||
*/
|
||||
const getMessageContext = async function({ token, messageId, limit = 50 }: GetMessageContextPayload, options?: object): getMessageContextResponse {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v1/chat/{token}/{messageId}/context', { token, messageId }, options), {
|
||||
const getMessageContext = async function({ token, messageId, limit = 50 }: GetMessageContextPayload, options?: AxiosRequestConfig): getMessageContextResponse {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v1/chat/{token}/{messageId}/context', { token, messageId }), {
|
||||
...options,
|
||||
params: {
|
||||
limit,
|
||||
|
|
@ -119,17 +119,17 @@ const getMessageContext = async function({ token, messageId, limit = 50 }: GetMe
|
|||
/**
|
||||
* Posts a new message to the server.
|
||||
*
|
||||
* @param param0 The message object that is destructured
|
||||
* @param param0.token The conversation token
|
||||
* @param param0.message The message text
|
||||
* @param param0.actorDisplayName The display name of the actor
|
||||
* @param param0.referenceId A reference id to identify the message later again
|
||||
* @param param0.parent The message to be replied to
|
||||
* @param param1 options object destructured
|
||||
* @param param1.silent whether the message should trigger a notifications
|
||||
* @param payload The message object that is destructured
|
||||
* @param payload.token The conversation token
|
||||
* @param payload.message The message text
|
||||
* @param payload.actorDisplayName The display name of the actor
|
||||
* @param payload.referenceId A reference id to identify the message later again
|
||||
* @param payload.parent The message to be replied to
|
||||
* @param payload.silent whether the message should trigger a notifications
|
||||
* @param [options] Axios request options
|
||||
*/
|
||||
const postNewMessage = async function({ token, message, actorDisplayName, referenceId, parent }: PostNewMessagePayload, { silent, ...options }: PostNewMessageOptions): postNewMessageResponse {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/chat/{token}', { token }, options), {
|
||||
const postNewMessage = async function({ token, message, actorDisplayName, referenceId, parent, silent }: PostNewMessagePayload, options?: AxiosRequestConfig): postNewMessageResponse {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/chat/{token}', { token }), {
|
||||
message,
|
||||
actorDisplayName,
|
||||
referenceId,
|
||||
|
|
@ -142,10 +142,10 @@ const postNewMessage = async function({ token, message, actorDisplayName, refere
|
|||
* Clears the conversation history
|
||||
*
|
||||
* @param token The token of the conversation to be deleted.
|
||||
* @param options request options
|
||||
* @param [options] Axios request options
|
||||
*/
|
||||
const clearConversationHistory = async function(token: string, options?: object): clearHistoryResponse {
|
||||
return axios.delete(generateOcsUrl('apps/spreed/api/v1/chat/{token}', { token }, options), options)
|
||||
const clearConversationHistory = async function(token: string, options?: AxiosRequestConfig): clearHistoryResponse {
|
||||
return axios.delete(generateOcsUrl('apps/spreed/api/v1/chat/{token}', { token }), options)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -154,10 +154,10 @@ const clearConversationHistory = async function(token: string, options?: object)
|
|||
* @param param0 The message object that is destructured
|
||||
* @param param0.token The conversation token
|
||||
* @param param0.id The id of the message to be deleted
|
||||
* @param options request options
|
||||
* @param [options] Axios request options
|
||||
*/
|
||||
const deleteMessage = async function({ token, id }: DeleteMessagePayload, options?: object): deleteMessageResponse {
|
||||
return axios.delete(generateOcsUrl('apps/spreed/api/v1/chat/{token}/{id}', { token, id }, options), options)
|
||||
const deleteMessage = async function({ token, id }: DeleteMessagePayload, options?: AxiosRequestConfig): deleteMessageResponse {
|
||||
return axios.delete(generateOcsUrl('apps/spreed/api/v1/chat/{token}/{id}', { token, id }), options)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -167,10 +167,10 @@ const deleteMessage = async function({ token, id }: DeleteMessagePayload, option
|
|||
* @param param0.token The conversation token
|
||||
* @param param0.messageId The message id
|
||||
* @param param0.updatedMessage The modified text of the message / file share caption
|
||||
* @param options request options
|
||||
* @param [options] Axios request options
|
||||
*/
|
||||
const editMessage = async function({ token, messageId, updatedMessage }: EditMessagePayload, options?: object): editMessageResponse {
|
||||
return axios.put(generateOcsUrl('apps/spreed/api/v1/chat/{token}/{messageId}', { token, messageId }, options), {
|
||||
const editMessage = async function({ token, messageId, updatedMessage }: EditMessagePayload, options?: AxiosRequestConfig): editMessageResponse {
|
||||
return axios.put(generateOcsUrl('apps/spreed/api/v1/chat/{token}/{messageId}', { token, messageId }), {
|
||||
message: updatedMessage,
|
||||
} as editMessageParams, options)
|
||||
}
|
||||
|
|
@ -184,14 +184,14 @@ const editMessage = async function({ token, messageId, updatedMessage }: EditMes
|
|||
* @param data.objectId object id
|
||||
* @param data.metaData JSON metadata of the rich object encoded as string
|
||||
* @param data.referenceId generated reference id, leave empty to generate it based on the other args
|
||||
* @param options request options
|
||||
* @param [options] Axios request options
|
||||
*/
|
||||
const postRichObjectToConversation = async function(token: string, { objectType, objectId, metaData, referenceId }: postRichObjectParams, options?: object): postRichObjectResponse {
|
||||
const postRichObjectToConversation = async function(token: string, { objectType, objectId, metaData, referenceId }: postRichObjectParams, options?: AxiosRequestConfig): postRichObjectResponse {
|
||||
if (!referenceId) {
|
||||
const tempId = 'richobject-' + objectType + '-' + objectId + '-' + token + '-' + (new Date().getTime())
|
||||
referenceId = Hex.stringify(SHA256(tempId))
|
||||
}
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/chat/{token}/share', { token }, options), {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/chat/{token}/share', { token }), {
|
||||
objectType,
|
||||
objectId,
|
||||
metaData,
|
||||
|
|
@ -204,10 +204,10 @@ const postRichObjectToConversation = async function(token: string, { objectType,
|
|||
*
|
||||
* @param token The token of the conversation to be removed from favorites
|
||||
* @param lastReadMessage id of the last read message to set
|
||||
* @param options request options
|
||||
* @param [options] Axios request options
|
||||
*/
|
||||
const updateLastReadMessage = async function(token: string, lastReadMessage?: number | null, options?: object): setReadMarkerResponse {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/chat/{token}/read', { token }, options), {
|
||||
const updateLastReadMessage = async function(token: string, lastReadMessage?: number | null, options?: AxiosRequestConfig): setReadMarkerResponse {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/chat/{token}/read', { token }), {
|
||||
lastReadMessage,
|
||||
} as setReadMarkerParams, options)
|
||||
}
|
||||
|
|
@ -216,10 +216,10 @@ const updateLastReadMessage = async function(token: string, lastReadMessage?: nu
|
|||
* Set conversation as unread
|
||||
*
|
||||
* @param token The token of the conversation to be set as unread
|
||||
* @param options request options
|
||||
* @param [options] Axios request options
|
||||
*/
|
||||
const setConversationUnread = async function(token: string, options?: object): markUnreadResponse {
|
||||
return axios.delete(generateOcsUrl('apps/spreed/api/v1/chat/{token}/read', { token }, options), options)
|
||||
const setConversationUnread = async function(token: string, options?: AxiosRequestConfig): markUnreadResponse {
|
||||
return axios.delete(generateOcsUrl('apps/spreed/api/v1/chat/{token}/read', { token }), options)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -227,10 +227,10 @@ const setConversationUnread = async function(token: string, options?: object): m
|
|||
*
|
||||
* @param token The conversation token
|
||||
* @param fromMessageId The last read message to start from
|
||||
* @param options object destructured
|
||||
* @param [options] Axios request options
|
||||
*/
|
||||
const summarizeChat = async function(token: string, fromMessageId: summarizeChatParams['fromMessageId'], options?: object): summarizeChatResponse {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/chat/{token}/summarize', { token }, options), {
|
||||
const summarizeChat = async function(token: string, fromMessageId: summarizeChatParams['fromMessageId'], options?: AxiosRequestConfig): summarizeChatResponse {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/chat/{token}/summarize', { token }), {
|
||||
fromMessageId,
|
||||
} as summarizeChatParams, options)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
/**
|
||||
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import axios from '@nextcloud/axios'
|
||||
import { generateOcsUrl } from '@nextcloud/router'
|
||||
|
||||
/**
|
||||
* Gets the public share auth conversation token for a given share token.
|
||||
*
|
||||
* @param {string} shareToken the token of the share
|
||||
* @return {string} the conversation token
|
||||
*/
|
||||
const getPublicShareAuthConversationToken = async function(shareToken) {
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v1/publicshareauth'), {
|
||||
shareToken,
|
||||
})
|
||||
return response.data.ocs.data.token
|
||||
}
|
||||
|
||||
export {
|
||||
getPublicShareAuthConversationToken,
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import type { AxiosRequestConfig } from '@nextcloud/axios'
|
||||
import type {
|
||||
addReactionParams,
|
||||
addReactionResponse,
|
||||
|
|
@ -14,20 +15,14 @@ import type {
|
|||
import axios from '@nextcloud/axios'
|
||||
import { generateOcsUrl } from '@nextcloud/router'
|
||||
|
||||
const addReactionToMessage = async function(token: string, messageId: number, selectedEmoji: addReactionParams['reaction'], options: object): addReactionResponse {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/reaction/{token}/{messageId}', {
|
||||
token,
|
||||
messageId,
|
||||
}, options), {
|
||||
const addReactionToMessage = async function(token: string, messageId: number, selectedEmoji: addReactionParams['reaction'], options?: AxiosRequestConfig): addReactionResponse {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/reaction/{token}/{messageId}', { token, messageId }), {
|
||||
reaction: selectedEmoji,
|
||||
} as addReactionParams, options)
|
||||
}
|
||||
|
||||
const removeReactionFromMessage = async function(token: string, messageId: number, selectedEmoji: deleteReactionParams['reaction'], options: object): deleteReactionResponse {
|
||||
return axios.delete(generateOcsUrl('apps/spreed/api/v1/reaction/{token}/{messageId}', {
|
||||
token,
|
||||
messageId,
|
||||
}, options), {
|
||||
const removeReactionFromMessage = async function(token: string, messageId: number, selectedEmoji: deleteReactionParams['reaction'], options?: AxiosRequestConfig): deleteReactionResponse {
|
||||
return axios.delete(generateOcsUrl('apps/spreed/api/v1/reaction/{token}/{messageId}', { token, messageId }), {
|
||||
...options,
|
||||
params: {
|
||||
reaction: selectedEmoji,
|
||||
|
|
@ -35,11 +30,8 @@ const removeReactionFromMessage = async function(token: string, messageId: numbe
|
|||
})
|
||||
}
|
||||
|
||||
const getReactionsDetails = async function(token: string, messageId: number, options: object): getReactionsResponse {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v1/reaction/{token}/{messageId}', {
|
||||
token,
|
||||
messageId,
|
||||
}, options), options)
|
||||
const getReactionsDetails = async function(token: string, messageId: number, options?: AxiosRequestConfig): getReactionsResponse {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v1/reaction/{token}/{messageId}', { token, messageId }), options)
|
||||
}
|
||||
|
||||
export { addReactionToMessage, getReactionsDetails, removeReactionFromMessage }
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ import axios from '@nextcloud/axios'
|
|||
import { generateOcsUrl } from '@nextcloud/router'
|
||||
|
||||
const getTranslationLanguages = async function(options) {
|
||||
return axios.get(generateOcsUrl('/translation/languages', undefined, options), options)
|
||||
return axios.get(generateOcsUrl('/translation/languages'), options)
|
||||
}
|
||||
|
||||
const translateText = async function(text, fromLanguage, toLanguage, options) {
|
||||
return axios.post(generateOcsUrl('/translation/translate', undefined, options), {
|
||||
return axios.post(generateOcsUrl('/translation/translate'), {
|
||||
text,
|
||||
fromLanguage,
|
||||
toLanguage,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import { getUploader } from '@nextcloud/upload'
|
|||
import Vue from 'vue'
|
||||
import { useTemporaryMessage } from '../composables/useTemporaryMessage.ts'
|
||||
import { MESSAGE, SHARED_ITEM } from '../constants.ts'
|
||||
import { getDavClient } from '../services/DavClient.js'
|
||||
import { getDavClient } from '../services/DavClient.ts'
|
||||
import { EventBus } from '../services/EventBus.ts'
|
||||
import {
|
||||
getFileTemplates,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import mockConsole from 'jest-mock-console'
|
|||
import { cloneDeep } from 'lodash'
|
||||
import { createPinia, setActivePinia } from 'pinia'
|
||||
import Vuex from 'vuex'
|
||||
import { getDavClient } from '../services/DavClient.js'
|
||||
import { getDavClient } from '../services/DavClient.ts'
|
||||
import { shareFile } from '../services/filesSharingServices.ts'
|
||||
import { setAttachmentFolder } from '../services/settingsService.ts'
|
||||
import { useActorStore } from '../stores/actor.ts'
|
||||
|
|
|
|||
|
|
@ -1373,6 +1373,8 @@ const actions = {
|
|||
}
|
||||
// Overwrite with the target conversation token
|
||||
message.token = targetToken
|
||||
// Do not forward the message silently
|
||||
message.silent = false
|
||||
if (message.parent) {
|
||||
delete message.parent
|
||||
}
|
||||
|
|
@ -1401,7 +1403,7 @@ const actions = {
|
|||
}
|
||||
}
|
||||
|
||||
return await postNewMessage(message, { silent: false })
|
||||
return await postNewMessage(message)
|
||||
},
|
||||
|
||||
async removeExpiredMessages(context, { token }) {
|
||||
|
|
|
|||
|
|
@ -1925,7 +1925,7 @@ describe('messagesStore', () => {
|
|||
store.dispatch('forwardMessage', { targetToken, messageToBeForwarded })
|
||||
|
||||
// Assert
|
||||
expect(postNewMessage).toHaveBeenCalledWith(messageExpected, { silent: false })
|
||||
expect(postNewMessage).toHaveBeenCalledWith({ ...messageExpected, silent: false })
|
||||
})
|
||||
test('forwards a message to Note to self when no token is given ', () => {
|
||||
// Arrange
|
||||
|
|
@ -1940,7 +1940,7 @@ describe('messagesStore', () => {
|
|||
store.dispatch('forwardMessage', { messageToBeForwarded })
|
||||
|
||||
// Assert
|
||||
expect(postNewMessage).toHaveBeenCalledWith(messageExpected, { silent: false })
|
||||
expect(postNewMessage).toHaveBeenCalledWith({ ...messageExpected, silent: false })
|
||||
})
|
||||
|
||||
test('generates Note to self when it does not exist ', async () => {
|
||||
|
|
@ -1964,7 +1964,7 @@ describe('messagesStore', () => {
|
|||
|
||||
// Assert
|
||||
expect(store.getters.conversationsList).toContain(conversations[1])
|
||||
expect(postNewMessage).toHaveBeenCalledWith(messageExpected, { silent: false })
|
||||
expect(postNewMessage).toHaveBeenCalledWith({ ...messageExpected, silent: false })
|
||||
})
|
||||
test('removes parent message ', () => {
|
||||
// Arrange : prepare the expected message to be forwarded
|
||||
|
|
@ -1984,7 +1984,7 @@ describe('messagesStore', () => {
|
|||
store.dispatch('forwardMessage', { targetToken, messageToBeForwarded })
|
||||
|
||||
// Assert
|
||||
expect(postNewMessage).toHaveBeenCalledWith(messageExpected, { silent: false })
|
||||
expect(postNewMessage).toHaveBeenCalledWith({ ...messageExpected, silent: false })
|
||||
})
|
||||
test('forwards an object message', () => {
|
||||
// Arrange
|
||||
|
|
@ -2049,7 +2049,7 @@ describe('messagesStore', () => {
|
|||
store.dispatch('forwardMessage', { targetToken, messageToBeForwarded })
|
||||
|
||||
// Assert
|
||||
expect(postNewMessage).toHaveBeenCalledWith(messageExpected, { silent: false })
|
||||
expect(postNewMessage).toHaveBeenCalledWith({ ...messageExpected, silent: false })
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -348,6 +348,12 @@ export type ChatMention = components['schemas']['ChatMentionSuggestion']
|
|||
export type getMentionsParams = operations['chat-mentions']['parameters']['query']
|
||||
export type getMentionsResponse = ApiResponse<operations['chat-mentions']['responses'][200]['content']['application/json']>
|
||||
|
||||
// File integrations and public shares
|
||||
export type getRoomDataByFileIdResponse = ApiResponse<operations['files_integration-get-room-by-file-id']['responses'][200]['content']['application/json']>
|
||||
export type getRoomDataByShareTokenResponse = ApiResponse<operations['files_integration-get-room-by-share-token']['responses'][200]['content']['application/json']>
|
||||
export type createVideoVerificationRoomParams = Required<operations['public_share_auth-create-room']>['requestBody']['content']['application/json']
|
||||
export type createVideoVerificationRoomResponse = ApiResponse<operations['public_share_auth-create-room']['responses'][201]['content']['application/json']>
|
||||
|
||||
// AI Summary
|
||||
export type {
|
||||
TaskProcessingResponse,
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ describe('prepareTemporaryMessage', () => {
|
|||
systemMessage: '',
|
||||
timestamp: 0,
|
||||
token: TOKEN,
|
||||
silent: false,
|
||||
}
|
||||
|
||||
const parent = {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ export type PrepareTemporaryMessagePayload = Pick<ChatMessage,
|
|||
| 'actorId'
|
||||
| 'actorType'
|
||||
| 'actorDisplayName'
|
||||
| 'silent'
|
||||
> & {
|
||||
uploadId: string
|
||||
index: number
|
||||
|
|
@ -54,6 +55,7 @@ export function prepareTemporaryMessage({
|
|||
actorType,
|
||||
actorDisplayName,
|
||||
parent,
|
||||
silent = false,
|
||||
}: PrepareTemporaryMessagePayload): ChatMessage {
|
||||
const date = new Date()
|
||||
let tempId = 'temp-' + date.getTime()
|
||||
|
|
@ -92,5 +94,6 @@ export function prepareTemporaryMessage({
|
|||
actorId,
|
||||
actorType,
|
||||
actorDisplayName,
|
||||
silent,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue