Skip to content

Commit

Permalink
yt 1st try
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentporte committed Apr 15, 2024
1 parent 4efb5c3 commit 06a9c9f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
4 changes: 3 additions & 1 deletion config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,10 @@
"https://browser.sentry-cdn.com",
"https://js.sentry-cdn.com",
"https://tally.so",
"https://www.youtube.com/iframe_api",
"https://www.youtube.com/s/player/7ebf4817/www-widgetapi.vflset/www-widgetapi.js",
)
CSP_FRAME_SRC = ("'self'", "https://tally.so")
CSP_FRAME_SRC = ("'self'", "https://tally.so", "https://www.youtube.com/embed/")
CSP_IMG_SRC = ("'self'", "data:", "cellar-c2.services.clever-cloud.com")
CSP_CONNECT_SRC = ("'self'", "*.sentry.io")
CSP_INCLUDE_NONCE_IN = ["script-src", "script-src-elem"]
Expand Down
23 changes: 12 additions & 11 deletions lacommunaute/forum_conversation/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@
from machina.conf import settings as machina_settings
from taggit.models import Tag

from lacommunaute.forum_conversation.models import Post
from lacommunaute.forum_moderation.utils import check_post_approbation

# from lacommunaute.forum_conversation.models import Post
# from lacommunaute.forum_moderation.utils import check_post_approbation


class CreateUpdatePostMixin:
def clean(self):
cleaned_data = super().clean()
if "content" in cleaned_data:
post = check_post_approbation(
Post(username=cleaned_data.get("username"), content=cleaned_data.get("content"))
)
if not post.approved:
self.add_error(None, "Votre message ne respecte pas les règles de la communauté.")
return cleaned_data
# def clean(self):
# cleaned_data = super().clean()
# if "content" in cleaned_data:
# post = check_post_approbation(
# Post(username=cleaned_data.get("username"), content=cleaned_data.get("content"))
# )
# if not post.approved:
# self.add_error(None, "Votre message ne respecte pas les règles de la communauté.")
# return cleaned_data

def update_post(self, post):
if self.user.is_anonymous:
Expand Down

0 comments on commit 06a9c9f

Please sign in to comment.