Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ export default {
if (event.notification.objectType === 'remote_talk_share') {
try {
event.cancelAction = true
this.federationStore.addInvitationFromNotification(event.notification)
const conversation = await this.federationStore.acceptShare(event.notification.objectId)
if (conversation.token) {
this.$store.dispatch('addConversation', conversation)
Expand All @@ -570,7 +571,8 @@ export default {
if (event.notification.objectType === 'remote_talk_share') {
try {
event.cancelAction = true
this.federationStore.rejectShare(event.notification.objectId)
this.federationStore.addInvitationFromNotification(event.notification)
await this.federationStore.rejectShare(event.notification.objectId)
} catch (error) {
console.error(error)
}
Expand Down
4 changes: 2 additions & 2 deletions src/services/federationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const getShares = async function(options?: object): getSharesResponse {
* @param id invitation id;
* @param [options] options;
*/
const acceptShare = async function(id: number, options?: object): acceptShareResponse {
const acceptShare = async function(id: string | number, options?: object): acceptShareResponse {
return axios.post(generateOcsUrl('apps/spreed/api/v1/federation/invitation/{id}', { id }, options), {}, options)
}

Expand All @@ -50,7 +50,7 @@ const acceptShare = async function(id: number, options?: object): acceptShareRes
* @param id invitation id;
* @param [options] options;
*/
const rejectShare = async function(id: number, options?: object): rejectShareResponse {
const rejectShare = async function(id: string | number, options?: object): rejectShareResponse {
return axios.delete(generateOcsUrl('apps/spreed/api/v1/federation/invitation/{id}', { id }, options), options)
}

Expand Down
2 changes: 1 addition & 1 deletion src/stores/__tests__/federation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ describe('federationStore', () => {
// Assert
expect(federationStore.pendingShares).toMatchObject({
[invites[0].id]: invites[0],
[notifications[1].objectId]: { id: notifications[1].objectId },
[notifications[1].objectId]: { id: +notifications[1].objectId },
})
expect(federationStore.acceptedShares).toMatchObject({ [invites[1].id]: invites[1] })
expect(federationStore.pendingSharesCount).toBe(2)
Expand Down
8 changes: 4 additions & 4 deletions src/stores/federation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const useFederationStore = defineStore('federation', {
const [remoteServerUrl, remoteToken] = notification.messageRichParameters.roomName.id.split('::')
const { id, name } = notification.messageRichParameters.user1
const invitation: FederationInvite = {
id: notification.objectId,
id: +notification.objectId,
localToken: '',
localCloudId: notification.user + '@' + getBaseUrl().replace('https://', ''),
remoteAttendeeId: 0,
Expand All @@ -100,7 +100,7 @@ export const useFederationStore = defineStore('federation', {
* @param id invitation id
* @param conversation conversation object
*/
markInvitationAccepted(id: number, conversation: Conversation) {
markInvitationAccepted(id: string | number, conversation: Conversation) {
if (!this.pendingShares[id]) {
return
}
Expand All @@ -118,7 +118,7 @@ export const useFederationStore = defineStore('federation', {
*
* @param id invitation id
*/
async acceptShare(id: number): Promise<Conversation | undefined> {
async acceptShare(id: string | number): Promise<Conversation | undefined> {
if (!this.pendingShares[id]) {
return
}
Expand All @@ -144,7 +144,7 @@ export const useFederationStore = defineStore('federation', {
*
* @param id invitation id
*/
async rejectShare(id: number) {
async rejectShare(id: string | number) {
if (!this.pendingShares[id]) {
return
}
Expand Down
2 changes: 1 addition & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export type Notification<T = Record<string, RichObject & Record<string, unknown>
user: string,
datetime: string,
objectType: string,
objectId: number,
objectId: string,
subject: string,
message: string,
link: string,
Expand Down