diff --git a/assets/smileys/old/ange.png b/assets/smileys/old/ange.png
deleted file mode 100644
index 20ae0c10f6..0000000000
Binary files a/assets/smileys/old/ange.png and /dev/null differ
diff --git a/assets/smileys/old/angry.gif b/assets/smileys/old/angry.gif
deleted file mode 100644
index 61e726b758..0000000000
Binary files a/assets/smileys/old/angry.gif and /dev/null differ
diff --git a/assets/smileys/old/blink.gif b/assets/smileys/old/blink.gif
deleted file mode 100644
index d945c39045..0000000000
Binary files a/assets/smileys/old/blink.gif and /dev/null differ
diff --git a/assets/smileys/old/clin.png b/assets/smileys/old/clin.png
deleted file mode 100644
index 37025dca12..0000000000
Binary files a/assets/smileys/old/clin.png and /dev/null differ
diff --git a/assets/smileys/old/cthulhu.png b/assets/smileys/old/cthulhu.png
deleted file mode 100644
index 71bd36369c..0000000000
Binary files a/assets/smileys/old/cthulhu.png and /dev/null differ
diff --git a/assets/smileys/old/diable.png b/assets/smileys/old/diable.png
deleted file mode 100644
index 4b80375bd0..0000000000
Binary files a/assets/smileys/old/diable.png and /dev/null differ
diff --git a/assets/smileys/old/heureux.png b/assets/smileys/old/heureux.png
deleted file mode 100644
index bce7432d47..0000000000
Binary files a/assets/smileys/old/heureux.png and /dev/null differ
diff --git a/assets/smileys/old/hihi.png b/assets/smileys/old/hihi.png
deleted file mode 100644
index d1f178a7dc..0000000000
Binary files a/assets/smileys/old/hihi.png and /dev/null differ
diff --git a/assets/smileys/old/huh.png b/assets/smileys/old/huh.png
deleted file mode 100644
index 1289968bb0..0000000000
Binary files a/assets/smileys/old/huh.png and /dev/null differ
diff --git a/assets/smileys/old/langue.png b/assets/smileys/old/langue.png
deleted file mode 100644
index 1bd7892e23..0000000000
Binary files a/assets/smileys/old/langue.png and /dev/null differ
diff --git a/assets/smileys/old/magicien.png b/assets/smileys/old/magicien.png
deleted file mode 100644
index eaf1129273..0000000000
Binary files a/assets/smileys/old/magicien.png and /dev/null differ
diff --git a/assets/smileys/old/mechant.png b/assets/smileys/old/mechant.png
deleted file mode 100644
index 1113c19084..0000000000
Binary files a/assets/smileys/old/mechant.png and /dev/null differ
diff --git a/assets/smileys/old/ninja.png b/assets/smileys/old/ninja.png
deleted file mode 100644
index 32e010060d..0000000000
Binary files a/assets/smileys/old/ninja.png and /dev/null differ
diff --git a/assets/smileys/old/pinch.png b/assets/smileys/old/pinch.png
deleted file mode 100644
index 7c2d57ad08..0000000000
Binary files a/assets/smileys/old/pinch.png and /dev/null differ
diff --git a/assets/smileys/old/pirate.png b/assets/smileys/old/pirate.png
deleted file mode 100644
index bd8eb3f52a..0000000000
Binary files a/assets/smileys/old/pirate.png and /dev/null differ
diff --git a/assets/smileys/old/pleure.png b/assets/smileys/old/pleure.png
deleted file mode 100644
index 4ce92e9f0f..0000000000
Binary files a/assets/smileys/old/pleure.png and /dev/null differ
diff --git a/assets/smileys/old/rire.gif b/assets/smileys/old/rire.gif
deleted file mode 100644
index 237d431ad4..0000000000
Binary files a/assets/smileys/old/rire.gif and /dev/null differ
diff --git a/assets/smileys/old/rouge.png b/assets/smileys/old/rouge.png
deleted file mode 100644
index f4eb32c56d..0000000000
Binary files a/assets/smileys/old/rouge.png and /dev/null differ
diff --git a/assets/smileys/old/siffle.png b/assets/smileys/old/siffle.png
deleted file mode 100644
index ec7e85fd78..0000000000
Binary files a/assets/smileys/old/siffle.png and /dev/null differ
diff --git a/assets/smileys/old/smile.png b/assets/smileys/old/smile.png
deleted file mode 100644
index 4771bca4c0..0000000000
Binary files a/assets/smileys/old/smile.png and /dev/null differ
diff --git a/assets/smileys/old/soleil.png b/assets/smileys/old/soleil.png
deleted file mode 100644
index ec9aeb59cd..0000000000
Binary files a/assets/smileys/old/soleil.png and /dev/null differ
diff --git a/assets/smileys/old/triste.png b/assets/smileys/old/triste.png
deleted file mode 100644
index 7190f3f4da..0000000000
Binary files a/assets/smileys/old/triste.png and /dev/null differ
diff --git a/assets/smileys/old/unsure.gif b/assets/smileys/old/unsure.gif
deleted file mode 100644
index 700cdd3882..0000000000
Binary files a/assets/smileys/old/unsure.gif and /dev/null differ
diff --git a/assets/smileys/old/waw.png b/assets/smileys/old/waw.png
deleted file mode 100644
index d51d145ec5..0000000000
Binary files a/assets/smileys/old/waw.png and /dev/null differ
diff --git a/assets/smileys/old/zorro.png b/assets/smileys/old/zorro.png
deleted file mode 100644
index 4ca634683e..0000000000
Binary files a/assets/smileys/old/zorro.png and /dev/null differ
diff --git a/templates/pages/cookies.html b/templates/pages/cookies.html
index 6d732cd1d1..7f2c4ca107 100644
--- a/templates/pages/cookies.html
+++ b/templates/pages/cookies.html
@@ -54,11 +54,6 @@
{% trans "Cookies techniques" %}
{% blocktrans %}Ce cookie est un identifiant unique qui permet de faire le lien entre votre session de navigation et les différentes pages que vous visitez. Il permet en particulier de vous connecter à {{ site_name }}. Il ne contient qu’une chaîne de caractères aléatoires.{% endblocktrans %}
csrftoken
{% blocktrans %}Ce cookie contient une chaîne de caractères aléatoires qui permet de se prémunir des attaques CSRF. Composant indispensable de la sécurité du site, vous ne pourrez rien poster sans ce cookie.{% endblocktrans %}
- {% if app.member.old_smileys_allowed %}
- {{ app.member.old_smileys_cookie_key }}
- {% url 'update-member' as update_member %}
- {% blocktrans with url=update_member %}Ce cookie est utilisé pour afficher les "vieux" smileys en lieu et place des smileys Clem (auquel cas il prend la valeur True), si vous activez cette option dans votre profil.{% endblocktrans %}
- {% endif %}
diff --git a/zds/member/forms.py b/zds/member/forms.py
index 916046247f..106f2334d1 100644
--- a/zds/member/forms.py
+++ b/zds/member/forms.py
@@ -250,9 +250,6 @@ def __init__(self, *args, **kwargs):
self.helper.form_class = "content-wrapper"
self.helper.form_method = "post"
- if settings.ZDS_APP["member"]["old_smileys_allowed"]:
- self.fields["options"].choices.insert(3, ("use_old_smileys", _("Utiliser les anciens smileys")))
-
# to get initial value form checkbox show email
initial = kwargs.get("initial", {})
self.fields["options"].initial = ""
@@ -266,9 +263,6 @@ def __init__(self, *args, **kwargs):
if "allow_temp_visual_changes" in initial and initial["allow_temp_visual_changes"]:
self.fields["options"].initial += "allow_temp_visual_changes"
- if "use_old_smileys" in initial and initial["use_old_smileys"]:
- self.fields["options"].initial += "use_old_smileys"
-
if "show_markdown_help" in initial and initial["show_markdown_help"]:
self.fields["options"].initial += "show_markdown_help"
diff --git a/zds/member/migrations/0021_remove_profile_use_old_smileys.py b/zds/member/migrations/0021_remove_profile_use_old_smileys.py
new file mode 100644
index 0000000000..218faffdb2
--- /dev/null
+++ b/zds/member/migrations/0021_remove_profile_use_old_smileys.py
@@ -0,0 +1,17 @@
+# Generated by Django 3.2.12 on 2022-03-24 18:57
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("member", "0020_auto_20201018_0841"),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name="profile",
+ name="use_old_smileys",
+ ),
+ ]
diff --git a/zds/member/models.py b/zds/member/models.py
index 371f24eede..394bb9a5c4 100644
--- a/zds/member/models.py
+++ b/zds/member/models.py
@@ -65,7 +65,6 @@ class Meta:
can_write = models.BooleanField("Possibilité d'écrire", default=True)
end_ban_write = models.DateTimeField("Fin d'interdiction d'écrire", null=True, blank=True)
last_visit = models.DateTimeField("Date de dernière visite", null=True, blank=True)
- use_old_smileys = models.BooleanField("Utilise les anciens smileys ?", default=False)
_permissions = {}
_groups = None
_cached_city = None
@@ -490,33 +489,6 @@ def remove_hats_linked_to_group(sender, instance, **kwargs):
instance.hats.remove(hat)
-def remove_old_smileys_cookie(response):
- """Remove the Clem smileys cookie by immediate expiration
-
- :param response: the HTTP response
- :type: django.http.response.HttpResponse
- """
-
- response.set_cookie(settings.ZDS_APP["member"]["old_smileys_cookie_key"], "", expires=0)
-
-
-def set_old_smileys_cookie(response, profile):
- """Set the Clem smileys cookie according to profile (and if allowed)
-
- :param response: the HTTP response
- :type: django.http.response.HttpResponse
- :param profile: the profile
- :type profile: Profile
- """
-
- if settings.ZDS_APP["member"]["old_smileys_allowed"]:
- if profile.use_old_smileys:
- # TODO: set max_age, expires and so all (see https://stackoverflow.com/a/1623910)
- response.set_cookie(settings.ZDS_APP["member"]["old_smileys_cookie_key"], profile.use_old_smileys)
- else:
- remove_old_smileys_cookie(response)
-
-
class TokenForgotPassword(models.Model):
"""
When a user forgot its password, the website sends it an email with a token (embedded in a URL).
diff --git a/zds/member/tests/views/tests_profile.py b/zds/member/tests/views/tests_profile.py
index a8f115bdac..8a10b7f741 100644
--- a/zds/member/tests/views/tests_profile.py
+++ b/zds/member/tests/views/tests_profile.py
@@ -254,69 +254,3 @@ def test_markdown_help_settings(self):
user.profile.save()
result = self.client.get(reverse("pages-index"), follow=False)
self.assertContains(result, 'data-show-markdown-help="false"')
-
- def test_old_smileys(self):
- """Test the cookie"""
-
- # NOTE: we have to use the "real" login and logout pages here
- cookie_key = settings.ZDS_APP["member"]["old_smileys_cookie_key"]
-
- profile_without_clem = ProfileFactory()
- profile_without_clem = Profile.objects.get(pk=profile_without_clem.pk)
- self.assertFalse(profile_without_clem.use_old_smileys)
-
- user_without_clem = profile_without_clem.user
- profile_with_clem = ProfileFactory()
- profile_with_clem.use_old_smileys = True
- profile_with_clem.save()
- user_with_clem = profile_with_clem.user
-
- settings.ZDS_APP["member"]["old_smileys_allowed"] = True
-
- # test that the cookie is set when connection
- result = self.client.post(
- reverse("member-login"),
- {"username": user_with_clem.username, "password": "hostel77", "remember": "remember"},
- follow=False,
- )
- self.assertEqual(result.status_code, 302)
- self.client.get(reverse("homepage"))
-
- self.assertIn(cookie_key, self.client.cookies)
- self.assertNotEqual(self.client.cookies[cookie_key]["expires"], 0)
-
- # test that logout set the cookies expiration to 0 (= no more cookie)
- self.client.post(reverse("member-logout"), follow=True)
- self.client.get(reverse("homepage"))
- self.assertEqual(self.client.cookies[cookie_key]["expires"], 0)
-
- # test that user without the setting have the cookie with expiration 0 (= no cookie)
- result = self.client.post(
- reverse("member-login"),
- {"username": user_without_clem.username, "password": "hostel77", "remember": "remember"},
- follow=False,
- )
-
- self.assertEqual(result.status_code, 302)
- self.assertEqual(self.client.cookies[cookie_key]["expires"], 0)
-
- # setting use_smileys sets the cookie
- self.client.post(
- reverse("update-member"),
- {"biography": "", "site": "", "avatar_url": "", "sign": "", "options": ["use_old_smileys"]},
- )
- self.client.get(reverse("homepage"))
-
- profile_without_clem = Profile.objects.get(pk=profile_without_clem.pk)
- self.assertTrue(profile_without_clem.use_old_smileys)
- self.assertNotEqual(self.client.cookies[cookie_key]["expires"], 0)
-
- # ... and that not setting it removes the cookie
- self.client.post(
- reverse("update-member"), {"biography": "", "site": "", "avatar_url": "", "sign": "", "options": []}
- )
- self.client.get(reverse("homepage"))
-
- profile_without_clem = Profile.objects.get(pk=profile_without_clem.pk)
- self.assertFalse(profile_without_clem.use_old_smileys)
- self.assertEqual(self.client.cookies[cookie_key]["expires"], 0)
diff --git a/zds/member/views/login.py b/zds/member/views/login.py
index 712b10e68b..0bc95cba54 100644
--- a/zds/member/views/login.py
+++ b/zds/member/views/login.py
@@ -9,7 +9,7 @@
from django.views.decorators.http import require_POST
from zds.member.forms import LoginForm
-from zds.member.models import Profile, set_old_smileys_cookie, remove_old_smileys_cookie
+from zds.member.models import Profile
from zds.member.views import get_client_ip
from zds.utils.tokens import generate_token
@@ -94,7 +94,6 @@ def login_view(request):
response = redirect(next_page)
except Resolver404:
response = redirect(reverse("homepage"))
- set_old_smileys_cookie(response, profile)
return response
if next_page is not None:
@@ -112,6 +111,4 @@ def logout_view(request):
logout(request)
request.session.clear()
response = redirect(reverse("homepage"))
- # disable Clem smileys:
- remove_old_smileys_cookie(response)
return response
diff --git a/zds/member/views/profile.py b/zds/member/views/profile.py
index 4a69027e32..7205de3955 100644
--- a/zds/member/views/profile.py
+++ b/zds/member/views/profile.py
@@ -30,7 +30,6 @@
KarmaNote,
Ban,
NewEmailProvider,
- set_old_smileys_cookie,
)
from zds.notification.models import TopicAnswerSubscription, NewPublicationSubscription
from zds.tutorialv2.models import CONTENT_TYPES
@@ -215,7 +214,6 @@ def get_form(self, form_class=ProfileForm):
"avatar_url": profile.avatar_url,
"show_sign": profile.show_sign,
"is_hover_enabled": profile.is_hover_enabled,
- "use_old_smileys": profile.use_old_smileys,
"allow_temp_visual_changes": profile.allow_temp_visual_changes,
"show_markdown_help": profile.show_markdown_help,
"email_for_answer": profile.email_for_answer,
@@ -245,7 +243,6 @@ def form_valid(self, form):
self.save_profile(profile)
response = redirect(self.get_success_url())
- set_old_smileys_cookie(response, profile)
return response
def update_profile(self, profile, form):
@@ -254,7 +251,6 @@ def update_profile(self, profile, form):
profile.site = form.data["site"]
profile.show_sign = "show_sign" in cleaned_data_options
profile.is_hover_enabled = "is_hover_enabled" in cleaned_data_options
- profile.use_old_smileys = "use_old_smileys" in cleaned_data_options
profile.allow_temp_visual_changes = "allow_temp_visual_changes" in cleaned_data_options
profile.show_markdown_help = "show_markdown_help" in cleaned_data_options
profile.email_for_answer = "email_for_answer" in cleaned_data_options
diff --git a/zds/settings/abstract_base/zds.py b/zds/settings/abstract_base/zds.py
index 067208c777..0c6bc107d6 100644
--- a/zds/settings/abstract_base/zds.py
+++ b/zds/settings/abstract_base/zds.py
@@ -137,8 +137,6 @@
"users_in_hats_list": 5,
"requested_hats_per_page": 100,
"update_last_visit_interval": 600, # seconds
- "old_smileys_allowed": False,
- "old_smileys_cookie_key": "use_old_smileys",
},
"hats": {
"moderation": "Staff",