Skip to content

Commit

Permalink
fixup! feat(talk): Make event attendees Talk room participants
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
  • Loading branch information
ChristophWurst committed Aug 2, 2023
1 parent 13d542e commit fe8c6ab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions src/services/talkService.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ import HTTPClient from '@nextcloud/axios'
import { translate as t } from '@nextcloud/l10n'
import { generateUrl, generateOcsUrl } from '@nextcloud/router'
import { loadState } from '@nextcloud/initial-state'
import logger from '../utils/logger'
import {removeMailtoPrefix} from "../utils/attendee";
import {mapAttendeePropertyToAttendeeObject} from "../models/attendee";
import {getCurrentUser} from "@nextcloud/auth";
import { getCurrentUser } from '@nextcloud/auth'
import logger from '../utils/logger.js'
import { removeMailtoPrefix } from '../utils/attendee.js'

/**
* Creates a new public talk room
Expand Down Expand Up @@ -62,6 +61,10 @@ export async function createTalkRoom(eventTitle = null, eventDescription = null,
}
}

/**
*
* @param eventComponent
*/
export async function updateTalkParticipants(eventComponent) {
const apiVersion = loadState('calendar', 'talk_api_version')
const url = eventComponent.getConferenceList()[0]?.uri ?? eventComponent.location
Expand All @@ -77,8 +80,8 @@ export async function updateTalkParticipants(eventComponent) {
try {
const participantsResponse = await HTTPClient.get(generateOcsUrl('apps/spreed/api/' + apiVersion + '/', 2) + 'room/' + token + '/participants')

Check warning on line 81 in src/services/talkService.js

View check run for this annotation

Codecov / codecov/patch

src/services/talkService.js#L80-L81

Added lines #L80 - L81 were not covered by tests
// Ignore if the actor isn't owner of the conversation
if (!participantsResponse.data.ocs.data.some(participant => participant.actorId === getCurrentUser().uid && participant.participantType <= 2 || console.info)) {
logger.debug('Current user is not a moderator or owner', { currentUser: getCurrentUser().uid, conversation: participantsResponse.data.ocs.data, })
if (!participantsResponse.data.ocs.data.some(participant => participant.actorId === getCurrentUser().uid && participant.participantType <= 2)) {
logger.debug('Current user is not a moderator or owner', { currentUser: getCurrentUser().uid, conversation: participantsResponse.data.ocs.data })
return

Check warning on line 85 in src/services/talkService.js

View check run for this annotation

Codecov / codecov/patch

src/services/talkService.js#L83-L85

Added lines #L83 - L85 were not covered by tests
}

Expand Down
2 changes: 1 addition & 1 deletion src/store/calendarObjectInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import logger from '../utils/logger.js'
import settings from './settings.js'
import { getRFCProperties } from '../models/rfcProps.js'
import { generateUrl } from '@nextcloud/router'
import { updateTalkParticipants } from '../services/talkService'
import { updateTalkParticipants } from '../services/talkService.js'

const state = {
isNew: null,
Expand Down

0 comments on commit fe8c6ab

Please sign in to comment.