Leantime / leantime

Leantime is a goals focused project management system for non-project managers. Building with ADHD, Autism, and dyslexia in mind.
https://leantime.io
GNU Affero General Public License v3.0
4.49k stars 586 forks source link

[IMPROVEMENT] Fixing URL patterns in notifications (Mail and User Interface) for comment notifications (edited) #2556

Open pvi-github opened 3 months ago

pvi-github commented 3 months ago

If you have problems with the installation please use our community forum

No installation problem

What set up are you using

Describe the bug In Leantime (master version) at the time of the ticket the URLS in emails and notification look like this : https://theserver/tickets/showTicket/169&projectId=8

While in kanban they look like this : https://theserver/tickets/showKanban?showTicketModal=169#/tickets/showTicket/169

The important par i think is the last part : #/tickets/showTicket/169

The difference is that With the latter URL the ticket is opened for review/edition while this the first URL we get redirected on the Kanban global view.

To Reproduce Steps to reproduce the behavior:

See above the detailed description

Expected behavior Clicking into tickets links in mails or notifications should lead to showing the ticket instead of the global Kanban view.

Leantime Version Master & Last 3..1.4 version

Server NGinX + PHP-FPM

PHP / MySQL Version Please list the PHP and Mysql version you are using PHP 8.2

Additional context N/A

pvi-github commented 3 months ago

Erratum : wrong url analysis. The only problematic urls are like "/tickets/showTicket/xxx&projectId=y"

Other URL beginning with "/dashboard/home/" are working.

The problematic notifications are all linked with comments.

pvi-github commented 3 months ago

It seems the problem has been somehow fixed in master there: a91b8ccc0f9aefcd7ff773aacd3a8bd0c588dc19

The link with this is now opening the ticket. Though it does not position reader on the target comment. And ideally highlight the comment.

pvi-github commented 3 months ago

Further thoughts :

Editing template to attach id to comments would be easy:

in app/Domain/Comments/Templates/submodules/generalComment.sub.php

 <div class="commentContent" >

And change it for

 <div class="commentContent" id="comment<?= $row['id'] ?>">

What will be more difficult is forcing the scroll down as the modal overlay is javascript loaded. With the way the page is loaded just putting something like #comment59 at the end of urls would not bring the expected result.

So we woud need to patch javascript to get last part of url #contentxx and then scroll the page to make visible the html element bearing the target id "commentxx".

Highlighting it would be easier as we know prom url what comment we target we coud either:

The advantage of the javascript part is that we could make this color progressively vanish after maybe 30 seconds for a wow effect...

marcelfolaron commented 3 months ago

Nice and great points. I am actually refactoring the comments and ticket views right now. Let me see how hard that would be to implement: https://github.com/Leantime/leantime/tree/commentsComponent

pvi-github commented 3 months ago

Cool :)

By the way @marcelfolaron let me add a tiny warning : The fix in a91b8ccc0f9aefcd7ff773aacd3a8bd0c588dc19 works for new comments but it does not adress wrong urls that are already in notification table.

You might want to do something like :

UPDATE xxx_notifications SET url= REPLACE(url,"$BASE_URL/tickets","$BASE_URL#/tickets");

Otherwise clicking on old comments links in notification list would still lead people to global view instead of expected tickets.

marcelfolaron commented 1 month ago

Just a quick note: Thank you for the investigation. I'll check the sql script and will add it to one of our db updates in the next release.