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

fix: remove mainContainerSelector and uiModeStore #13341

Merged
merged 4 commits into from
Sep 19, 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
7 changes: 1 addition & 6 deletions src/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ __webpack_public_path__ = OC.linkTo('spreed', 'js/')

window.OCP.Collaboration.registerType('room', {
action: async () => {
const conversation = await requestRoomSelection('spreed-room-select', {
// Even if it is used from Talk the Collections menu is
// independently loaded, so the properties that depend
// on the store need to be explicitly injected.
container: window.store ? window.store.getters.getMainContainerSelector() : undefined,
})
const conversation = await requestRoomSelection('spreed-room-select', {})
if (!conversation) {
throw new Error('User cancelled resource selection')
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/AdminSettings/BotsSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
</div>
<div :id="`last_error_bot_${bot.id}`" class="last-error">
<NcPopover v-if="bot.last_error_message"
:container="`#last_error_bot_${bot.id}`"
container="#bots_settings"
:focus-trap="false">
<template #trigger>
<NcButton type="error" :aria-label="bot.last_error_message">
Expand Down
3 changes: 0 additions & 3 deletions src/components/AvatarWrapper/AvatarWrapper.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ describe('AvatarWrapper.vue', () => {
const USER_ID = 'user-id'
const USER_NAME = 'John Doe'
const PRELOADED_USER_STATUS = { status: 'online', message: null, icon: null }
const MENU_CONTAINER = '#menu-container'

beforeEach(() => {
testStoreConfig = cloneDeep(storeConfig)
testStoreConfig.modules.uiModeStore.getters.getMainContainerSelector = jest.fn().mockReturnValue(() => MENU_CONTAINER)
store = new Vuex.Store(testStoreConfig)
})

Expand Down Expand Up @@ -86,7 +84,6 @@ describe('AvatarWrapper.vue', () => {

expect(avatar.props('user')).toBe(USER_ID)
expect(avatar.props('displayName')).toBe(USER_NAME)
expect(avatar.props('menuContainer')).toBe(MENU_CONTAINER)
expect(avatar.props('showUserStatus')).toBe(true)
expect(avatar.props('showUserStatusCompact')).toBe(false)
expect(avatar.props('preloadedUserStatus')).toBe(PRELOADED_USER_STATUS)
Expand Down
5 changes: 1 addition & 4 deletions src/components/AvatarWrapper/AvatarWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
:key="id + (isDarkTheme ? '-dark' : '-light')"
:user="id"
:display-name="name"
:menu-container="menuContainerWithFallback"
:menu-container="menuContainer"
:disable-tooltip="disableTooltip"
:disable-menu="disableMenu"
:show-user-status="showUserStatus"
Expand Down Expand Up @@ -201,9 +201,6 @@ export default {
const customName = this.name?.trim() && this.name !== t('spreed', 'Guest') ? this.name : '?'
return customName.charAt(0)
},
menuContainerWithFallback() {
return this.menuContainer ?? this.$store.getters.getMainContainerSelector()
},
avatarUrl() {
return getUserProxyAvatarOcsUrl(this.token, this.id, this.isDarkTheme, this.size > AVATAR.SIZE.MEDIUM ? 512 : 64)
},
Expand Down
7 changes: 1 addition & 6 deletions src/components/BreakoutRoomsEditor/BreakoutRoomsEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
-->

<template>
<NcModal :container="container"
:class="{'modal-mask__participants-step': isEditingParticipants}"
<NcModal :class="{'modal-mask__participants-step': isEditingParticipants}"
:label-id="dialogHeaderId"
v-on="$listeners">
<div class="breakout-rooms-editor"
Expand Down Expand Up @@ -130,10 +129,6 @@ export default {
},

computed: {
container() {
return this.$store.getters.getMainContainerSelector()
},

modalTitle() {
return this.isEditingParticipants
? t('spreed', 'Assign participants to rooms')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,6 @@ export default {
},

computed: {
container() {
return this.$store.getters.getMainContainerSelector()
},

participants() {
return this.$store.getters.participantsList(this.token).filter(participant => {
return (participant.participantType === PARTICIPANT.TYPE.USER
Expand Down
9 changes: 1 addition & 8 deletions src/components/BreakoutRoomsEditor/SendMessageDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@
<template>
<NcDialog ref="dialog"
:name="dialogTitle"
:container="container"
close-on-click-outside
size="normal"
v-on="$listeners"
@update:open="$emit('close')">
<NewMessage v-if="modalContainerId"
:key="modalContainerId"
ref="newMessage"
<NewMessage ref="newMessage"
role="region"
class="send-message-dialog"
:token="token"
Expand Down Expand Up @@ -78,10 +75,6 @@ export default {
},

computed: {
container() {
return this.$store.getters.getMainContainerSelector()
},

dialogTitle() {
return this.broadcast
? t('spreed', 'Send a message to all breakout rooms')
Expand Down
21 changes: 1 addition & 20 deletions src/components/ChatView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,8 @@
</div>

<!-- Input field -->
<NewMessage v-if="containerId"
:key="containerId"
role="region"
<NewMessage role="region"
:token="token"
:container="containerId"
has-typing-indicator
:aria-label="t('spreed', 'Post message')" />

Expand Down Expand Up @@ -113,7 +110,6 @@ export default {
return {
isChatScrolledToBottom: true,
isDraggingOver: false,
containerId: undefined,
}
},

Expand Down Expand Up @@ -163,26 +159,11 @@ export default {
return this.$store.getters.conversation(this.token)
},

container() {
return this.$store.getters.getMainContainerSelector()
},

isLoadingChat() {
return !this.$store.getters.isMessagesListPopulated(this.token)
},
},

watch: {
container(value) {
this.containerId = value
},
},

mounted() {
// Postpone render of NewMessage until application is mounted
this.containerId = this.container
},

methods: {
t,

Expand Down
7 changes: 0 additions & 7 deletions src/components/ConversationIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
:preloaded-user-status="preloadedUserStatus"
:show-user-status="!hideUserStatus"
:show-user-status-compact="!showUserOnlineStatus"
:menu-container="menuContainer"
class="conversation-icon__avatar" />
<div v-if="showCall" class="overlap-icon">
<VideoIcon :size="20" :fill-color="'#E9322D'" />
Expand Down Expand Up @@ -159,12 +158,6 @@ export default {
return getPreloadedUserStatus(this.item)
},

menuContainer() {
// The store may not be defined in the RoomSelector if used from
// the Collaboration menu outside Talk.
return this.$store?.getters.getMainContainerSelector()
},

iconClass() {
if (this.item.isDummyConversation) {
// Prevent a 404 when trying to load an avatar before the conversation data is actually loaded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
:aria-label="t('spreed', 'Conversation settings')"
:name="t('spreed', 'Conversation settings')"
:open.sync="showSettings"
:show-navigation="true"
:container="container">
show-navigation>
<NcAppSettingsSection id="basic-info"
:name="t('spreed', 'Basic Info')">
<BasicInfo :conversation="conversation"
Expand Down Expand Up @@ -161,10 +160,6 @@ export default {
},

computed: {
container() {
return this.$store.getters.getMainContainerSelector()
},

canUserEnableSIP() {
return this.conversation.canEnableSIP
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,9 +533,6 @@ export default {
? t('spreed', 'not running, check Matterbridge log')
: t('spreed', 'not running')
},
container() {
return this.$store.getters.getMainContainerSelector()
},
},

beforeMount() {
Expand Down
7 changes: 1 addition & 6 deletions src/components/GuestWelcomeWindow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
-->

<template>
<NcModal :container="container"
:can-close="false"
<NcModal :can-close="false"
:close-on-click-outside="false"
:label-id="dialogHeaderId"
size="small">
Expand Down Expand Up @@ -100,10 +99,6 @@ export default {
},

computed: {
container() {
return this.$store.getters.getMainContainerSelector()
},

conversation() {
return this.$store.getters.conversation(this.token)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<NcDialog :open="modal"
:name="t('spreed', 'Call a phone number')"
class="call-phone"
:container="container"
size="normal"
close-on-click-outside
@update:open="closeModal">
Expand Down Expand Up @@ -81,12 +80,6 @@ export default {
}
},

computed: {
container() {
return this.$store.getters.getMainContainerSelector()
},
},

expose: ['showModal'],

watch: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@
<template v-if="isDialogOpen" #extra>
<NcDialog :open.sync="isDialogOpen"
:name="t('spreed','Delete conversation')"
:message="dialogMessage"
:container="container">
:message="dialogMessage">
<template #actions>
<NcButton type="tertiary" @click="isDialogOpen = false">
{{ t('spreed', 'No') }}
Expand Down Expand Up @@ -209,10 +208,6 @@ export default {
},

computed: {
container() {
return this.$store.getters.getMainContainerSelector()
},

canFavorite() {
return this.item.participantType !== PARTICIPANT.TYPE.USER_SELF_JOINED
},
Expand Down
5 changes: 0 additions & 5 deletions src/components/LeftSidebar/InvitationHandler.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<template>
<NcDialog :open.sync="modal"
:name="t('spreed', 'Pending invitations')"
:container="container"
size="normal"
close-on-click-outside>
<div class="inbox">
Expand Down Expand Up @@ -115,10 +114,6 @@ export default {
},

computed: {
container() {
return this.$store.getters.getMainContainerSelector()
},

invitations() {
const invitations = {}
for (const id in this.federationStore.pendingShares) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

<template>
<RoomSelector v-if="modal"
:container="container"
list-open-conversations
show-postable-only
:dialog-title="dialogTitle"
Expand Down Expand Up @@ -39,10 +38,6 @@ export default {
},

computed: {
container() {
return this.$store.getters.getMainContainerSelector()
},

dialogTitle() {
return t('spreed', 'Join open conversations')
},
Expand Down
7 changes: 1 addition & 6 deletions src/components/MediaSettings/MediaSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

<template>
<NcModal v-if="modal"
:container="container"
:label-id="dialogHeaderId"
@close="closeModal">
<div class="media-settings">
Expand Down Expand Up @@ -137,7 +136,7 @@
<!-- buttons bar at the bottom -->
<div class="media-settings__call-buttons">
<!-- Silent call -->
<NcActions v-if="showSilentCallOption" :container="container" force-menu>
<NcActions v-if="showSilentCallOption" force-menu>
<NcActionButton v-if="!silentCall"
:name="t('spreed', 'Call without notification')"
close-after-click
Expand Down Expand Up @@ -331,10 +330,6 @@ export default {
},

computed: {
container() {
return this.$store.getters.getMainContainerSelector()
},

displayName() {
return this.$store.getters.getDisplayName()
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
</NcButton>
<NcActions :force-menu="true"
placement="bottom-end"
:container="messageContainer"
:boundaries-element="boundariesElement"
@open="onMenuOpen"
@close="onMenuClose">
Expand Down Expand Up @@ -230,8 +229,7 @@
</template>
</NcButton>

<NcEmojiPicker :container="mainContainer"
:boundary="boundariesElement"
<NcEmojiPicker :boundary="boundariesElement"
placement="auto"
@select="handleReactionClick"
@after-show="onEmojiPickerOpen"
Expand Down Expand Up @@ -427,14 +425,6 @@ export default {
return this.$store.getters.conversation(this.message.token)
},

mainContainer() {
return this.$store.getters.getMainContainerSelector()
},

messageContainer() {
return `#message_${this.message.id}`
},

boundariesElement() {
return this.getMessagesListScroller()
},
Expand Down
Loading
Loading