aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/main.yml3
-rw-r--r--blog/recommender.py3
-rw-r--r--blog/views.py2
-rw-r--r--templates/blog/post.html3
4 files changed, 5 insertions, 6 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 30508f4c..064a6ffe 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -14,7 +14,4 @@ jobs:
port: ${{ secrets.PORT }}
script: |
grep -qxF 'GEMINI_API_KEY=${{ secrets.GEMINI_API_KEY }}' /home/ubuntu/.shifooenv || echo 'GEMINI_API_KEY=${{ secrets.GEMINI_API_KEY }}' >> /home/ubuntu/.shifooenv
- # Print the environment variables - test purpose
- cat /home/ubuntu/.shifooenv
- echo "Deploying the code"
sh /home/ubuntu/deploy.sh
diff --git a/blog/recommender.py b/blog/recommender.py
index e08a2c2b..280fa4b0 100644
--- a/blog/recommender.py
+++ b/blog/recommender.py
@@ -14,6 +14,9 @@ def next_read(post):
current_post = Post.objects.get(id=post.id)
posts = Post.objects.filter(is_public=True).exclude(id=current_post.id)
+ if len(posts) < 2:
+ return None
+
# Our method is very simple. First we compare the bodies of the posts to
# find the similarity between them. Then we sort the posts based on their
# similarity and return the post with the highest similarity.
diff --git a/blog/views.py b/blog/views.py
index a05dc325..f7fec1b4 100644
--- a/blog/views.py
+++ b/blog/views.py
@@ -227,7 +227,7 @@ def comment(request, slug):
r_spam = check_spam(comment=request.POST.get('body'))
if r_spam != 'N':
messages.error(request, r_spam, extra_tags='spam')
- return redirect(reverse('blog:post', kwargs={'slug': slug}) + '#comment-' + str(comment.id))
+ return redirect(reverse('blog:post', kwargs={'slug': slug}) + '#new-comment')
# then we continue
post = Post.objects.get(slug=slug)
diff --git a/templates/blog/post.html b/templates/blog/post.html
index 5c02ce2b..8da852a4 100644
--- a/templates/blog/post.html
+++ b/templates/blog/post.html
@@ -183,8 +183,7 @@ background: #ffffff0d;
{% if messages %}
{% for message in messages %}
{% if 'spam' in message.tags %}
- <p style="color: red;">Your comment was not allowed as it was marked as possible spam. If you think this is a mistake, please contact me at <a href="mailto:[email protected]">[email protected]</a>.</p>
- <p style="color: red;">{{ message }}</p>
+ <p style="color: #ffb6b6;">Your comment was not allowed as it was marked as possible spam. If you think this is a mistake, please contact me at <a href="mailto:[email protected]">[email protected]</a>.</p>
{% endif %}
{% endfor %}
{% endif %}