stream-chat-android icon indicating copy to clipboard operation
stream-chat-android copied to clipboard

The Android recipient user will be allowed to edit the sender's message.

Open openxcellhitesh opened this issue 11 months ago • 2 comments

Describe the bug The Android recipient user will be allowed to edit the sender's message.

So as this is bug can you please remove this option for edit the sender's message. This is also not functioning :)

Check below screenshots for reference purpose.

Screenshot_20240301_160757

SDK version

  • 5.17.21

To Reproduce Steps to reproduce the behaviour

  1. Go to message view
  2. Click on long press to sender's message.
  3. Scroll down to see the option for edit

Expected behavior this edit option need to hide

Device:

  • All Device
  • For all version

Screenshots If applicable, add screenshots to help explain your problem.

openxcellhitesh avatar Mar 01 '24 10:03 openxcellhitesh

We are not able to reproduce in our default sample apps (Compose and XML). Are you maybe calling setOwnCapabilities() anywhere in code and adding ChannelCapabilities.UPDATE_ANY_MESSAGE?

DanielNovak avatar Mar 06 '24 13:03 DanielNovak

Hello Daniel,

Thank you for response but we are not use this in our code still same issue we found.

FInd below code we implemented

 val factory = MessageListViewModelFactory(channelId)
        val messageListHeaderViewModel: MessageListHeaderViewModel by viewModels { factory }
        val messageListViewModel: MessageListViewModel by viewModels { factory }
        val messageInoutViewModel: MessageInputViewModel by viewModels { factory }

        // Set view factory for Imgur attachments
        val imgurAttachmentViewFactory = ImgurAttachmentViewFactory()
        val attachmentViewFactory = AttachmentFactoryManager(listOf(imgurAttachmentViewFactory))
        if (!mBinding.messageListView.isAdapterInitialized())
            mBinding.messageListView.setAttachmentFactoryManager(attachmentViewFactory)

        // Step 2 - Bind the view and ViewModels, they are loosely coupled so it's easy to customize
        messageListHeaderViewModel.bindView(mBinding.messageListHeaderView, this)
        messageListViewModel.bindView(mBinding.messageListView, this)
        messageInoutViewModel.bindView(mBinding.messageInputView, this)

//        // Step 3 - Let both MessageListHeaderView and MessageInputView know when we open a thread
//        // Note: the observe syntax used here requires Kotlin 1.4

        messageListViewModel.mode.observe(viewLifecycleOwner) { mode ->
            when (mode) {
                is MessageListViewModel.Mode.Thread -> {
                    messageListHeaderViewModel.setActiveThread(mode.parentMessage)
                    messageInoutViewModel.setActiveThread(mode.parentMessage)
                }

                MessageListViewModel.Mode.Normal -> {
                    messageListHeaderViewModel.resetThread()
                    messageInoutViewModel.resetThread()
                }
            }
        }

        // Step 5 - Let the message input know when we are editing a message
        mBinding.messageListView.setMessageEditHandler(messageInoutViewModel::editMessage)

openxcellhitesh avatar Mar 12 '24 03:03 openxcellhitesh