Fix the "watched list" resource.

Review Request #14258 — Created Dec. 4, 2024 and submitted

Information

Review Board
release-7.x

Reviewers

The watched list resource is a special resource that exists only to link
to the other watched item resources. It was completely broken, returning
HTTP 405, due to a bad implementation of our singleton resource pattern.

This change fixes that up to use the correct method name, and
reimplements the body of it to skip the bulk of what the base get_list
implementation would have done.

Fetched the watched list resource and got a response with links instead
of an error.

Summary ID
Fix the "watched list" resource.
The watched list resource is a special resource that exists only to link to the other watched item resources. It was completely broken, returning HTTP 405, due to a bad implementation of our singleton resource pattern. This change fixes that up to use the correct method name, and reimplements the body of it to skip the bulk of what the base `get_list` implementation would have done. Testing Done: Fetched the watched list resource and got a response with links instead of an error.
97b09c6277a60f9b5b5a0d46e09da0bd3de15fa4
Description From Last Updated

Given that this is a pretty big change to the resource (RootResource does a number of things), I think this …

chipx86chipx86

'djblets.util.typing.JSONDict' imported but unused Column: 5 Error code: F401

reviewbotreviewbot

I don't think we want this typing here. If anything, it should be in the base class. The subclass inherits …

chipx86chipx86

Can you add a module docstring while here?

chipx86chipx86

Let's make these keyword-only.

chipx86chipx86

'typing.TYPE_CHECKING' imported but unused Column: 1 Error code: F401

reviewbotreviewbot
maubin
  1. Ship It!
  2. 
      
chipx86
  1. 
      
  2. Show all issues

    Given that this is a pretty big change to the resource (RootResource does a number of things), I think this change needs to come with more comprehensive tests that check the full output of the resource. I'm not 100% sure that this should be a Root Resource, really, since that does have its own implications, and I'd be weary of changes there having unexpected side effects here.

    What error was returned? I feel like we should be starting with that.

  3. 
      
david
david
Review request changed
Change Summary:

Add unit tests.

Commits:
Summary ID
Fix the "watched list" resource.
The watched list resource is a special resource that exists only to link to the other watched item resources. It was completely broken, returning HTTP 405, due to a bad implementation of our singleton resource pattern. This change fixes that up to use the correct method name, and reimplements the body of it to skip the bulk of what the base `get_list` implementation would have done. Testing Done: Fetched the watched list resource and got a response with links instead of an error.
88abb87368503ad3c18f97f58b5e35113a55a0e5
Fix the "watched list" resource.
The watched list resource is a special resource that exists only to link to the other watched item resources. It was completely broken, returning HTTP 405, due to a bad implementation of our singleton resource pattern. This change fixes that up to use the correct method name, and reimplements the body of it to skip the bulk of what the base `get_list` implementation would have done. Testing Done: Fetched the watched list resource and got a response with links instead of an error.
c3b82c23f4a7001935fee10f2953e288c98eafbb

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

david
chipx86
  1. 
      
  2. reviewboard/webapi/tests/test_watched.py (Diff revision 4)
     
     
     
     
     
     
    Show all issues

    I don't think we want this typing here. If anything, it should be in the base class. The subclass inherits the types. Having these here can result in conflicts fixing up the base class.

  3. reviewboard/webapi/tests/urls.py (Diff revision 4)
     
     
    Show all issues

    Can you add a module docstring while here?

  4. reviewboard/webapi/tests/urls.py (Diff revision 4)
     
     
     
     
     
    Show all issues

    Let's make these keyword-only.

    1. I think I'd prefer to match everything else in this file.

  5. 
      
david
Review request changed
Commits:
Summary ID
Fix the "watched list" resource.
The watched list resource is a special resource that exists only to link to the other watched item resources. It was completely broken, returning HTTP 405, due to a bad implementation of our singleton resource pattern. This change fixes that up to use the correct method name, and reimplements the body of it to skip the bulk of what the base `get_list` implementation would have done. Testing Done: Fetched the watched list resource and got a response with links instead of an error.
e4eee6e7bca081a1aa363507e15ca6b418bad1e7
Fix the "watched list" resource.
The watched list resource is a special resource that exists only to link to the other watched item resources. It was completely broken, returning HTTP 405, due to a bad implementation of our singleton resource pattern. This change fixes that up to use the correct method name, and reimplements the body of it to skip the bulk of what the base `get_list` implementation would have done. Testing Done: Fetched the watched list resource and got a response with links instead of an error.
95c44910f450c4a29f50f694429daad1815ad957

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

david
chipx86
  1. Ship It!
  2. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to release-7.x (55da94f)