Skip to content

Commit

Permalink
Merge pull request #44902 from nextcloud/backport/44868/stable28
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Aug 2, 2024
2 parents 1d65b6e + 2fef12f commit 1ea1f4f
Show file tree
Hide file tree
Showing 84 changed files with 152 additions and 138 deletions.
3 changes: 3 additions & 0 deletions apps/comments/src/comments-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ if (loadState('comments', 'activityEnabled', false) && OCA?.Activity?.registerSi
TabInstance = new OCA.Comments.View('files', {
// Better integration with vue parent component
parent: context,
propsData: {
resourceId: fileInfo.id,
},
})
// Only mount after we have all the info we need
await TabInstance.update(fileInfo.id)
Expand Down
33 changes: 22 additions & 11 deletions apps/comments/src/views/Comments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
:resource-type="resourceType"
:editor="true"
:user-data="userData"
:resource-id="resourceId"
:resource-id="currentResourceId"
class="comments__writer"
@new="onNewComment" />

Expand All @@ -52,7 +52,7 @@
:auto-complete="autoComplete"
:resource-type="resourceType"
:message.sync="comment.props.message"
:resource-id="resourceId"
:resource-id="currentResourceId"
:user-data="genMentionsData(comment.props.mentions)"
class="comments__list"
@delete="onDelete" />
Expand Down Expand Up @@ -86,20 +86,21 @@
<script>
import { showError } from '@nextcloud/dialogs'
import { translate as t } from '@nextcloud/l10n'
import { vElementVisibility as elementVisibility } from '@vueuse/components'
import VTooltip from 'v-tooltip'
import Vue from 'vue'
import VueObserveVisibility from 'vue-observe-visibility'
import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js'
import AlertCircleOutlineIcon from 'vue-material-design-icons/AlertCircleOutline.vue'
import MessageReplyTextIcon from 'vue-material-design-icons/MessageReplyText.vue'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js'
import RefreshIcon from 'vue-material-design-icons/Refresh.vue'
import MessageReplyTextIcon from 'vue-material-design-icons/MessageReplyText.vue'
import AlertCircleOutlineIcon from 'vue-material-design-icons/AlertCircleOutline.vue'
import Comment from '../components/Comment.vue'
import { getComments, DEFAULT_LIMIT } from '../services/GetComments.ts'
import cancelableRequest from '../utils/cancelableRequest.js'
import { markCommentsAsRead } from '../services/ReadComments.ts'
import cancelableRequest from '../utils/cancelableRequest.js'
import Comment from '../components/Comment.vue'
import CommentView from '../mixins/CommentView'
Vue.use(VTooltip)
Expand All @@ -117,6 +118,10 @@ export default {
AlertCircleOutlineIcon,
},
directives: {
elementVisibility,
},
mixins: [CommentView],
data() {
Expand All @@ -125,7 +130,7 @@ export default {
loading: false,
done: false,
resourceId: null,
currentResourceId: this.resourceId,
offset: 0,
comments: [],
Expand All @@ -145,13 +150,19 @@ export default {
},
},
watch: {
resourceId() {
this.currentResourceId = this.resourceId
},
},
methods: {
t,
async onVisibilityChange(isVisible) {
if (isVisible) {
try {
await markCommentsAsRead(this.resourceType, this.resourceId, new Date())
await markCommentsAsRead(this.resourceType, this.currentResourceId, new Date())
} catch (e) {
showError(e.message || t('comments', 'Failed to mark comments as read'))
}
Expand All @@ -164,7 +175,7 @@ export default {
* @param {number} resourceId the current resourceId (fileId...)
*/
async update(resourceId) {
this.resourceId = resourceId
this.currentResourceId = resourceId
this.resetState()
this.getComments()
},
Expand Down Expand Up @@ -203,7 +214,7 @@ export default {
// Fetch comments
const { data: comments } = await request({
resourceType: this.resourceType,
resourceId: this.resourceId,
resourceId: this.currentResourceId,
}, { offset: this.offset }) || { data: [] }
this.logger.debug(`Processed ${comments.length} comments`, { comments })
Expand Down
8 changes: 4 additions & 4 deletions apps/files/src/views/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
@opened="handleOpened"
@closing="handleClosing"
@closed="handleClosed">
<template #subname>
<template v-if="fileInfo" #subname>
<NcIconSvgWrapper v-if="fileInfo.isFavourited"
:path="mdiStar"
:name="t('files', 'Favorite')"
Expand Down Expand Up @@ -222,7 +222,7 @@ export default {
* @return {string}
*/
size() {
return formatFileSize(this.fileInfo.size)
return formatFileSize(this.fileInfo?.size)
},
/**
Expand Down Expand Up @@ -337,7 +337,7 @@ export default {
},
getPreviewIfAny(fileInfo) {
if (fileInfo.hasPreview && !this.isFullScreen) {
if (fileInfo?.hasPreview && !this.isFullScreen) {
return generateUrl(`/core/preview?fileId=${fileInfo.id}&x=${screen.width}&y=${screen.height}&a=true`)
}
return this.getIconUrl(fileInfo)
Expand All @@ -351,7 +351,7 @@ export default {
* @return {string} Url to the icon for mimeType
*/
getIconUrl(fileInfo) {
const mimeType = fileInfo.mimetype || 'application/octet-stream'
const mimeType = fileInfo?.mimetype || 'application/octet-stream'
if (mimeType === 'httpd/unix-directory') {
// use default folder icon
if (fileInfo.mountType === 'shared' || fileInfo.mountType === 'shared-root') {
Expand Down
4 changes: 2 additions & 2 deletions dist/4065-4065.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/4065-4065.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/comments-comments-app.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/comments-comments-app.js.LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
*/

/**
* @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com>
* @copyright Copyright (c) 2023 Lucas Azevedo <lhs_azevedo@hotmail.com>
*
* @author John Molakvoæ <skjnldsv@protonmail.com>
* @author Lucas Azevedo <lhs_azevedo@hotmail.com>
*
* @license AGPL-3.0-or-later
*
Expand All @@ -56,7 +56,7 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
Expand Down
2 changes: 1 addition & 1 deletion dist/comments-comments-app.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/comments-comments-tab.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/comments-comments-tab.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/core-common.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-common.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/core-legacy-unified-search.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-legacy-unified-search.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/core-login.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-login.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/core-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-main.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/core-profile.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-profile.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/core-unified-search.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-unified-search.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/dashboard-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/dashboard-main.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/dav-settings-personal-availability.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/dav-settings-personal-availability.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/federatedfilesharing-vue-settings-admin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/federatedfilesharing-vue-settings-admin.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/federatedfilesharing-vue-settings-personal.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/federatedfilesharing-vue-settings-personal.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files-init.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-init.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-main.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files-personal-settings.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-personal-settings.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files-reference-files.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-reference-files.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files-sidebar.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-sidebar.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files_external-init.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files_external-init.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 1ea1f4f

Please sign in to comment.