Skip to content

Commit

Permalink
smaller video chat bugfixes (#3186)
Browse files Browse the repository at this point in the history
* do not save custom video chat provider if it only contains whitespaces

* sendCallInvitation: show error message
instead of `[object Object]`

* don't show video chat in attachment menu when the feature is turned off

* update changelog

somehow forgot to commit it
  • Loading branch information
Simon-Laux authored Apr 13, 2023
1 parent a6fa467 commit cb18f87
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
- improve confirm abort dialog for setup second device #3173

### Fixed
- do not save custom video chat provider if it only contains whitespaces
- fix show error messages when starting a video chat
- don't show video chat in attachment menu when the feature is turned off
- fix "Always Load Remote Images" should be hidden for contact requests #3180

<a id="1_36_1"></a>
Expand Down
7 changes: 5 additions & 2 deletions src/renderer/components/attachment/menuAttachment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { MEDIA_EXTENSIONS } from '../../../shared/constants'

import { sendCallInvitation } from '../helpers/ChatMethods'
import { Type } from '../../backend-com'
import { useStore } from '../../stores/store'
import SettingsStoreInstance from '../../stores/settings'
//function to populate Menu
const MenuAttachmentItems = ({
itemsArray,
Expand Down Expand Up @@ -44,6 +46,7 @@ const MenuAttachment = ({
}) => {
const tx = useTranslationFunction()
const screenContext = useContext(ScreenContext)
const [settings] = useStore(SettingsStoreInstance)
const addFilenameFile = async () => {
//function for files
const file = await runtime.showOpenFileDialog({
Expand Down Expand Up @@ -94,7 +97,7 @@ const MenuAttachment = ({
}
// item array used to populate menu
const items = [
{
settings?.settings.webrtc_instance && {
id: 0,
icon: 'phone' as IconName,
text: tx('videochat'),
Expand All @@ -115,7 +118,7 @@ const MenuAttachment = ({
onClick: addFilenameFile.bind(null),
attachment: 'attachment-files',
},
]
].filter(item => !!item) as MenuAttachmentItemObject[]

return (
<div className='attachment-button'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export function EditVideochatInstanceDialog({
}
const onClickOk = () => {
onClose()
onOk(configValue)
onOk(configValue.trim()) // the trim is here to not save custom provider if it only contains whitespaces
}
const onChangeRadio = (event: FormEvent<HTMLInputElement>) => {
const currentRadioValue = event.currentTarget.value as RadioButtonValue
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/components/helpers/ChatMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ export async function sendCallInvitation(
await joinCall(screenContext, messageId)
} catch (error: todo) {
log.error('failed send call invitation', error)
screenContext.openDialog(AlertDialog, { message: error.toString() })
screenContext.openDialog(AlertDialog, {
message: error?.message || error.toString(),
})
}
}

Expand Down

0 comments on commit cb18f87

Please sign in to comment.