Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(Vue3): v-bind checking #12005

Merged
merged 1 commit into from
Apr 5, 2024
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
54 changes: 0 additions & 54 deletions src/assets/missingMaterialDesignIcons/PromotedView.vue

This file was deleted.

3 changes: 1 addition & 2 deletions src/components/BreakoutRoomsEditor/BreakoutRoomsEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
-->

<template>
<NcModal v-bind="$attrs"
:container="container"
<NcModal :container="container"
Copy link
Contributor

Choose a reason for hiding this comment

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

BreakoutRoomsEditor has v-bind="$attrs" on its root element, not needed as it is inherited automatically -> removed

This is not completely correct.

In Vue 3 - yes. Attribute inheritance works for both, HTML attributes and component props.

However, in Vue 2 it doesn't. It inherit attributes only as attributes to put them into $attrs or the HTML element itself. But not as component props.

So, if we remove v-bind here, no BreakoutRoomsEditor attributes will be passed NcModal's props.

Copy link
Contributor

Choose a reason for hiding this comment

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

Still, it is fine to be removed.

Not because "it is inherited automatically" but because this BreakoutRoomsEditor component actually doesn't need this inheritance at all. Currently it is never used with NcModal props.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, I also checked and saw no props are needed from the component $attrs but forgot to mention it 😄

:class="{'modal-mask__participants-step': isEditingParticipants}"
v-on="$listeners">
<div class="breakout-rooms-editor"
Expand Down
2 changes: 1 addition & 1 deletion src/components/CallView/CallView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@

<!-- Stripe or fullscreen grid depending on `isGrid` -->
<Grid v-if="!isSidebar"
v-bind="$attrs"
:is-stripe="!isGrid"
:is-recording="isRecording"
:token="token"
Expand All @@ -108,6 +107,7 @@
:local-media-model="localMediaModel"
:local-call-participant-model="localCallParticipantModel"
:shared-datas="sharedDatas"
v-bind="$attrs"
@select-video="handleSelectVideo"
@click-local-video="handleClickLocalVideo" />

Expand Down
6 changes: 3 additions & 3 deletions src/components/CallView/shared/VideoVue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@
{{ connectionMessage }}
</div>
<slot v-if="!hideBottomBar" name="bottom-bar">
<VideoBottomBar v-bind="$props"
:has-shadow="hasVideo"
:participant-name="participantName" />
<VideoBottomBar :has-shadow="hasVideo"
:participant-name="participantName"
v-bind="$props" />
</slot>
</div>
</template>
Expand Down
8 changes: 4 additions & 4 deletions src/components/MessagesList/MessagesGroup/Message/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
'system' : isSystemMessage,
'combined-system': isCombinedSystemMessage}"
class="message-body">
<MessageBody v-bind="{...$props, ...readInfoProps}"
:rich-parameters="richParameters"
<MessageBody :rich-parameters="richParameters"
:is-deleting="isDeleting"
:has-call="conversation.hasCall" />
:has-call="conversation.hasCall"
v-bind="{...$props, ...readInfoProps}" />

<!-- reactions buttons and popover with details -->
<Reactions v-if="Object.keys(reactions).length"
Expand All @@ -55,13 +55,13 @@
<MessageButtonsBar v-if="showMessageButtonsBar"
ref="messageButtonsBar"
class="message-buttons-bar"
v-bind="{...$props, ...readInfoProps}"
:is-translation-available="isTranslationAvailable"
:is-action-menu-open.sync="isActionMenuOpen"
:is-emoji-picker-open.sync="isEmojiPickerOpen"
:is-reactions-menu-open.sync="isReactionsMenuOpen"
:is-forwarder-open.sync="isForwarderOpen"
:can-react="canReact"
v-bind="{...$props, ...readInfoProps}"
@show-translate-dialog="isTranslateDialogOpen = true"
@reply="handleReply"
@edit="handleEdit"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@

<template>
<component :is="filePreviewElement"
v-bind="filePreviewBinding"
:tabindex="wrapperTabIndex"
class="file-preview"
:class="{ 'file-preview--viewer-available': isViewerAvailable,
'file-preview--upload-editor': isUploadEditor,
'file-preview--shared-items-grid': isSharedItems && !rowLayout,
'file-preview--row-layout': rowLayout }"
v-bind="filePreviewBinding"
@click.exact="handleClick"
@keydown.enter="handleClick">
<span v-if="!isLoading || fallbackLocalUrl"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
<!-- Additional controls -->
<CallButton v-if="showJoinCallButton" />
<Poll v-if="showResultsButton"
v-bind="messageParameters.poll"
:token="token"
show-as-button />
show-as-button
v-bind="messageParameters.poll" />
</div>

<!-- Normal message body content -->
Expand Down
4 changes: 2 additions & 2 deletions src/components/MessagesList/MessagesGroup/MessagesGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
</li>
<Message v-for="(message, index) of messages"
:key="message.id"
v-bind="message"
:token="token"
:is-temporary="message.timestamp === 0"
:next-message-id="(messages[index + 1] && messages[index + 1].id) || nextMessageId"
:previous-message-id="(index > 0 && messages[index - 1].id) || previousMessageId"
:actor-type="actorType"
:actor-id="actorId" />
:actor-id="actorId"
v-bind="message" />
</ul>
</li>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,26 @@
class="messages-group__system">
<ul v-if="messagesCollapsed.messages?.length > 1"
class="messages messages--header">
<Message v-bind="createCombinedSystemMessage(messagesCollapsed)"
:token="token"
<Message :token="token"
is-combined-system-message
:is-combined-system-message-collapsed="messagesCollapsed.collapsed"
:next-message-id="getNextMessageId(messagesCollapsed.messages.at(-1))"
:previous-message-id="getPrevMessageId(messagesCollapsed.messages.at(0))"
:last-collapsed-message-id="messagesCollapsed.lastId"
v-bind="createCombinedSystemMessage(messagesCollapsed)"
@toggle-combined-system-message="toggleCollapsed(messagesCollapsed)" />
</ul>
<ul v-show="messagesCollapsed.messages?.length === 1 || !messagesCollapsed.collapsed"
class="messages"
:class="{'messages--collapsed': messagesCollapsed.messages?.length > 1}">
<Message v-for="message in messagesCollapsed.messages"
:key="message.id"
v-bind="message"
:token="token"
is-collapsed-system-message
:last-collapsed-message-id="messagesCollapsed.lastId"
:next-message-id="getNextMessageId(message)"
:previous-message-id="getPrevMessageId(message)" />
:previous-message-id="getPrevMessageId(message)"
v-bind="message" />
</ul>
</div>
</li>
Expand Down
2 changes: 1 addition & 1 deletion src/components/NewMessage/NewMessageUploadEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
<template v-for="file in files">
<FilePreview :key="file[1].temporaryMessage.id"
:token="token"
is-upload-editor
v-bind="file[1].temporaryMessage.messageParameters.file"
:is-upload-editor="true"
@remove-file="handleRemoveFileFromSelection" />
</template>
<div :key="'addMore'"
Expand Down
3 changes: 1 addition & 2 deletions src/components/TopBar/TopBarMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ import MicrophoneOff from 'vue-material-design-icons/MicrophoneOff.vue'
import RecordCircle from 'vue-material-design-icons/RecordCircle.vue'
import StopIcon from 'vue-material-design-icons/Stop.vue'
import VideoIcon from 'vue-material-design-icons/Video.vue'
import PromotedView from 'vue-material-design-icons/ViewGallery.vue'
import GridView from 'vue-material-design-icons/ViewGrid.vue'

import { getCapabilities } from '@nextcloud/capabilities'
Expand All @@ -186,8 +187,6 @@ import NcActionSeparator from '@nextcloud/vue/dist/Components/NcActionSeparator.
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'

import PromotedView from '../../assets/missingMaterialDesignIcons/PromotedView.vue'

import { useIsInCall } from '../../composables/useIsInCall.js'
import { CALL, CONVERSATION, PARTICIPANT } from '../../constants.js'
import { useBreakoutRoomsStore } from '../../stores/breakoutRooms.ts'
Expand Down
4 changes: 2 additions & 2 deletions src/components/UIShared/TransitionWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
<template>
<TransitionGroup v-if="group"
class="transition-group"
v-bind="$attrs"
:name="name"
v-bind="$attrs"
v-on="$listeners">
<slot />
</TransitionGroup>
<Transition v-else
v-bind="$attrs"
:name="name"
v-bind="$attrs"
v-on="$listeners">
<slot />
</Transition>
Expand Down
Loading