chat-e2ee icon indicating copy to clipboard operation
chat-e2ee copied to clipboard

added feature of terminating when the link is deleted issue number #352 issue has been solved

Open chandankumarm55 opened this issue 5 months ago • 7 comments

Hey, thanks for assigning this issue to me!

I successfully implemented this feature. Most of the files show changes due to the addition of a cursor at the end. In the frontend, we used a useEffect hook to validate whether the link is valid or not. We also applied a throttling concept to check this condition every second. You can modify the interval to your preference, but 1 second is optimal for performance.

Things you need to change for production mode:

You need to update the URL used for sending the request in the file client/src/pages/messaging/index.tsx at line 270. For production, the URL should be https://chat-e2ee-2.azurewebsites.net/api/chat-link/status/${channelID}. Make sure you use backticks for this. For now, I’ve used localhost for running it locally.

Screenshot 2024-09-13 125631

Please refer to the commits for a better understanding. You can also use an .env file and access the URL via process.env.BACKEND_URL, but for now, I’ve added the URL directly to reduce confusion.

I have also tested the app locally. Only one test failed due to the absence of an absolute link, which we declared as undefined. This is causing the following error:

The detailed failed test case can be found in the file backend/api/chatLink/utils/link.test.ts at line 19. The error is caused by absoluteLink: undefined, which is why the test failed.

Screenshot 2024-09-13 130357

Screenshot 2024-09-13 130424

i think this is not matter that much . and console when we start the app looks like

Screenshot 2024-09-13 134939

I implemented the feature where the throttling function runs every second and renders the component when linkActive becomes invalid. After 2 seconds, it will navigate to the / route (home route). You can adjust this timing based on your preference.

I chose 2 seconds as an optimal delay to inform the user that the link is invalid. Using a longer delay might send more requests to the backend, leading to performance issues. On the other hand, if we use a 1-second delay, there might not be enough time for the user to read the message. Therefore, I think 2 seconds strikes a good balance, but you can modify it according to your needs.

https://github.com/user-attachments/assets/ed78425e-e80e-48df-b468-f195c0c07c7d

now Related to delete link feature #352 issue has been solved

fell free to as anything , to ask regarding this issue impentation . Thank you for guiding at every step @muke1908

chandankumarm55 avatar Sep 13 '24 12:09 chandankumarm55