Skip to content

Commit

Permalink
WIP(Sharing): Emit event for newly created guest share
Browse files Browse the repository at this point in the history
Signed-off-by: fenn-cs <[email protected]>
  • Loading branch information
Fenn-CS committed Jun 24, 2024
1 parent eacd50f commit a09bb9d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/services/logger.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { getLoggerBuilder } from '@nextcloud/logger'

export const logger = getLoggerBuilder()
.setApp('guests')
.detectUser()
.build()
22 changes: 22 additions & 0 deletions src/views/GuestForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ import NcModal from '@nextcloud/vue/dist/Components/NcModal.js'
import GroupSelect from '../components/GroupSelect.vue'
import LanguageSelect from '../components/LanguageSelect.vue'
import { logger } from '../services/logger'

Check warning on line 81 in src/views/GuestForm.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Missing file extension for "../services/logger"

Check failure on line 81 in src/views/GuestForm.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Unable to resolve path to module '../services/logger'

Check failure on line 81 in src/views/GuestForm.vue

View workflow job for this annotation

GitHub Actions / NPM lint

"../services/logger" is not found
import { emit } from '@nextcloud/event-bus'
export default {
name: 'GuestForm',
components: {
Expand Down Expand Up @@ -200,13 +203,17 @@ export default {
this.loading = true
try {
debugger

Check failure on line 206 in src/views/GuestForm.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Unexpected 'debugger' statement
await axios.put(generateOcsUrl('/apps/guests/api/v1/users'), {
displayName: this.guest.fullName,
email: this.guest.email,
language: this.guest.language,
groups: this.guest.groups,
})
logger.info('Creating aaaa share for guest', { guest: this.guest })
console.log('HELLLOOOOO aaaa')

Check failure on line 215 in src/views/GuestForm.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Unexpected console statement
if (this.integrationApp === 'talk') {
this.loading = false
this.resolve({
Expand All @@ -216,6 +223,10 @@ export default {
this.closeModal()
return
}

Check failure on line 227 in src/views/GuestForm.vue

View workflow job for this annotation

GitHub Actions / NPM lint

More than 1 blank line not allowed
logger.info('Creating aaa ccccshare for guest', { guest: this.guest })
console.log('HELLLOOOOO cccc aaaa')

Check failure on line 229 in src/views/GuestForm.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Unexpected console statement
await this.addGuestShare()
} catch ({ response }) {
const error = response && response.data && response.data.ocs && response.data.ocs.data
Expand All @@ -235,12 +246,23 @@ export default {
const url = generateOcsUrl('/apps/files_sharing/api/v1/shares')
const path = (this.fileInfo.path + '/' + this.fileInfo.name).replace('//', '/')
logger.info('Creating share for guest', { guest: this.guest })
console.log('HELLLOOOOO')

Check failure on line 250 in src/views/GuestForm.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Unexpected console statement
const result = await axios.post(url + '?format=json', {
shareType: OC.Share.SHARE_TYPE_USER,
shareWith: this.guest.username,
path,
})
this.$emit('add:share', result)
this.$emit('files_sharing:external:add-share', result)

Check failure on line 260 in src/views/GuestForm.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Custom event name 'files_sharing:external:add-share' must be kebab-case
emit('files_sharing:external:add-share', {})
logger.info('Creating share for guest : DONEEEEEE 1', { guest: this.guest })
if (!result.data.ocs) {
this.reject(result)
}
Expand Down

0 comments on commit a09bb9d

Please sign in to comment.