• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rafalp / Misago / 9487666026

12 Jun 2024 06:16PM UTC coverage: 97.699% (-1.0%) from 98.716%
9487666026

push

github

web-flow
Replace forum options with account settings (#1742)

1947 of 1979 new or added lines in 68 files covered. (98.38%)

661 existing lines in 143 files now uncovered.

52601 of 53840 relevant lines covered (97.7%)

0.98 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.55
/misago/threads/api/threadendpoints/list.py
1
from rest_framework.response import Response
1✔
2

3
from ....core.shortcuts import get_int_or_404
1✔
4
from ...viewmodels import (
1✔
5
    ForumThreads,
6
    PrivateThreads,
7
    PrivateThreadsCategory,
8
    ThreadsCategory,
9
    ThreadsRootCategory,
10
)
11

12

13
class ThreadsList:
1✔
14
    threads = None
1✔
15

16
    def __call__(self, request, **kwargs):
1✔
17
        start = get_int_or_404(request.query_params.get("start", 0))
1✔
18
        list_type = request.query_params.get("list", "all")
1✔
19
        category = self.get_category(request, pk=request.query_params.get("category"))
1✔
20
        threads = self.get_threads(request, category, list_type, start)
1✔
21

22
        return Response(self.get_response_json(request, category, threads)["THREADS"])
1✔
23

24
    def get_category(self, request, pk=None):
1✔
UNCOV
25
        raise NotImplementedError(
×
26
            "Threads list has to implement get_category(request, pk=None)"
27
        )
28

29
    def get_threads(self, request, category, list_type, start):
1✔
30
        return self.threads(  # pylint: disable=not-callable
1✔
31
            request, category, list_type, start
32
        )
33

34
    def get_response_json(self, request, category, threads):
1✔
35
        return threads.get_frontend_context()
1✔
36

37

38
class ForumThreadsList(ThreadsList):
1✔
39
    threads = ForumThreads
1✔
40

41
    def get_category(self, request, pk=None):
1✔
42
        if pk:
1✔
43
            return ThreadsCategory(request, pk=pk)
1✔
44
        return ThreadsRootCategory(request)
1✔
45

46

47
class PrivateThreadsList(ThreadsList):
1✔
48
    threads = PrivateThreads
1✔
49

50
    def get_category(self, request, pk=None):
1✔
51
        return PrivateThreadsCategory(request)
1✔
52

53

54
threads_list_endpoint = ForumThreadsList()
1✔
55
private_threads_list_endpoint = PrivateThreadsList()
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc