зеркало из https://github.com/nextcloud/spreed.git
Fix stores and some other basics
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Родитель
f307272c53
Коммит
d1873a40d5
|
@ -155,7 +155,7 @@ export default {
|
|||
/**
|
||||
* Whether the given message is a system message
|
||||
*
|
||||
* @return {bool}
|
||||
* @return {boolean}
|
||||
*/
|
||||
isSystemMessage() {
|
||||
return this.messages[0].systemMessage.length !== 0
|
||||
|
|
|
@ -465,7 +465,7 @@ export default {
|
|||
* does not have the focus there will be no caret or selection; in that
|
||||
* case the emoji will be added at the end.
|
||||
*
|
||||
* @param {Emoji} emoji Emoji object
|
||||
* @param {string} emoji Emoji object
|
||||
*/
|
||||
addEmoji(emoji) {
|
||||
const selection = document.getSelection()
|
||||
|
|
|
@ -30,8 +30,8 @@ import RoomSelector from './views/RoomSelector'
|
|||
|
||||
(function(OC, OCA, t, n) {
|
||||
/**
|
||||
* @param card
|
||||
* @param token
|
||||
* @param {object} card The card object given by the deck app
|
||||
* @param {string} token The conversation to post to
|
||||
*/
|
||||
async function postCardToRoom(card, token) {
|
||||
try {
|
||||
|
|
|
@ -33,12 +33,12 @@ if (!window.OCA.Talk) {
|
|||
/**
|
||||
* Frontend message API for adding actions to talk messages.
|
||||
*
|
||||
* @param {*} Object the wrapping object.
|
||||
* @param {string} label the action label.
|
||||
* @param {Function} callback the callback function. This function will receive
|
||||
* @param {object} data the wrapping object.
|
||||
* @param {string} data.label the action label.
|
||||
* @param {Function} data.callback the callback function. This function will receive
|
||||
* the messageAPIData object as a parameter and be triggered by a click on the
|
||||
* action.
|
||||
* @param {string} icon the action label. E.g. "icon-reply"
|
||||
* @param {string} data.icon the action label. E.g. "icon-reply"
|
||||
*/
|
||||
window.OCA.Talk.registerMessageAction = ({ label, callback, icon }) => {
|
||||
const messageAction = {
|
||||
|
|
|
@ -62,10 +62,11 @@ const searchListedConversations = async function({ searchText }, options) {
|
|||
/**
|
||||
* Fetch possible conversations
|
||||
*
|
||||
* @param {string} searchText The string that will be used in the search query.
|
||||
* @param {object} data the wrapping object.
|
||||
* @param {string} data.searchText The string that will be used in the search query.
|
||||
* @param {string} [data.token] The token of the conversation (if any), or "new" for a new one
|
||||
* @param {boolean} [data.onlyUsers] Only return users
|
||||
* @param {object} options options
|
||||
* @param {string} [token] The token of the conversation (if any), or "new" for a new one
|
||||
* @param {boolean} [onlyUsers] Only return users
|
||||
*/
|
||||
const searchPossibleConversations = async function({ searchText, token, onlyUsers }, options) {
|
||||
token = token || 'new'
|
||||
|
|
|
@ -26,8 +26,8 @@ import { generateOcsUrl } from '@nextcloud/router'
|
|||
/**
|
||||
* Gets the conversation token for a given file id
|
||||
*
|
||||
* @param {object} .fileId the id of the file
|
||||
* @param options.fileId
|
||||
* @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
|
||||
*/
|
||||
|
@ -41,7 +41,6 @@ const getFileConversation = async function({ fileId }, options) {
|
|||
*
|
||||
* @param {string} shareToken the token of the share
|
||||
* @return {string} the conversation token
|
||||
* @throws {Exception} if the conversation token could not be got
|
||||
*/
|
||||
const getPublicShareConversationData = async function(shareToken) {
|
||||
const response = await axios.get(generateOcsUrl('apps/spreed/api/v1/publicshare/{shareToken}', { shareToken }))
|
||||
|
|
|
@ -29,9 +29,10 @@ import Hex from 'crypto-js/enc-hex'
|
|||
* Fetches messages that belong to a particular conversation
|
||||
* specified with its token.
|
||||
*
|
||||
* @param {string} token the conversation token;
|
||||
* @param {string} lastKnownMessageId last known message id;
|
||||
* @param {boolean} includeLastKnown whether to include the last known message in the response;
|
||||
* @param {object} data the wrapping object.
|
||||
* @param {string} data.token the conversation token;
|
||||
* @param {string} data.lastKnownMessageId last known message id;
|
||||
* @param {boolean} data.includeLastKnown whether to include the last known message in the response;
|
||||
* @param {object} options options;
|
||||
*/
|
||||
const fetchMessages = async function({ token, lastKnownMessageId, includeLastKnown }, options) {
|
||||
|
@ -49,9 +50,10 @@ const fetchMessages = async function({ token, lastKnownMessageId, includeLastKno
|
|||
* Fetches newly created messages that belong to a particular conversation
|
||||
* specified with its token.
|
||||
*
|
||||
* @param {string} token The conversation token;
|
||||
* @param {object} data the wrapping object.
|
||||
* @param {number} data.lastKnownMessageId The id of the last message in the store.
|
||||
* @param {string} data.token The conversation token;
|
||||
* @param {object} options options
|
||||
* @param {number} lastKnownMessageId The id of the last message in the store.
|
||||
*/
|
||||
const lookForNewMessages = async ({ token, lastKnownMessageId }, options) => {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v1/chat/{token}', { token }), Object.assign(options, {
|
||||
|
@ -70,10 +72,10 @@ const lookForNewMessages = async ({ token, lastKnownMessageId }, options) => {
|
|||
* @param {object} param0 The message object that is destructured
|
||||
* @param {string} param0.token The conversation token
|
||||
* @param {string} param0.message The message object
|
||||
* @param {string} param0.actorDisplayName The display name of the actor
|
||||
* @param {string} param0.referenceId A reference id to identify the message later again
|
||||
* @param {number} param0.parent The id of the message to be replied to
|
||||
* @param {object} options request options
|
||||
* @param param0.actorDisplayName
|
||||
*/
|
||||
const postNewMessage = async function({ token, message, actorDisplayName, referenceId, parent }, options) {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/chat/{token}', { token }), {
|
||||
|
@ -88,10 +90,8 @@ const postNewMessage = async function({ token, message, actorDisplayName, refere
|
|||
* Deletes a message from the server.
|
||||
*
|
||||
* @param {object} param0 The message object that is destructured
|
||||
* @param param0.token
|
||||
* @param {string} token The conversation token
|
||||
* @param {string} id The id of the message to be deleted
|
||||
* @param param0.id
|
||||
* @param {string} param0.token The conversation token
|
||||
* @param {string} param0.id The id of the message to be deleted
|
||||
*/
|
||||
const deleteMessage = async function({ token, id }) {
|
||||
return axios.delete(generateOcsUrl('apps/spreed/api/v1/chat/{token}/{id}', { token, id }))
|
||||
|
@ -101,10 +101,11 @@ const deleteMessage = async function({ token, id }) {
|
|||
* Post a rich object to a conversation
|
||||
*
|
||||
* @param {string} token conversation token
|
||||
* @param {string} objectType object type
|
||||
* @param {string} objectId object id
|
||||
* @param {string} metaData JSON metadata of the rich object encoded as string
|
||||
* @param {string} referenceId generated reference id, leave empty to generate it based on the other args
|
||||
* @param {object} data the wrapping object.
|
||||
* @param {string} data.objectType object type
|
||||
* @param {string} data.objectId object id
|
||||
* @param {string} data.metaData JSON metadata of the rich object encoded as string
|
||||
* @param {string} data.referenceId generated reference id, leave empty to generate it based on the other args
|
||||
*/
|
||||
const postRichObjectToConversation = async function(token, { objectType, objectId, metaData, referenceId }) {
|
||||
if (!referenceId) {
|
||||
|
|
|
@ -33,9 +33,10 @@ import {
|
|||
* Joins the current user to a conversation specified with
|
||||
* the token.
|
||||
*
|
||||
* @param {string} token The conversation token;
|
||||
* @param {object} data the wrapping object.
|
||||
* @param {string} data.token The conversation token;
|
||||
* @param {boolean} data.forceJoin whether to force join;
|
||||
* @param {options} options request options;
|
||||
* @param {boolean} forceJoin whether to force join;
|
||||
*/
|
||||
const joinConversation = async ({ token, forceJoin = false }, options) => {
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v4/room/{token}/participants/active', { token }), {
|
||||
|
|
|
@ -27,7 +27,6 @@ import { generateOcsUrl } from '@nextcloud/router'
|
|||
*
|
||||
* @param {string} shareToken the token of the share
|
||||
* @return {string} the conversation token
|
||||
* @throws {Exception} if the conversation token could not be got
|
||||
*/
|
||||
const getPublicShareAuthConversationToken = async function(shareToken) {
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v1/publicshareauth'), {
|
||||
|
|
Загрузка…
Ссылка в новой задаче