Skip to content

Conversation

@kesselb
Copy link
Contributor

@kesselb kesselb commented Jul 29, 2021

Issue: Autocompletion of usernames in comments (e.g. for a file) does not work on Nextcloud 20

1
$('#commentsTabView').find('.newCommentForm .message') is empty on page load. It looks (to me with my very basic understanding of this app) that html for the comments tab is injected when the tab gets active. But _initAutoComplete happens much earlier and #commentsTabView does not exist.

2

var s = this
if (!_.isUndefined(this._autoCompleteRequestTimer)) {
clearTimeout(this._autoCompleteRequestTimer)
}
this._autoCompleteRequestTimer = _.delay(function() {
if (!_.isUndefined(this._autoCompleteRequestCall)) {
this._autoCompleteRequestCall.abort()
}
this._autoCompleteRequestCall = $.ajax({
url: OC.linkToOCS('core', 2) + 'autocomplete/get',
data: {
search: query,
itemType: 'files',
itemId: s.model.get('id'),
sorter: 'commenters|share-recipients',
limit: OC.appConfig.comments.maxAutoCompleteResults
},
beforeSend: function(request) {
request.setRequestHeader('Accept', 'application/json')
},
success: function(result) {
callback(result.ocs.data)
}
})
}, 400)

_.delay(function() { this inside the closure is null. using s or bind(this) seems to fix it.

3
When editing a comment sometimes a error like happens. More often when you add another mention.

commentstabview.js:634 Uncaught (in promise) TypeError: Cannot read property 'removeClass' of undefined
    at success (commentstabview.js:634)
    at Object.options.success (backbone.js:649)
    at backbone-webdav.js:194

var $row = $form.closest('.comment')
$row.data('commentEl').removeClass('hidden')
$row.remove()

Add, edit, delete comments still work afterwards. I'm not sure how to fix. Does anyone know what the above code is supposed to do? 🤷‍♂️

4
It's not possible to mention more than one person in one comment like Hi @Amy @Bender but Hi @Amy, Hi @Bender does work. It's a bit weird from a user point. Hopefully good enough for now ;)

@kesselb kesselb added 2. developing Work in progress bug labels Jul 29, 2021
@kesselb kesselb requested a review from a team July 29, 2021 21:36
@kesselb kesselb added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jul 29, 2021
@skjnldsv
Copy link
Member

3
When editing a comment sometimes a error like happens. More often when you add another mention.

commentstabview.js:634 Uncaught (in promise) TypeError: Cannot read property 'removeClass' of undefined
    at success (commentstabview.js:634)
    at Object.options.success (backbone.js:649)
    at backbone-webdav.js:194

var $row = $form.closest('.comment')
$row.data('commentEl').removeClass('hidden')
$row.remove()

Add, edit, delete comments still work afterwards. I'm not sure how to fix. Does anyone know what the above code is supposed to do?

I think it was adding a new view for the comment and deleting the old one to trigger everything again 🙈

Copy link
Member

@Pytal Pytal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works :)

@kesselb kesselb added this to the Nextcloud 20.0.12 milestone Jul 31, 2021
@skjnldsv skjnldsv mentioned this pull request Aug 3, 2021
9 tasks
@skjnldsv skjnldsv merged commit bc73a9c into stable20 Aug 3, 2021
@skjnldsv skjnldsv deleted the bug/noid/comments-autocompletion branch August 3, 2021 15:30
@Pytal Pytal added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Aug 3, 2021
@blizzz blizzz mentioned this pull request Sep 23, 2021
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to release Ready to be released and/or waiting for tests to finish bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants