Skip to content

fix(forum): enable topic interactions and fix footer layout#632

Merged
A1L13N merged 1 commit into
alphaonelabs:mainfrom
alimurtzaa:fix/forum-interaction-and-layout-issues
Aug 25, 2025
Merged

fix(forum): enable topic interactions and fix footer layout#632
A1L13N merged 1 commit into
alphaonelabs:mainfrom
alimurtzaa:fix/forum-interaction-and-layout-issues

Conversation

@alimurtzaa
Copy link
Copy Markdown
Contributor

@alimurtzaa alimurtzaa commented Jun 1, 2025

Allow community replies, make replies visible, add voting system, and resolve footer overlap issues.

Related issues

Fixes #614

Checklist

  • Did you run the pre-commit? (If not, your PR will most likely not pass — please ensure it passes pre-commit)
  • Did you test the change? (Ensure you didn’t just prompt the AI and blindly commit — test the code and confirm it works)
  • Added screenshots to the PR description (if applicable)
    image

Summary by CodeRabbit

  • New Features
    • Introduced a voting interface for forum topics, allowing users to upvote or downvote topics and view the current vote score with dynamic color changes.
  • Bug Fixes
    • Corrected the login redirect URL in the voting interface for unauthenticated users.
  • Style
    • Enhanced the layout by placing voting controls adjacent to topic content and relocating the delete button to a separate section.

Allow community replies, make replies visible, add voting system,
and resolve footer overlap issues.
Fixes alphaonelabs#614
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 1, 2025

Walkthrough

The forum topic template is updated to introduce a voting interface, allowing users to upvote or downvote topics. The delete button for the topic author is moved to a separate section. The JavaScript handling voting actions is revised to use the correct login URL for unauthenticated users.

Changes

File(s) Change Summary
web/templates/web/forum/topic.html Replaces conditional delete button with voting UI, moves delete form, updates JS for voting and login.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ForumTopicPage
    participant Server

    User->>ForumTopicPage: Loads topic page
    User->>ForumTopicPage: Clicks upvote/downvote button
    ForumTopicPage->>User: Checks authentication (JS)
    alt Not authenticated
        ForumTopicPage->>User: Redirects to login page with next=topic URL
    else Authenticated
        ForumTopicPage->>Server: Sends POST vote request (AJAX, CSRF)
        Server-->>ForumTopicPage: Returns updated vote state/score
        ForumTopicPage->>User: Updates vote UI (score, button highlights)
        alt Error
            ForumTopicPage->>User: Reloads page
        end
    end
Loading

Assessment against linked issues

Objective Addressed Explanation
Add upvote/downvote interaction for topics (No User Interaction) (#614)
Conditional rendering/movement of delete button (not a primary objective, but related to UI/UX) (#614)
Allow all users to interact with topics (not just author) (#614)
Show topic replies publicly (#614) No changes related to replies or their visibility are present in this PR.
Footer layout fix (#614) No changes related to footer layout or structure are present in this PR.

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
None detected All observed changes pertain directly to forum topic interaction and voting as described.

Possibly related PRs

  • Feat/forum voting #505: Adds backend support for forum topic and reply voting, which the new voting UI and logic in this PR depend on.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @alimurtzaa, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

Hello! Gemini here, providing a summary of this pull request. This PR aims to enhance the forum functionality by enabling community interactions on topics, specifically adding a voting system and making replies visible (as per the description). It also addresses a layout issue related to the footer overlapping content. The primary changes involve modifying the topic detail template (web/templates/web/forum/topic.html) to include the voting UI, adjusting the login redirect for users attempting to interact, and ensuring these elements are visible to all users.

Highlights

  • Enable Topic Voting: Implemented a voting system (upvote/downvote) directly on the topic view, allowing users to interact with the topic's content.
  • Fix Login Redirect for Interactions: Corrected the redirect URL for unauthenticated users attempting interactions (like voting) from the signup page to the login page, ensuring they are sent back to the topic after logging in.
  • Enable Community Interactions: Modified the template structure to ensure voting and potentially other interaction elements (like replies, mentioned in description) are visible and accessible to all users, not just the topic author.
  • Resolve Footer Layout Issue: Addressed an issue where the footer was overlapping content (as mentioned in the PR description).

Changelog

  • web/templates/web/forum/topic.html
    • Moved the topic voting UI and content display outside of the author-only conditional block, making it visible to all users (lines 171-210).
    • Implemented the visual structure for upvote/downvote buttons and the vote score display using Tailwind CSS classes and SVG icons (lines 175-209).
    • Corrected the JavaScript login redirect URL from /signup to /login with a next parameter pointing back to the current topic page (line 433).
    • Removed a conditional block ({% endif %}) wrapping the main content and script, ensuring these elements are always rendered (lines 527-528 removed).
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


Votes appear for all,
Login sends you back to view,
Forum comes alive.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to enhance forum topic interactions by enabling replies, making them visible, adding a voting system, and fixing footer layout issues. The changes to the login URL for interactions and the script loading are positive improvements.

However, there are a couple of significant issues in web/templates/web/forum/topic.html that need addressing: the main topic content is currently not being displayed, and the functionality for topic authors to delete their own topics appears to have been removed.

I haven't reviewed the footer layout fix as it's not present in the provided diffs for topic.html, but I trust it has been handled elsewhere.

Summary of Findings

  • Missing Topic Content: The main content of the forum topic ({{ topic.content|linebreaks }}) is no longer displayed after the changes in web/templates/web/forum/topic.html. This is a critical issue as users cannot read the topic.
  • Missing Delete Topic Functionality: The functionality for a topic author to delete their own topic has been removed from web/templates/web/forum/topic.html. This is a significant loss of functionality if unintentional.
  • Improved Login Redirect for Interactions: The JavaScript logic for redirecting unauthenticated users now correctly points to the login page (account_login) instead of signup, and includes a next parameter for a better user experience. This is a good fix.
  • Script Loading Optimization: The removal of the {% if user.is_authenticated %} condition around the JavaScript block is a good change, as the script itself handles authentication checks and redirection.

Merge Readiness

This pull request introduces valuable features for forum interaction. However, there are critical and high-severity issues that need to be addressed before this PR is ready for merging. Specifically, the topic content display must be restored, and the removal of the 'Delete Topic' functionality needs to be clarified and potentially reinstated.

I am unable to approve pull requests directly. Please ensure these issues are resolved and consider further review before merging.

Comment thread web/templates/web/forum/topic.html
Comment thread web/templates/web/forum/topic.html
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🔭 Outside diff range comments (1)
web/templates/web/forum/topic.html (1)

171-249: 💡 Verification agent

🧩 Analysis chain

Voting Interface: Context & Accessibility Check

Ensure the view provides all required context variables (user_topic_vote, topic.vote_score, topic.upvote_count, topic.downvote_count). Consider refactoring the voting UI into a reusable partial include to reduce duplication with the replies section and improve maintainability. From an accessibility standpoint:

  • Wrap the vote buttons in a role="group" and add an aria-label (e.g. aria-label="Topic Voting Controls").
  • Confirm that aria-pressed toggles correctly and that color changes are perceivable for screen readers.
  • Test responsive behavior to prevent layout shifts, especially on smaller viewports.

🏁 Script executed:

#!/bin/bash
# Verify context variables are referenced in the codebase
rg -n "user_topic_vote" .
rg -n "topic.vote_score" .
rg -n "upvote_count" .
rg -n "downvote_count" .

# Check for duplicated voting markup in other templates
rg -n "vote-btn" web/templates

Length of output: 3555


Voting Interface: Refactor & Accessibility

The required context variables (user_topic_vote, topic.vote_score, topic.upvote_count, topic.downvote_count) are already supplied in web/views.py. To improve maintainability and accessibility:

  • Extract common markup
    • Create a partial (e.g. templates/web/forum/_vote_controls.html) and include it in both the topic and reply templates to remove duplicated <button class="vote-btn">… blocks.

  • Add ARIA grouping
    • Wrap the up/down vote buttons in a container with
    role="group" and
    aria-label="Topic Voting Controls"
    to convey their relationship to assistive technologies.

  • Ensure correct aria-pressed toggling
    • In the JavaScript (around line 511), verify that each click updates the aria-pressed attribute on the button and that the change is programmatically announced.

  • Provide non-color cues
    • Since color alone (text-teal vs. text-red) isn’t perceivable to all users, consider adding visually hidden text (e.g. <span class="sr-only">Upvoted</span>) or aria-checked/aria-label updates.

  • Test responsive behavior
    • Review the component at small breakpoints to prevent layout shifts when the vote controls appear below or beside the content.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 459997a and 5eadab1.

📒 Files selected for processing (1)
  • web/templates/web/forum/topic.html (3 hunks)

Comment thread web/templates/web/forum/topic.html
Copy link
Copy Markdown
Contributor Author

@alimurtzaa alimurtzaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The requested change has been addressed and the conversation is resolved.

@A1L13N A1L13N merged commit eecb73e into alphaonelabs:main Aug 25, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Forum Page Issues: No Interaction for Topics, Replies Not Visible, Footer Layout Broken

2 participants