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

FIxed deletion of voice, video, image, contact and location messages #3319

Merged
merged 1 commit into from
Oct 2, 2023

Conversation

Smarshal21
Copy link
Member

πŸ–ΌοΈ Screenshots

🏚️ Before | 🏑 After

RESULTS

🚧 TODO

  • Fix the deletion of voice, video, image, contact and location messages

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • πŸ”– Capability is checked or not needed
  • πŸ”™ Backport requests are created or not needed: /backport to stable-xx.x
  • πŸ“… Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

@Smarshal21
Copy link
Member Author

@AndyScherzinger PTAL

@AndyScherzinger AndyScherzinger added the 3. to review Waiting for reviews label Sep 18, 2023
@AndyScherzinger AndyScherzinger added this to the 17.2.0 milestone Sep 18, 2023
@Smarshal21 Smarshal21 force-pushed the Delete_System_Messages branch from 2577140 to 4b25d14 Compare September 19, 2023 06:17
Copy link
Member

@AndyScherzinger AndyScherzinger left a comment

Choose a reason for hiding this comment

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

Breaks the calculation of the delete action by overwritting it. So the original place in the ChatActivity needs to be adapted yet not as simply as done here since there are further rules in place which determine if a chat message can be deleted.

So I think this needs some further work and alignment with @nickvergessen

@mahibi
Copy link
Collaborator

mahibi commented Sep 27, 2023

@Smarshal21
in ChatActivity in method isShowMessageDeletionButton, delete the following lines in the return statement:

message.hasFileAttachment() -> false       # deleting this line should allow deletion of voice, video, image, contact
OBJECT_MESSAGE == message.message -> false    # deleting this line should allow deletion of location 

@AndyScherzinger
Copy link
Member

@mahibi

wouldn't

message.hasFileAttachment() -> false       # deleting this line should allow deletion of voice, video, image, contact

also apply for any other file type then? like "documents" ? Just asking to be sure.

@mahibi
Copy link
Collaborator

mahibi commented Sep 27, 2023

...also apply for any other file type then? like "documents" ? Just asking to be sure.

yes that's true, it's for all other file types as well. but that's okay as far as i know.

@mahibi
Copy link
Collaborator

mahibi commented Sep 27, 2023

One more change i suggest:

Shared files from the Nextcloud instance are handled differently. Currently with a long click it's only possible to "Open in files app", other options like deletion are not available.
To change this, i suggest to remove the
onMessageViewLongClick method
in PreviewMessageViewHolder
and instead of

                clickView!!.setOnLongClickListener { l: View? ->
                    onMessageViewLongClick(message)
                    true
                }

just open the MessageActionDialog via

                clickView!!.setOnLongClickListener { l: View? ->
                    previewMessageInterface!!.onPreviewMessageLongClick(message)
                    true
                }

This would allow reactions and all the other options just like in web.

@Smarshal21 just in case anything is confusing for you, just let me know if i should do these commits

@Smarshal21
Copy link
Member Author

No i would like to handle that

@Smarshal21
Copy link
Member Author

One more change i suggest:

Shared files from the Nextcloud instance are handled differently. Currently with a long click it's only possible to "Open in files app", other options like deletion are not available. To change this, i suggest to remove the onMessageViewLongClick method in PreviewMessageViewHolder and instead of

                clickView!!.setOnLongClickListener { l: View? ->
                    onMessageViewLongClick(message)
                    true
                }

just open the MessageActionDialog via

                clickView!!.setOnLongClickListener { l: View? ->
                    previewMessageInterface!!.onPreviewMessageLongClick(message)
                    true
                }

This would allow reactions and all the other options just like in web.

@Smarshal21 just in case anything is confusing for you, just let me know if i should do these commits

Done πŸ‘πŸ»

@@ -128,7 +128,7 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) :
)
}
clickView!!.setOnLongClickListener { l: View? ->
onMessageViewLongClick(message)
previewMessageInterface!!.onPreviewMessageLongClick(message)
Copy link
Collaborator

Choose a reason for hiding this comment

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

as the method
private fun onMessageViewLongClick(message: ChatMessage)..
is no longer used it can be deleted.
https://github.com/nextcloud/talk-android/pull/3319/files#diff-d097b26ec3d15c322bf4cf32bdb89ba37a00fd8c41bde2109848e68b0e559729R283

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@@ -104,7 +104,7 @@ class MessageActionsDialog(
hasUserActorId(message) &&
currentConversation?.type != ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL
)
initMenuDeleteMessage(showMessageDeletionButton)
initMenuDeleteMessage(ChatMessage.MessageType.SYSTEM_MESSAGE != message.getCalculateMessageType())
Copy link
Collaborator

Choose a reason for hiding this comment

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

this needs to be reverted to be showMessageDeletionButton again so the logic from ChatActivity to show/hide the deletion button is used.

private fun isShowMessageDeletionButton(message: ChatMessage): Boolean {

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@mahibi
Copy link
Collaborator

mahibi commented Sep 29, 2023

@Smarshal21 please make sure to always sign your commits
https://github.com/nextcloud/talk-android/blob/master/CONTRIBUTING.md#sign-your-work

If you're using Android Studio to commit, you can use this checkbox in the UI once you set it up in git-config:
https://docs.github.com/en/get-started/getting-started-with-git/setting-your-username-in-git

image

@Smarshal21
Copy link
Member Author

@Smarshal21 please make sure to always sign your commits https://github.com/nextcloud/talk-android/blob/master/CONTRIBUTING.md#sign-your-work

If you're using Android Studio to commit, you can use this checkbox in the UI once you set it up in git-config: https://docs.github.com/en/get-started/getting-started-with-git/setting-your-username-in-git

image

Sorry for that
Certainly, I will ensure to do so from now on πŸ‘πŸ»

@mahibi
Copy link
Collaborator

mahibi commented Sep 29, 2023

to fix the missing sign-offs in this branch retrospectively,
you could rebase on origin master and then squash all your commits into one commit which is signed off.
After this, you can do a force push to overwrite the origin commits.
Just let me know if you have any questions here.

@Smarshal21 Smarshal21 force-pushed the Delete_System_Messages branch 3 times, most recently from aa63863 to 9f793c2 Compare September 29, 2023 10:01
@mahibi mahibi force-pushed the Delete_System_Messages branch from 9f793c2 to b652e45 Compare October 2, 2023 09:02
@github-actions
Copy link
Contributor

github-actions bot commented Oct 2, 2023

Codacy

Lint

TypemasterPR
Warnings9191
Errors00

SpotBugs

CategoryBaseNew
Correctness99
Dodgy code123123
Internationalization55
Malicious code vulnerability33
Performance88
Security22
Total150150

@github-actions
Copy link
Contributor

github-actions bot commented Oct 2, 2023

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/3319-talk.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud Talk app.

@mahibi mahibi merged commit 703f2c0 into master Oct 2, 2023
14 of 15 checks passed
@delete-merged-branch delete-merged-branch bot deleted the Delete_System_Messages branch October 2, 2023 09:16
Copy link
Contributor

github-actions bot commented Apr 2, 2024

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants