Repository: kiwitcms/Kiwi (language: python)

Issue:
Refactor remove_link function to handle empty query in testexecution.py
The remove_link function in testexecution.py has been refactored to handle the case where the query parameter is empty. This change ensures that the LinkReference objects are only deleted when the query is not empty, preventing any unintended deletions.
Bug hyperlink added to the test execution is getting disappeared after some period of time.

### Description of problem
Bug hyperlink added to the test execution is not seen after some period of time.


### Version or commit hash (if applicable)
Version 13.4 Enterprise

### Steps to Reproduce

1. Go to Test Run.
2. Open a Test Execution.
3. Click on "Add Hyperlink" and enter the URL of the bug created in Jira,
4. Toggle the button to Yes in "Is a defect".
5. Click on the Save button.

### Actual results
After adding the bug hyperlink, a bug icon will appear on the test execution and the bug link can be found under the "Bugs and hyperlinks".

After a period of time (say, a few weeks), the bug icon and hyperlink disappear. 

### Expected results

Hyperlink should have seen all time in the test execution of the test run.

### Additional info (Python traceback, logs, etc.)



Discussion / hints:

Fix patch:
diff --git a/requirements/readthedocs.txt b/requirements/readthedocs.txt
index 53e5bfa094..ac34f61e78 100644
--- a/requirements/readthedocs.txt
+++ b/requirements/readthedocs.txt
@@ -1,6 +1,6 @@
 -r base.txt
 
-Sphinx
+Sphinx==7.4.7
 sphinx-removed-in
 docutils
 


Test patch:
diff --git a/tcms/testruns/static/testruns/js/get.js b/tcms/testruns/static/testruns/js/get.js
index eed944d68d..3f9d782362 100644
--- a/tcms/testruns/static/testruns/js/get.js
+++ b/tcms/testruns/static/testruns/js/get.js
@@ -920,9 +920,11 @@ export function bindDeleteLinkButton () {
         const row = $(event.target).parents('li')
         const linkId = $(event.target).parent('.js-remove-linkreference').data('link-id')
 
-        jsonRPC('TestExecution.remove_link', { pk: linkId }, () => {
-            $(row).fadeOut(500)
-        })
+        if (linkId) {
+            jsonRPC('TestExecution.remove_link', { pk: linkId }, () => {
+                $(row).fadeOut(500)
+            })
+        }
         return false
     })
 }