id int64 0 458k | file_name stringlengths 4 119 | file_path stringlengths 14 227 | content stringlengths 24 9.96M | size int64 24 9.96M | language stringclasses 1
value | extension stringclasses 14
values | total_lines int64 1 219k | avg_line_length float64 2.52 4.63M | max_line_length int64 5 9.91M | alphanum_fraction float64 0 1 | repo_name stringlengths 7 101 | repo_stars int64 100 139k | repo_forks int64 0 26.4k | repo_open_issues int64 0 2.27k | repo_license stringclasses 12
values | repo_extraction_date stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
18,000 | search.py | rafalp_Misago/misago/threads/search.py | from django.contrib.postgres.search import (
SearchHeadline,
SearchQuery,
SearchRank,
SearchVector,
)
from django.utils.translation import pgettext_lazy
from ..conf import settings
from ..core.shortcuts import paginate, pagination_dict
from ..search import SearchProvider
from .filtersearch import filte... | 3,362 | Python | .py | 95 | 25.989474 | 88 | 0.605725 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,001 | apps.py | rafalp_Misago/misago/threads/apps.py | from django.apps import AppConfig
class MisagoThreadsConfig(AppConfig):
name = "misago.threads"
label = "misago_threads"
verbose_name = "Misago Threads"
def ready(self):
from . import signals as _
| 224 | Python | .py | 7 | 27.142857 | 37 | 0.71028 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,002 | context_processors.py | rafalp_Misago/misago/threads/context_processors.py | from django.urls import reverse
def preload_threads_urls(request):
request.frontend_context.update(
{
"ATTACHMENTS_API": reverse("misago:api:attachment-list"),
"THREAD_EDITOR_API": reverse("misago:api:thread-editor"),
"THREADS_API": reverse("misago:api:thread-list"),
... | 497 | Python | .py | 12 | 32.833333 | 77 | 0.634855 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,003 | mergeconflict.py | rafalp_Misago/misago/threads/mergeconflict.py | from django.utils.translation import pgettext
from rest_framework.exceptions import ValidationError
from .models import Poll
class MergeConflictHandler:
def __init__(self, threads):
self.items = []
self.choices = {0: None}
self._is_valid = False
self._resolution = None
s... | 4,683 | Python | .py | 112 | 32.3125 | 84 | 0.632738 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,004 | utils.py | rafalp_Misago/misago/threads/utils.py | from urllib.parse import urlparse
from django.urls import Resolver404, resolve
from .models import PostLike
def add_categories_to_items(root_category, categories, items):
categories_dict = {}
for category in categories:
categories_dict[category.pk] = category
if category.parent_id:
... | 2,031 | Python | .py | 54 | 31.388889 | 87 | 0.670588 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,005 | events.py | rafalp_Misago/misago/threads/events.py | from django.utils import timezone
from .models import Post
def record_event(request, thread, event_type, context=None, commit=True):
time_now = timezone.now()
event = Post.objects.create(
category=thread.category,
thread=thread,
poster=request.user,
poster_name=request.user.u... | 795 | Python | .py | 26 | 23.307692 | 73 | 0.64042 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,006 | validators.py | rafalp_Misago/misago/threads/validators.py | from django.core.exceptions import ValidationError
from django.utils.module_loading import import_string
from django.utils.translation import npgettext, pgettext
from .. import hooks
from ..categories import THREADS_ROOT_NAME
from ..categories.models import Category
from ..categories.permissions import can_browse_cate... | 4,954 | Python | .py | 113 | 35.469027 | 105 | 0.65843 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,007 | checksums.py | rafalp_Misago/misago/threads/checksums.py | from ..markup import checksums
def is_post_valid(post):
valid_checksum = make_post_checksum(post)
return post.checksum == valid_checksum
def make_post_checksum(post):
post_seeds = [str(v) for v in (post.id, str(post.posted_on.date()))]
return checksums.make_checksum(post.parsed, post_seeds)
def up... | 416 | Python | .py | 10 | 37.6 | 72 | 0.7375 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,008 | threadurl.py | rafalp_Misago/misago/threads/threadurl.py | from django.urls import reverse
from ..categories.enums import CategoryTree
from ..categories.models import Category
from .models import Thread
def get_thread_url(thread: Thread, category: Category | None = None) -> str:
return _get_thread_url_action(thread, category)
def _get_thread_url_action(thread: Thread,... | 818 | Python | .py | 17 | 42.647059 | 86 | 0.697352 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,009 | participants.py | rafalp_Misago/misago/threads/participants.py | from django.contrib.auth import get_user_model
from ..notifications.tasks import notify_on_new_private_thread
from .events import record_event
from .models import Thread, ThreadParticipant
User = get_user_model()
def has_participants(thread):
return thread.threadparticipant_set.exists()
def make_participants_... | 5,481 | Python | .py | 143 | 29.391608 | 87 | 0.633704 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,010 | postlike.py | rafalp_Misago/misago/threads/models/postlike.py | from django.conf import settings
from django.db import models
from django.utils import timezone
class PostLike(models.Model):
category = models.ForeignKey("misago_categories.Category", on_delete=models.CASCADE)
thread = models.ForeignKey("misago_threads.Thread", on_delete=models.CASCADE)
post = models.For... | 716 | Python | .py | 15 | 42.933333 | 88 | 0.747126 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,011 | pollvote.py | rafalp_Misago/misago/threads/models/pollvote.py | from django.conf import settings
from django.db import models
from django.utils import timezone
class PollVote(models.Model):
category = models.ForeignKey("misago_categories.Category", on_delete=models.CASCADE)
thread = models.ForeignKey("misago_threads.Thread", on_delete=models.CASCADE)
poll = models.For... | 824 | Python | .py | 18 | 40.388889 | 88 | 0.726027 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,012 | post.py | rafalp_Misago/misago/threads/models/post.py | import copy
from django.contrib.postgres.indexes import GinIndex
from django.contrib.postgres.search import SearchVector, SearchVectorField
from django.db import models
from django.db.models import Q
from django.urls import reverse
from django.utils import timezone
from ...conf import settings
from ...core.utils impo... | 7,934 | Python | .py | 187 | 33.764706 | 88 | 0.647624 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,013 | thread.py | rafalp_Misago/misago/threads/models/thread.py | from functools import cached_property
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.db.models import Q
from django.utils import timezone
from django.utils.translation import pgettext_lazy
from ...conf import settings
from ...core.utils import slugify
from ...plugins.mo... | 11,367 | Python | .py | 280 | 31.442857 | 88 | 0.629445 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,014 | poll.py | rafalp_Misago/misago/threads/models/poll.py | from datetime import timedelta
from math import ceil
from django.conf import settings
from django.db import models
from django.utils import timezone
from ...plugins.models import PluginDataModel
class Poll(PluginDataModel):
category = models.ForeignKey("misago_categories.Category", on_delete=models.CASCADE)
... | 2,965 | Python | .py | 76 | 29.960526 | 88 | 0.631928 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,015 | __init__.py | rafalp_Misago/misago/threads/models/__init__.py | from .post import Post
from .postedit import PostEdit
from .postlike import PostLike
from .thread import Thread
from .threadparticipant import ThreadParticipant
from .subscription import Subscription
from .attachmenttype import AttachmentType
from .attachment import Attachment
from .poll import Poll
from .pollvote impo... | 332 | Python | .py | 10 | 32.2 | 48 | 0.875776 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,016 | attachment.py | rafalp_Misago/misago/threads/models/attachment.py | import os
from hashlib import md5
from io import BytesIO
from django.core.files import File
from django.core.files.base import ContentFile
from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.crypto import get_random_string
from PIL import Image
from ...conf... | 4,090 | Python | .py | 100 | 33.35 | 87 | 0.666667 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,017 | subscription.py | rafalp_Misago/misago/threads/models/subscription.py | from django.db import models
from django.utils import timezone
from ...conf import settings
class Subscription(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
thread = models.ForeignKey("Thread", on_delete=models.CASCADE)
category = models.ForeignKey("misago_ca... | 593 | Python | .py | 13 | 40.230769 | 88 | 0.732174 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,018 | postedit.py | rafalp_Misago/misago/threads/models/postedit.py | import difflib
from django.conf import settings
from django.db import models
from django.utils import timezone
class PostEdit(models.Model):
category = models.ForeignKey("misago_categories.Category", on_delete=models.CASCADE)
thread = models.ForeignKey("misago_threads.Thread", on_delete=models.CASCADE)
p... | 951 | Python | .py | 22 | 38.045455 | 88 | 0.731813 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,019 | attachmenttype.py | rafalp_Misago/misago/threads/models/attachmenttype.py | from django.db import models
from django.utils.translation import pgettext_lazy
from ...plugins.models import PluginDataModel
class AttachmentType(PluginDataModel):
ENABLED = 0
LOCKED = 1
DISABLED = 2
name = models.CharField(max_length=255)
extensions = models.CharField(max_length=255)
mimet... | 1,905 | Python | .py | 61 | 21.147541 | 71 | 0.56325 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,020 | threadparticipant.py | rafalp_Misago/misago/threads/models/threadparticipant.py | from django.db import models
from ...conf import settings
class ThreadParticipantManager(models.Manager):
def set_owner(self, thread, user):
ThreadParticipant.objects.filter(thread=thread, is_owner=True).update(
is_owner=False
)
self.remove_participant(thread, user)
... | 1,046 | Python | .py | 21 | 42.761905 | 84 | 0.728797 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,021 | misago_poststags.py | rafalp_Misago/misago/threads/templatetags/misago_poststags.py | from django import template
from django.utils.translation import npgettext, pgettext
register = template.Library()
@register.simple_tag
def likes_label(post):
last_likes = post.last_likes or []
usernames = []
for like in last_likes[:3]:
usernames.append(like["username"])
if len(usernames) =... | 1,281 | Python | .py | 33 | 32.363636 | 82 | 0.635113 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,022 | 0012_set_dj_partial_indexes.py | rafalp_Misago/misago/threads/migrations/0012_set_dj_partial_indexes.py | # Generated by Django 2.2.1 on 2019-05-18 16:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("misago_threads", "0011_remove_custom_partial_indexes")]
operations = [
migrations.AddIndex(
model_name="post",
index=models.Index(... | 2,903 | Python | .py | 86 | 20.94186 | 77 | 0.493423 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,023 | 0002_threads_settings.py | rafalp_Misago/misago/threads/migrations/0002_threads_settings.py | from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("misago_threads", "0001_initial"), ("misago_conf", "0001_initial")]
operations = []
| 184 | Python | .py | 4 | 42.25 | 88 | 0.723164 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,024 | 0007_auto_20171008_0131.py | rafalp_Misago/misago/threads/migrations/0007_auto_20171008_0131.py | # Generated by Django 1.11.5 on 2017-10-08 01:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("misago_threads", "0006_redo_partial_indexes")]
operations = [
migrations.AlterField(
model_name="post",
name="posted_on",
... | 383 | Python | .py | 11 | 27.727273 | 68 | 0.647696 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,025 | 0010_auto_20180609_1523.py | rafalp_Misago/misago/threads/migrations/0010_auto_20180609_1523.py | # Generated by Django 1.11.13 on 2018-06-09 15:23
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("misago_threads", "0009_auto_20180326_0010")]
operations = [
migrations.RemoveField(model_name="attachment", name="uploader_ip"),
migrations.RemoveField(m... | 649 | Python | .py | 12 | 47.833333 | 76 | 0.70347 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,026 | 0006_redo_partial_indexes.py | rafalp_Misago/misago/threads/migrations/0006_redo_partial_indexes.py | # Generated by Django 1.11.1 on 2017-05-21 17:52
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("misago_threads", "0005_index_search_document")]
operations = []
| 214 | Python | .py | 5 | 39.6 | 69 | 0.747573 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,027 | 0005_index_search_document.py | rafalp_Misago/misago/threads/migrations/0005_index_search_document.py | # Generated by Django 1.11.1 on 2017-05-21 17:52
import django.contrib.postgres.indexes
from django.contrib.postgres.operations import BtreeGinExtension
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("misago_threads", "0004_update_settings")]
operations = [
B... | 572 | Python | .py | 15 | 31.066667 | 79 | 0.680505 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,028 | 0001_initial.py | rafalp_Misago/misago/threads/migrations/0001_initial.py | import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.contrib.postgres.search import SearchVectorField
from django.db import migrations, models
import misago.threads.models.attachment
class Migration(migrations.Migration):
initial = True
dependencies = [
... | 24,849 | Python | .py | 654 | 20.180428 | 88 | 0.420298 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,029 | 0009_auto_20180326_0010.py | rafalp_Misago/misago/threads/migrations/0009_auto_20180326_0010.py | # Generated by Django 1.11.9 on 2018-03-26 00:10
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("misago_threads", "0008_auto_20180310_2234")]
operations = []
| 211 | Python | .py | 5 | 39 | 66 | 0.743842 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,030 | 0003_attachment_types.py | rafalp_Misago/misago/threads/migrations/0003_attachment_types.py | # Generated by Django 1.9.7 on 2016-10-04 21:41
from django.db import migrations
ATTACHMENTS = [
{
"name": "GIF",
"extensions": ("gif",),
"mimetypes": ("image/gif",),
"size_limit": 5 * 1024,
},
{
"name": "JPG",
"extensions": ("jpg", "jpeg"),
"mimetype... | 2,628 | Python | .py | 97 | 19.597938 | 71 | 0.487921 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,031 | 0008_auto_20180310_2234.py | rafalp_Misago/misago/threads/migrations/0008_auto_20180310_2234.py | # Generated by Django 1.11.9 on 2018-03-10 22:34
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("misago_threads", "0007_au... | 1,846 | Python | .py | 53 | 23.811321 | 74 | 0.560335 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,032 | 0011_remove_custom_partial_indexes.py | rafalp_Misago/misago/threads/migrations/0011_remove_custom_partial_indexes.py | # Generated by Django 2.2.1 on 2019-05-18 16:31
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("misago_threads", "0010_auto_20180609_1523")]
operations = [
migrations.RunSQL("DROP INDEX IF EXISTS misago_thre_has_ope_479906_part"),
migrations.RunSQL("... | 1,043 | Python | .py | 16 | 58.1875 | 82 | 0.723363 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,033 | 0004_update_settings.py | rafalp_Misago/misago/threads/migrations/0004_update_settings.py | from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("misago_threads", "0003_attachment_types")]
operations = []
| 160 | Python | .py | 4 | 36.25 | 64 | 0.751634 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,034 | 0013_rename_pollvote_poll_voter_name_misago_thre_poll_id_c3e8fe_idx_and_more.py | rafalp_Misago/misago/threads/migrations/0013_rename_pollvote_poll_voter_name_misago_thre_poll_id_c3e8fe_idx_and_more.py | # Generated by Django 4.2.7 on 2023-11-13 19:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("misago_acl", "0004_cache_version"),
("misago_threads", "0012_set_dj_partial_indexes"),
]
operations = [
migrations.RenameIndex(
... | 2,214 | Python | .py | 63 | 24.428571 | 66 | 0.541686 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,035 | 0014_plugin_data.py | rafalp_Misago/misago/threads/migrations/0014_plugin_data.py | # Generated by Django 4.2.7 on 2023-12-05 19:22
import django.contrib.postgres.indexes
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
(
"misago_threads",
"0013_rename_pollvote_poll_voter_name_misago_thre_poll_id_c3e8fe_idx_and_more... | 2,287 | Python | .py | 67 | 23.283582 | 91 | 0.556859 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,036 | thread.py | rafalp_Misago/misago/threads/views/thread.py | from django.shortcuts import render
from django.urls import reverse
from django.views import View
from ..viewmodels import ForumThread, PrivateThread, ThreadPosts
class ThreadBase(View):
thread = None
posts = ThreadPosts
template_name = None
def get(self, request, pk, slug, page=0):
thread ... | 2,158 | Python | .py | 55 | 30.654545 | 85 | 0.646974 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,037 | redirect.py | rafalp_Misago/misago/threads/views/redirect.py | from django.core.exceptions import PermissionDenied
from django.http import Http404, HttpRequest, HttpResponse
from django.db.models import QuerySet
from django.shortcuts import get_object_or_404, redirect
from django.utils.translation import pgettext
from django.views import View
from ...categories.enums import Categ... | 5,582 | Python | .py | 123 | 38.504065 | 86 | 0.716346 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,038 | generic.py | rafalp_Misago/misago/threads/views/generic.py | from typing import Iterable
from django.core.paginator import Paginator
from django.db.models import QuerySet
from django.http import HttpRequest
from django.http.response import HttpResponse as HttpResponse
from django.shortcuts import get_object_or_404
from django.urls import reverse
from django.views import View
f... | 3,880 | Python | .py | 90 | 35.988889 | 87 | 0.686555 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,039 | attachment.py | rafalp_Misago/misago/threads/views/attachment.py | from django.templatetags.static import static
from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.shortcuts import get_object_or_404, redirect
from ...conf import settings
from ..models import Attachment, AttachmentType
def attachment_server(request, pk, secret, thumbnail=... | 2,319 | Python | .py | 50 | 39.26 | 85 | 0.713525 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,040 | replies.py | rafalp_Misago/misago/threads/views/replies.py | from datetime import datetime
from typing import TYPE_CHECKING, Any
from django.contrib.auth import get_user_model
from django.db.models import QuerySet, prefetch_related_objects
from django.http import HttpRequest, HttpResponse
from django.shortcuts import redirect, render
from django.views import View
from ...categ... | 11,210 | Python | .py | 275 | 31.872727 | 88 | 0.633361 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,041 | subscribed.py | rafalp_Misago/misago/threads/views/subscribed.py | from django.http import HttpRequest
from django.shortcuts import redirect
def redirect_subscribed_to_watched(request: HttpRequest, **kwargs):
return redirect(
request.path.replace("/subscribed/", "/watched/"),
permanent=True,
)
| 254 | Python | .py | 7 | 31.571429 | 67 | 0.734694 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,042 | list.py | rafalp_Misago/misago/threads/views/list.py | import re
from math import ceil
from typing import Any, TYPE_CHECKING, Type
from django.contrib import messages
from django.contrib.auth import get_user_model
from django.core.exceptions import PermissionDenied, ValidationError
from django.db import transaction
from django.http import Http404, HttpRequest
from django.... | 53,026 | Python | .py | 1,237 | 32.28941 | 90 | 0.619326 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,043 | __init__.py | rafalp_Misago/misago/threads/moderation/__init__.py | from .exceptions import ModerationError
from .threads import *
from .posts import *
| 84 | Python | .py | 3 | 27 | 39 | 0.82716 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,044 | posts.py | rafalp_Misago/misago/threads/moderation/posts.py | from django.db import transaction
from django.utils import timezone
from django.utils.translation import pgettext
from .exceptions import ModerationError
__all__ = [
"approve_post",
"protect_post",
"unprotect_post",
"unhide_post",
"hide_post",
"delete_post",
]
def approve_post(user, post):
... | 2,383 | Python | .py | 81 | 22.518519 | 88 | 0.631579 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,045 | threads.py | rafalp_Misago/misago/threads/moderation/threads.py | from django.db import transaction
from django.utils import timezone
from ...notifications.tasks import delete_duplicate_watched_threads
from ..events import record_event
__all__ = [
"change_thread_title",
"pin_thread_globally",
"pin_thread_locally",
"unpin_thread",
"move_thread",
"merge_thread... | 4,524 | Python | .py | 144 | 25.743056 | 82 | 0.684077 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,046 | exceptions.py | rafalp_Misago/misago/threads/moderation/exceptions.py | # pylint: disable=super-init-not-called
class ModerationError(Exception):
def __init__(self, message):
self.message = message
def __str__(self):
return self.message
| 190 | Python | .py | 6 | 26.5 | 39 | 0.672131 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,047 | api.py | rafalp_Misago/misago/threads/urls/api.py | from ...core.apirouter import MisagoApiRouter
from ..api.attachments import AttachmentViewSet
from ..api.threadpoll import ThreadPollViewSet
from ..api.threadposts import PrivateThreadPostsViewSet, ThreadPostsViewSet
from ..api.threads import PrivateThreadViewSet, ThreadViewSet
router = MisagoApiRouter()
router.regis... | 906 | Python | .py | 21 | 40.952381 | 86 | 0.790909 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,048 | __init__.py | rafalp_Misago/misago/threads/urls/__init__.py | from django.urls import path
from ...conf import settings
from ..views.attachment import attachment_server
from ..views.list import category_threads, private_threads, threads
from ..views.redirect import (
PostRedirectView,
PrivateThreadLastPostRedirectView,
PrivateThreadUnapprovedPostRedirectView,
Pr... | 3,571 | Python | .py | 132 | 20.628788 | 79 | 0.610026 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,049 | threadposts.py | rafalp_Misago/misago/threads/api/threadposts.py | from django.core.exceptions import PermissionDenied
from django.db import transaction
from django.utils.translation import pgettext
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.response import Response
from ...acl.objectacl import add_acl_to_obj
from ...categorie... | 8,875 | Python | .py | 205 | 34.263415 | 88 | 0.640153 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,050 | pollvotecreateendpoint.py | rafalp_Misago/misago/threads/api/pollvotecreateendpoint.py | from copy import deepcopy
from rest_framework.response import Response
from ...acl.objectacl import add_acl_to_obj
from ..permissions import allow_vote_poll
from ..serializers import NewVoteSerializer, PollSerializer
def poll_vote_create(request, thread, poll):
poll.make_choices_votes_aware(request.user)
a... | 2,063 | Python | .py | 48 | 34.8125 | 84 | 0.657143 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,051 | threadpoll.py | rafalp_Misago/misago/threads/api/threadpoll.py | from django.core.exceptions import PermissionDenied
from django.db import transaction
from django.http import Http404
from django.utils.translation import pgettext
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.response import Response
from ...acl.objectacl import ... | 4,945 | Python | .py | 125 | 31.048 | 85 | 0.648734 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,052 | threads.py | rafalp_Misago/misago/threads/api/threads.py | from django.core.exceptions import PermissionDenied
from django.db import transaction
from django.utils.translation import pgettext
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.response import Response
from ...categories import PRIVATE_THREADS_ROOT_NAME, THREADS_... | 4,592 | Python | .py | 116 | 31.913793 | 86 | 0.675439 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,053 | attachments.py | rafalp_Misago/misago/threads/api/attachments.py | from django.core.exceptions import PermissionDenied, ValidationError
from django.template.defaultfilters import filesizeformat
from django.utils.translation import pgettext
from rest_framework import viewsets
from rest_framework.response import Response
from ...acl.objectacl import add_acl_to_obj
from ...users.audittr... | 3,919 | Python | .py | 98 | 29.765306 | 87 | 0.616803 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,054 | category.py | rafalp_Misago/misago/threads/api/postingendpoint/category.py | from django.core.exceptions import PermissionDenied
from django.utils.translation import pgettext, pgettext_lazy
from rest_framework import serializers
from . import PostingEndpoint, PostingMiddleware
from ....acl.objectacl import add_acl_to_obj
from ....categories import THREADS_ROOT_NAME
from ....categories.models i... | 2,816 | Python | .py | 63 | 35.444444 | 97 | 0.655462 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,055 | protect.py | rafalp_Misago/misago/threads/api/postingendpoint/protect.py | from rest_framework import serializers
from . import PostingEndpoint, PostingMiddleware
class ProtectMiddleware(PostingMiddleware):
def use_this_middleware(self):
return self.mode == PostingEndpoint.EDIT
def get_serializer(self):
return ProtectSerializer(data=self.request.data)
def post... | 758 | Python | .py | 16 | 38.9375 | 88 | 0.708844 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,056 | recordedit.py | rafalp_Misago/misago/threads/api/postingendpoint/recordedit.py | from django.db.models import F
from . import PostingEndpoint, PostingMiddleware
class RecordEditMiddleware(PostingMiddleware):
def use_this_middleware(self):
self.original_post = self.post.original
return self.mode == PostingEndpoint.EDIT
def save(self, serializer):
is_post_changed ... | 1,249 | Python | .py | 34 | 25.941176 | 66 | 0.588723 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,057 | moderationqueue.py | rafalp_Misago/misago/threads/api/postingendpoint/moderationqueue.py | from . import PostingEndpoint, PostingMiddleware
from ....categories import PRIVATE_THREADS_ROOT_NAME
class ModerationQueueMiddleware(PostingMiddleware):
def use_this_middleware(self):
try:
tree_name = self.tree_name
except AttributeError:
tree_name = self.thread.category.t... | 999 | Python | .py | 22 | 35.363636 | 88 | 0.654639 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,058 | floodprotection.py | rafalp_Misago/misago/threads/api/postingendpoint/floodprotection.py | from datetime import timedelta
from django.utils import timezone
from django.utils.translation import pgettext
from . import PostingEndpoint, PostingInterrupt, PostingMiddleware
MIN_POSTING_INTERVAL = 3
class FloodProtectionMiddleware(PostingMiddleware):
def use_this_middleware(self):
return (
... | 1,873 | Python | .py | 42 | 31.619048 | 86 | 0.585165 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,059 | close.py | rafalp_Misago/misago/threads/api/postingendpoint/close.py | from rest_framework import serializers
from . import PostingEndpoint, PostingMiddleware
from ... import moderation
class CloseMiddleware(PostingMiddleware):
def use_this_middleware(self):
return self.mode == PostingEndpoint.START
def get_serializer(self):
return CloseSerializer(data=self.req... | 666 | Python | .py | 14 | 41.214286 | 67 | 0.748837 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,060 | updatestats.py | rafalp_Misago/misago/threads/api/postingendpoint/updatestats.py | from django.db.models import F
from . import PostingEndpoint, PostingMiddleware
from ....categories import THREADS_ROOT_NAME
class UpdateStatsMiddleware(PostingMiddleware):
def save(self, serializer):
self.update_user(self.user, self.post)
self.update_thread(self.thread, self.post)
self.u... | 1,763 | Python | .py | 38 | 35.605263 | 74 | 0.618797 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,061 | __init__.py | rafalp_Misago/misago/threads/api/postingendpoint/__init__.py | from rest_framework import serializers
from django.core.exceptions import PermissionDenied
from django.http import QueryDict
from django.utils import timezone
from django.utils.module_loading import import_string
from ....conf import settings
class PostingInterrupt(Exception):
def __init__(self, message): # py... | 5,033 | Python | .py | 130 | 28.392308 | 84 | 0.610232 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,062 | privatethread.py | rafalp_Misago/misago/threads/api/postingendpoint/privatethread.py | from . import PostingEndpoint, PostingMiddleware
from ....acl.objectacl import add_acl_to_obj
from ....categories import PRIVATE_THREADS_ROOT_NAME
from ....categories.models import Category
class PrivateThreadMiddleware(PostingMiddleware):
"""middleware that sets private threads category for thread and post"""
... | 869 | Python | .py | 19 | 38.894737 | 75 | 0.71293 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,063 | mentions.py | rafalp_Misago/misago/threads/api/postingendpoint/mentions.py | from . import PostingEndpoint, PostingMiddleware
class MentionsMiddleware(PostingMiddleware):
def post_save(self, serializer):
existing_mentions = []
if self.mode == PostingEndpoint.EDIT:
existing_mentions = self.get_existing_mentions()
new_mentions = []
for user_pk in... | 679 | Python | .py | 16 | 33.125 | 84 | 0.639818 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,064 | savechanges.py | rafalp_Misago/misago/threads/api/postingendpoint/savechanges.py | from collections import OrderedDict
from . import PostingMiddleware
from ....categories.models import Category
class SaveChangesMiddleware(PostingMiddleware):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.reset_state()
def reset_state(self):
self.user.update_all = Fal... | 1,426 | Python | .py | 37 | 29.918919 | 83 | 0.639594 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,065 | reply.py | rafalp_Misago/misago/threads/api/postingendpoint/reply.py | from django.utils.translation import pgettext_lazy
from rest_framework import serializers
from . import PostingEndpoint, PostingMiddleware
from ....markup import common_flavour
from ....users.audittrail import create_audit_trail
from ...checksums import update_post_checksum
from ...validators import validate_post, val... | 4,021 | Python | .py | 90 | 35.966667 | 86 | 0.665214 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,066 | participants.py | rafalp_Misago/misago/threads/api/postingendpoint/participants.py | from django.contrib.auth import get_user_model
from django.core.exceptions import PermissionDenied
from django.utils.translation import npgettext, pgettext
from rest_framework import serializers
from . import PostingEndpoint, PostingMiddleware
from ....acl import useracl
from ....categories import PRIVATE_THREADS_ROOT... | 3,830 | Python | .py | 84 | 34.321429 | 102 | 0.614167 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,067 | syncprivatethreads.py | rafalp_Misago/misago/threads/api/postingendpoint/syncprivatethreads.py | from . import PostingEndpoint, PostingMiddleware
from ....categories import PRIVATE_THREADS_ROOT_NAME
from ...participants import set_users_unread_private_threads_sync
class SyncPrivateThreadsMiddleware(PostingMiddleware):
"""middleware that sets private thread participants to sync unread threads"""
def use_... | 680 | Python | .py | 14 | 41.571429 | 81 | 0.732628 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,068 | attachments.py | rafalp_Misago/misago/threads/api/postingendpoint/attachments.py | from django.utils.translation import npgettext, pgettext
from rest_framework import serializers
from rest_framework.fields import empty
from . import PostingEndpoint, PostingMiddleware
from ....acl.objectacl import add_acl_to_obj
from ...serializers import AttachmentSerializer
class AttachmentsMiddleware(PostingMidd... | 4,967 | Python | .py | 116 | 31.422414 | 102 | 0.601865 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,069 | notifications.py | rafalp_Misago/misago/threads/api/postingendpoint/notifications.py | from ....notifications.tasks import notify_on_new_thread_reply
from ....notifications.threads import (
watch_replied_thread,
watch_started_thread,
)
from . import PostingEndpoint, PostingMiddleware
class NotificationsMiddleware(PostingMiddleware):
def use_this_middleware(self):
return self.mode !=... | 697 | Python | .py | 16 | 37.0625 | 62 | 0.717873 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,070 | hide.py | rafalp_Misago/misago/threads/api/postingendpoint/hide.py | from rest_framework import serializers
from . import PostingEndpoint, PostingMiddleware
from ... import moderation
class HideMiddleware(PostingMiddleware):
def use_this_middleware(self):
return self.mode == PostingEndpoint.START
def get_serializer(self):
return HideSerializer(data=self.reque... | 874 | Python | .py | 18 | 39.777778 | 66 | 0.699292 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,071 | pin.py | rafalp_Misago/misago/threads/api/postingendpoint/pin.py | from rest_framework import serializers
from . import PostingEndpoint, PostingMiddleware
from ... import moderation
from ...models import Thread
class PinMiddleware(PostingMiddleware):
def use_this_middleware(self):
return self.mode == PostingEndpoint.START
def get_serializer(self):
return Pi... | 937 | Python | .py | 20 | 38.25 | 77 | 0.686469 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,072 | merge.py | rafalp_Misago/misago/threads/api/threadendpoints/merge.py | from django.core.exceptions import PermissionDenied
from rest_framework.response import Response
from ....acl.objectacl import add_acl_to_obj
from ....notifications.tasks import delete_duplicate_watched_threads
from ...events import record_event
from ...mergeconflict import MergeConflict
from ...models import Thread
f... | 6,942 | Python | .py | 169 | 33.325444 | 88 | 0.668498 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,073 | delete.py | rafalp_Misago/misago/threads/api/threadendpoints/delete.py | from django.db import transaction
from rest_framework.response import Response
from ...moderation import threads as moderation
from ...permissions import allow_delete_thread
from ...serializers import DeleteThreadsSerializer
@transaction.atomic
def delete_thread(request, thread):
allow_delete_thread(request.user... | 1,564 | Python | .py | 39 | 32.153846 | 85 | 0.651255 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,074 | editor.py | rafalp_Misago/misago/threads/api/threadendpoints/editor.py | from django.core.exceptions import PermissionDenied
from django.utils.translation import pgettext
from rest_framework.response import Response
from ....acl.objectacl import add_acl_to_obj
from ....categories.enums import CategoryTree
from ....categories.models import Category
from ...permissions import can_start_threa... | 2,107 | Python | .py | 54 | 29.796296 | 91 | 0.627634 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,075 | patch.py | rafalp_Misago/misago/threads/api/threadendpoints/patch.py | from django.contrib.auth import get_user_model
from django.core.exceptions import PermissionDenied, ValidationError
from django.http import Http404
from django.shortcuts import get_object_or_404
from django.utils.translation import npgettext, pgettext
from rest_framework import serializers
from rest_framework.response ... | 16,334 | Python | .py | 389 | 34.169666 | 96 | 0.669363 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,076 | list.py | rafalp_Misago/misago/threads/api/threadendpoints/list.py | from rest_framework.response import Response
from ....core.shortcuts import get_int_or_404
from ...viewmodels import (
ForumThreads,
PrivateThreads,
PrivateThreadsCategory,
ThreadsCategory,
ThreadsRootCategory,
)
class ThreadsList:
threads = None
def __call__(self, request, **kwargs):
... | 1,638 | Python | .py | 39 | 35.564103 | 86 | 0.707517 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,077 | likes.py | rafalp_Misago/misago/threads/api/postendpoints/likes.py | from rest_framework.response import Response
from ...serializers import PostLikeSerializer
def likes_list_endpoint(request, post):
queryset = (
post.postlike_set.order_by("-id")
.select_related("liker")
.values(
"id", "liker_id", "liker_name", "liker_slug", "liked_on", "liker_... | 492 | Python | .py | 14 | 28.642857 | 86 | 0.651163 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,078 | split.py | rafalp_Misago/misago/threads/api/postendpoints/split.py | from django.core.exceptions import PermissionDenied
from django.utils.translation import pgettext
from rest_framework.response import Response
from ...models import Thread
from ...moderation import threads as moderation
from ...serializers import SplitPostsSerializer
def posts_split_endpoint(request, thread):
if... | 2,351 | Python | .py | 61 | 30.704918 | 76 | 0.655081 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,079 | merge.py | rafalp_Misago/misago/threads/api/postendpoints/merge.py | from django.core.exceptions import PermissionDenied
from django.utils.translation import pgettext
from rest_framework.response import Response
from ....acl.objectacl import add_acl_to_obj
from ...serializers import MergePostsSerializer, PostSerializer
def posts_merge_endpoint(request, thread):
if not thread.acl[... | 1,747 | Python | .py | 45 | 31.8 | 84 | 0.669828 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,080 | delete.py | rafalp_Misago/misago/threads/api/postendpoints/delete.py | from rest_framework.response import Response
from ...moderation import posts as moderation
from ...permissions import (
allow_delete_best_answer,
allow_delete_event,
allow_delete_post,
)
from ...serializers import DeletePostsSerializer
def delete_post(request, thread, post):
if post.is_event:
... | 1,565 | Python | .py | 47 | 26.12766 | 56 | 0.644947 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,081 | move.py | rafalp_Misago/misago/threads/api/postendpoints/move.py | from django.core.exceptions import PermissionDenied
from django.utils.translation import pgettext
from rest_framework.response import Response
from ...serializers import MovePostsSerializer
def posts_move_endpoint(request, thread, viewmodel):
if not thread.acl["can_move_posts"]:
raise PermissionDenied(
... | 1,541 | Python | .py | 42 | 28.833333 | 80 | 0.645595 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,082 | patch_post.py | rafalp_Misago/misago/threads/api/postendpoints/patch_post.py | from django.core.exceptions import PermissionDenied
from django.utils.translation import npgettext, pgettext
from rest_framework import serializers
from rest_framework.response import Response
from ....acl.objectacl import add_acl_to_obj
from ....conf import settings
from ....core.apipatch import ApiPatch
from ...mode... | 6,000 | Python | .py | 153 | 32.27451 | 88 | 0.670466 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,083 | patch_event.py | rafalp_Misago/misago/threads/api/postendpoints/patch_event.py | from ....acl.objectacl import add_acl_to_obj
from ....core.apipatch import ApiPatch
from ...moderation import posts as moderation
from ...permissions import allow_hide_event, allow_unhide_event
event_patch_dispatcher = ApiPatch()
def patch_acl(request, event, value):
"""useful little op that updates event acl to... | 1,224 | Python | .py | 30 | 35.266667 | 66 | 0.708829 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,084 | edits.py | rafalp_Misago/misago/threads/api/postendpoints/edits.py | from django.core.exceptions import PermissionDenied
from django.db.models import F
from django.shortcuts import get_object_or_404
from django.utils import timezone
from django.utils.translation import pgettext
from rest_framework.response import Response
from ....acl.objectacl import add_acl_to_obj
from ....core.short... | 2,630 | Python | .py | 68 | 33.058824 | 78 | 0.695189 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,085 | treesmap.py | rafalp_Misago/misago/threads/threadtypes/treesmap.py | from django.utils.module_loading import import_string
from ...conf import settings
class TreesMap:
"""Object that maps trees to strategies"""
def __init__(self, types_modules):
self.is_loaded = False
self.types_modules = types_modules
def load(self):
self.types = self.load_types... | 1,698 | Python | .py | 44 | 29.795455 | 88 | 0.616229 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,086 | thread.py | rafalp_Misago/misago/threads/threadtypes/thread.py | from django.urls import reverse
from django.utils.translation import pgettext_lazy
from . import ThreadType
from ...categories import THREADS_ROOT_NAME
class Thread(ThreadType):
root_name = THREADS_ROOT_NAME
def get_category_name(self, category):
if category.level:
return category.name
... | 4,859 | Python | .py | 110 | 34.890909 | 88 | 0.609368 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,087 | __init__.py | rafalp_Misago/misago/threads/threadtypes/__init__.py | from .treesmap import trees_map
class ThreadType:
"""Abstract class for thread type strategy"""
root_name = "undefined"
def get_forum_name(self, category):
return category.name
def get_category_absolute_url(self, category):
return None
def get_category_last_thread_url(self, cat... | 1,831 | Python | .py | 54 | 26.685185 | 54 | 0.655232 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,088 | privatethread.py | rafalp_Misago/misago/threads/threadtypes/privatethread.py | from django.urls import reverse
from django.utils.translation import pgettext_lazy
from . import ThreadType
from ...categories import PRIVATE_THREADS_ROOT_NAME
class PrivateThread(ThreadType):
root_name = PRIVATE_THREADS_ROOT_NAME
def get_category_name(self, category):
return pgettext_lazy("private ... | 3,640 | Python | .py | 87 | 32.494253 | 86 | 0.607193 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,089 | test_delete_user_likes.py | rafalp_Misago/misago/threads/tests/test_delete_user_likes.py | from django.test import RequestFactory
from .. import test
from ...categories.models import Category
from ...users.test import AuthenticatedUserTestCase, create_test_user
from ..api.postendpoints.patch_post import patch_is_liked
from ..models import Post
class DeleteUserLikesTests(AuthenticatedUserTestCase):
def... | 1,290 | Python | .py | 29 | 37.344828 | 78 | 0.676259 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,090 | conftest.py | rafalp_Misago/misago/threads/tests/conftest.py | import pytest
from ...categories.models import Category
from ...permissions.enums import CategoryPermission
from ...testutils import grant_category_group_permissions
@pytest.fixture
def notify_on_new_private_thread_mock(mocker):
return mocker.patch("misago.threads.participants.notify_on_new_private_thread")
@p... | 1,263 | Python | .py | 29 | 38.310345 | 85 | 0.753066 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,091 | test_post_mentions.py | rafalp_Misago/misago/threads/tests/test_post_mentions.py | from unittest.mock import patch
from django.test.client import BOUNDARY, MULTIPART_CONTENT, encode_multipart
from django.urls import reverse
from .. import test
from ...categories.models import Category
from ...markup.mentions import MENTIONS_LIMIT
from ...users.test import AuthenticatedUserTestCase, create_test_user... | 6,405 | Python | .py | 133 | 39.466165 | 86 | 0.638216 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,092 | test_events.py | rafalp_Misago/misago/threads/tests/test_events.py | from unittest.mock import Mock
from django.test import TestCase
from django.utils import timezone
from ...acl import useracl
from ...acl.objectacl import add_acl_to_obj
from ...categories.models import Category
from ...conftest import get_cache_versions
from ...users.test import create_test_user
from ..events import ... | 1,957 | Python | .py | 44 | 36.931818 | 75 | 0.673856 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,093 | test_threads_editor_api.py | rafalp_Misago/misago/threads/tests/test_threads_editor_api.py | import os
from django.urls import reverse
from .. import test
from ...acl import useracl
from ...acl.objectacl import add_acl_to_obj
from ...categories.models import Category
from ...conftest import get_cache_versions
from ...users.test import AuthenticatedUserTestCase
from ..models import Attachment
from ..serialize... | 21,657 | Python | .py | 487 | 33.535934 | 88 | 0.58955 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,094 | test_threads_lists_polling.py | rafalp_Misago/misago/threads/tests/test_threads_lists_polling.py | from django.urls import reverse
from ...categories.models import Category
from ...conf.test import override_dynamic_settings
from ...test import assert_contains, assert_not_contains
from ..enums import ThreadsListsPolling
from ..models import ThreadParticipant
from ..test import post_thread
@override_dynamic_setting... | 21,307 | Python | .py | 489 | 38.433538 | 122 | 0.722077 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,095 | test_thread_pollvotes_api.py | rafalp_Misago/misago/threads/tests/test_thread_pollvotes_api.py | from datetime import timedelta
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.utils import timezone
from ...acl.test import patch_user_acl
from ..models import Poll
from ..test import patch_category_acl
from .test_thread_poll_api import ThreadPollApiTestCase
User = get_use... | 13,375 | Python | .py | 301 | 35.305648 | 88 | 0.615651 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,096 | test_thread_replies_paginator.py | rafalp_Misago/misago/threads/tests/test_thread_replies_paginator.py | from ..paginator import ThreadRepliesPaginator
from ..test import reply_thread
def test_thread_replies_paginator_counts_pages_without_orphans(thread):
paginator = ThreadRepliesPaginator(thread.post_set, 5, 0)
assert paginator.count == 1
assert paginator.num_pages == 1
# Fill in first page
for i i... | 8,278 | Python | .py | 207 | 33.101449 | 79 | 0.66409 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,097 | test_thread_replies_view.py | rafalp_Misago/misago/threads/tests/test_thread_replies_view.py | from django.urls import reverse
from ...permissions.models import Moderator, CategoryGroupPermission
from ...test import assert_contains, assert_not_contains
def test_thread_replies_view_shows_error_on_missing_permission(
guests_group, client, thread, post
):
CategoryGroupPermission.objects.filter(group=gues... | 7,776 | Python | .py | 191 | 35.020942 | 88 | 0.690625 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,098 | test_thread_patch_api.py | rafalp_Misago/misago/threads/tests/test_thread_patch_api.py | import json
from datetime import timedelta
from django.utils import timezone
from .. import test
from ...categories.models import Category
from ..models import Thread
from ..test import patch_category_acl, patch_other_category_acl
from .test_threads_api import ThreadsApiTestCase
class ThreadPatchApiTestCase(Threads... | 69,373 | Python | .py | 1,616 | 32.649752 | 88 | 0.58338 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,099 | test_thread_bulkpatch_api.py | rafalp_Misago/misago/threads/tests/test_thread_bulkpatch_api.py | import json
from django.urls import reverse
from .. import test
from ...categories.models import Category
from ...conf.test import override_dynamic_settings
from ..models import Thread
from ..test import patch_category_acl, patch_other_category_acl
from .test_threads_api import ThreadsApiTestCase
class ThreadsBulkP... | 11,132 | Python | .py | 258 | 32.333333 | 88 | 0.578139 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |