Skip to content

Conversation

@Satish-Medar
Copy link

@Satish-Medar Satish-Medar commented Nov 16, 2025

Closes #4802

This is a new, clean PR for the "Recently Registered Organizations" feature, as requested by @DonnieBLT

The previous PR (#4801) was closed due to including unrelated files. This new PR contains only the 3 files necessary for the feature:

  1. models.py: To add the missing get_absolute_url function.
  2. views.py: To query the database for the orgs.
  3. register_organization.html: To display the new list.

The feature has been tested locally and is working as expected.

Summary by CodeRabbit

  • New Features
    • Added a "Recently Registered Organizations" section on the registration page showing latest entries.
    • Improved notification messages with separate success/error styling, icons, and dismiss controls.
    • Organizations now provide direct detail links (permalinks) for easier navigation to organization pages.

Local Test Screenshot

Uploading Screenshot 2025-11-17 230525.png…

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 16, 2025

Walkthrough

Adds Organization.get_absolute_url(), fetches five recent active organizations in RegisterOrganizationView.get, and updates the registration template to show a "Recently Registered Organizations" grid and refactors message rendering.

Changes

Cohort / File(s) Summary
Model Enhancement
website/models.py
Added def get_absolute_url(self) to Organization, returning reverse("organization_detail", kwargs={"slug": self.slug}).
View Logic
website/views/company.py
Updated RegisterOrganizationView.get() to query the 5 most recent active Organization objects and pass them to the template as recent_organizations.
Template Display & Messaging
website/templates/organization/register_organization.html
Added a "Recently Registered Organizations" section that renders a responsive grid of org cards (links, timesince, icon) when recent_organizations is provided; refactored notification/messages rendering to loop messages and render icons and dismiss buttons.
Minor Formatting / Imports / Tests
blt/urls.py, website/templates/feed.html, website/test_feed.py, website/views/organization.py
Small import reorder in blt/urls.py; whitespace/formatting adjustments in website/templates/feed.html and website/test_feed.py; minor spacing change in website/views/organization.py. No behavior changes.

Sequence Diagram(s)

sequenceDiagram
    participant Browser
    participant View as RegisterOrganizationView.get
    participant DB as Organization Model
    participant Template as register_organization.html

    Browser->>View: GET /organizations/register/
    View->>DB: Query active Organizations (order by created desc, limit 5)
    DB-->>View: recent_organizations list
    View->>Template: render(context including recent_organizations, form, messages)
    Template-->>Browser: HTML with form + recently registered grid (if provided) + messages
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify the ORM query: filtering by active, correct ordering, and limit of 5.
  • Confirm get_absolute_url() uses the correct URL name and slug parameter.
  • Review register_organization.html changes for proper escaping, message type handling, and accessibility of dismiss behavior.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Most changes are directly related to the feature objective. However, several files contain unrelated formatting/whitespace changes (feed.html, test_feed.py, organization.py, urls.py import reordering) that are outside the scope of adding recently registered organizations. Remove unrelated formatting changes in feed.html, test_feed.py, organization.py, and urls.py to keep the PR focused on the feature implementation.
Docstring Coverage ⚠️ Warning Docstring coverage is 73.33% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding recently registered organizations to the registration page, which is the primary objective of this PR.
Linked Issues check ✅ Passed All coding requirements from issue #4802 are met: the PR adds get_absolute_url method to Organization model, queries the five most recent organizations in the view, and displays them in the registration page template.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between daff229 and 05b8e81.

📒 Files selected for processing (5)
  • blt/urls.py (1 hunks)
  • website/templates/feed.html (1 hunks)
  • website/templates/organization/register_organization.html (10 hunks)
  • website/test_feed.py (8 hunks)
  • website/views/organization.py (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • website/templates/feed.html
  • blt/urls.py
  • website/views/organization.py
🧰 Additional context used
🪛 Ruff (0.14.5)
website/test_feed.py

17-17: Possible hardcoded password assigned to argument: "password"

(S106)


21-21: Possible hardcoded password assigned to argument: "password"

(S106)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Run Tests
  • GitHub Check: docker-test
🔇 Additional comments (3)
website/test_feed.py (2)

17-17: Acknowledge Ruff S106 warnings on hardcoded test passwords.

Ruff flags hardcoded passwords in test user creation (lines 17 and 21). While this is an accepted pattern in test code for reproducibility and is not a production security concern, consider whether your project's security policies discourage hardcoding even test credentials. If desired, consider using factory.Faker('password') or environment variables for test secrets.

For now, this is acceptable for test code and does not block the PR.

Also applies to: 21-21


43-122: All test methods are correctly structured and assert appropriate behavior.

The test suite thoroughly covers feed loading, activity display, permission-based delete authorization, and RSS feed functionality. All marked changes are formatting-only and do not alter test logic or assertions. Test coverage remains intact.

website/templates/organization/register_organization.html (1)

234-263: ✓ Recently Registered Organizations section looks good.

The newly added section properly structures the organizations list using a responsive grid, displays organization names as links via org.get_absolute_url, and shows registration timestamps. The conditional {% if recent_organizations %} prevents rendering when the context var is empty.

Ensure that Organization.get_absolute_url() is correctly implemented in models.py to provide valid links for each organization item.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added files-changed: 3 PR changes 3 files unresolved-conversations: 0 PR has 0 unresolved conversations labels Nov 16, 2025
@github-project-automation github-project-automation bot moved this from Backlog to Ready in 📌 OWASP BLT Project Board Nov 16, 2025
@Satish-Medar Satish-Medar force-pushed the feat/add-recent-orgs-v2 branch from 8a262c2 to f7a8da2 Compare November 16, 2025 04:26
@github-actions
Copy link
Contributor

👋 Hi @Satish-Medar!

This pull request needs a peer review before it can be merged. Please request a review from a team member who is not:

  • The PR author
  • DonnieBLT
  • coderabbit
  • copilot

Once a valid peer review is submitted, this check will pass automatically. Thank you!

Copy link
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

🧹 Nitpick comments (2)
website/templates/organization/register_organization.html (1)

220-249: LGTM! Consider displaying organization logos.

The recently registered organizations section is well-implemented with proper conditional rendering and responsive grid layout. The generic building icon provides consistency.

As an optional enhancement, consider displaying each organization's logo if available, falling back to the generic icon when no logo exists.

If you'd like to display organization logos, here's a suggested approach:

-                                    <div class="flex-shrink-0 flex items-center justify-center w-16 h-16 bg-gray-200 rounded-l-md">
-                                        <svg class="h-8 w-8 text-gray-600"
-                                             xmlns="http://www.w3.org/2000/svg"
-                                             fill="none"
-                                             viewBox="0 0 24 24"
-                                             stroke-width="1.5"
-                                             stroke="currentColor">
-                                            <path stroke-linecap="round" stroke-linejoin="round" d="M3.75 21h16.5M4.5 3h15M5.25 3v18m13.5-18v18M8.25 6h7.5m-7.5 3h7.5m-7.5 3h7.5m-7.5 3h7.5m-7.5 3h7.5" />
-                                        </svg>
-                                    </div>
+                                    <div class="flex-shrink-0 flex items-center justify-center w-16 h-16 bg-gray-200 rounded-l-md overflow-hidden">
+                                        {% if org.logo %}
+                                            <img src="{{ org.logo.url }}" alt="{{ org.name }} logo" class="w-full h-full object-cover">
+                                        {% else %}
+                                            <svg class="h-8 w-8 text-gray-600"
+                                                 xmlns="http://www.w3.org/2000/svg"
+                                                 fill="none"
+                                                 viewBox="0 0 24 24"
+                                                 stroke-width="1.5"
+                                                 stroke="currentColor">
+                                                <path stroke-linecap="round" stroke-linejoin="round" d="M3.75 21h16.5M4.5 3h15M5.25 3v18m13.5-18v18M8.25 6h7.5m-7.5 3h7.5m-7.5 3h7.5m-7.5 3h7.5m-7.5 3h7.5" />
+                                            </svg>
+                                        {% endif %}
+                                    </div>
website/views/company.py (1)

136-138: Optimize query to fetch only required fields.

The query fetches all fields from the Organization model, but the template only uses name, slug (via get_absolute_url), and created. Consider using .only() to fetch only the required fields for better performance.

Apply this diff to optimize the query:

-        recent_organizations = Organization.objects.filter(is_active=True).order_by("-created")[:5]
+        recent_organizations = Organization.objects.filter(is_active=True).only("id", "name", "slug", "created").order_by("-created")[:5]
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between b1edc93 and f7a8da2.

📒 Files selected for processing (3)
  • website/models.py (1 hunks)
  • website/templates/organization/register_organization.html (1 hunks)
  • website/views/company.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Run Tests
  • GitHub Check: docker-test
🔇 Additional comments (1)
website/models.py (1)

233-234: URL route verified and correctly configured.

The organization_detail URL pattern exists at blt/urls.py:1063 and is properly configured with a slug parameter that matches the kwargs passed in get_absolute_url().

@github-actions github-actions bot added unresolved-conversations: 1 PR has 1 unresolved conversation and removed unresolved-conversations: 0 PR has 0 unresolved conversations labels Nov 16, 2025
@Satish-Medar Satish-Medar force-pushed the feat/add-recent-orgs-v2 branch from 69540be to 9339236 Compare November 16, 2025 05:05
@github-actions github-actions bot added unresolved-conversations: 0 PR has 0 unresolved conversations and removed unresolved-conversations: 1 PR has 1 unresolved conversation labels Nov 16, 2025
@Satish-Medar Satish-Medar force-pushed the feat/add-recent-orgs-v2 branch from de2d7d2 to dca6c57 Compare November 16, 2025 08:44
@github-actions github-actions bot added files-changed: 6 PR changes 6 files and removed files-changed: 3 PR changes 3 files labels Nov 16, 2025
@Satish-Medar Satish-Medar force-pushed the feat/add-recent-orgs-v2 branch from dca6c57 to 3aecef5 Compare November 16, 2025 09:01
@github-actions github-actions bot added files-changed: 3 PR changes 3 files and removed files-changed: 6 PR changes 6 files labels Nov 16, 2025
Copy link
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: 0

🧹 Nitpick comments (3)
website/views/company.py (1)

136-138: Consider optimizing the query to fetch only required fields.

The query fetches all fields from the Organization model, but the template only uses name, created, and slug. Consider using .only() to reduce the data transferred from the database:

-        recent_organizations = Organization.objects.filter(is_active=True).order_by("-created")[:5]
+        recent_organizations = Organization.objects.filter(is_active=True).only("name", "slug", "created").order_by("-created")[:5]

Additionally, consider caching this query since the registration page is public and may receive significant traffic, while the list of recent organizations doesn't change frequently.

website/templates/organization/register_organization.html (2)

220-249: Consider displaying organization logos and improving accessibility.

The recently registered organizations section currently displays a generic building icon for all organizations. Consider using the actual organization logo when available to make the list more visually distinctive:

<div class="flex-shrink-0 flex items-center justify-center w-16 h-16 bg-gray-200 rounded-l-md">
    {% if org.logo %}
        <img src="{{ org.logo.url }}" alt="{{ org.name }} logo" class="h-full w-full object-cover" />
    {% else %}
        <svg class="h-8 w-8 text-gray-600" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
            <path stroke-linecap="round" stroke-linejoin="round" d="M3.75 21h16.5M4.5 3h15M5.25 3v18m13.5-18v18M8.25 6h7.5m-7.5 3h7.5m-7.5 3h7.5m-7.5 3h7.5m-7.5 3h7.5" />
        </svg>
    {% endif %}
</div>

Additionally, for accessibility, consider adding truncation for long organization names and making the link text more descriptive:

<a href="{{ org.get_absolute_url }}" 
   class="font-medium text-gray-900 hover:text-gray-600 truncate" 
   title="View {{ org.name }} details">
    {{ org.name }}
</a>

252-299: Consider mobile responsiveness and auto-dismiss for notifications.

The notification container uses fixed positioning (bottom-5 right-5), which could overlap with content or extend beyond the viewport on mobile devices. Consider adding responsive positioning:

<div id="notification-container"
     class="fixed bottom-5 right-5 z-50 space-y-4 max-w-full sm:max-w-sm">

Additionally, consider implementing auto-dismiss functionality for success messages to improve user experience:

// In your scripts block
document.addEventListener('DOMContentLoaded', function() {
    // Auto-dismiss success messages after 5 seconds
    const successAlerts = document.querySelectorAll('[id^="alert-success-"]');
    successAlerts.forEach(function(alert) {
        setTimeout(function() {
            alert.remove();
        }, 5000);
    });
});

Error messages should remain dismissable only via user action, as they may require the user's attention.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between dca6c57 and 3aecef5.

📒 Files selected for processing (3)
  • website/models.py (1 hunks)
  • website/templates/organization/register_organization.html (1 hunks)
  • website/views/company.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Run Tests
  • GitHub Check: docker-test
🔇 Additional comments (1)
website/models.py (1)

233-234: LGTM! Standard Django pattern for generating organization URLs.

The get_absolute_url() method correctly returns a reverse URL using the organization's slug, following Django conventions.

@Satish-Medar
Copy link
Author

@DonnieBLT please review for merge

@sidd190
Copy link
Contributor

sidd190 commented Nov 16, 2025

Kindly address the nitpicks. Almost all of those seem useful to me.

Copy link
Collaborator

@DonnieBLT DonnieBLT left a comment

Choose a reason for hiding this comment

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

please also add a screenshot

@DonnieBLT DonnieBLT added d15 and removed d15 labels Nov 16, 2025
Copy link
Collaborator

Choose a reason for hiding this comment

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

add a screenshot

@github-actions github-actions bot added unresolved-conversations: 1 PR has 1 unresolved conversation and removed unresolved-conversations: 0 PR has 0 unresolved conversations labels Nov 17, 2025
Copy link
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

🧹 Nitpick comments (1)
website/templates/organization/register_organization.html (1)

225-254: Add dark mode support to maintain consistency.

The "Recently Registered Organizations" section is missing dark mode styling classes, while the rest of the template includes them. This creates a visual inconsistency when users switch to dark mode.

Apply these changes to add dark mode support:

-                        <h3 class="text-lg font-medium leading-6 text-gray-900">Recently Registered Organizations</h3>
+                        <h3 class="text-lg font-medium leading-6 text-gray-900 dark:text-gray-100">Recently Registered Organizations</h3>
-                        <p class="mt-1 text-sm text-gray-600">Check out the latest organizations that have joined our platform.</p>
+                        <p class="mt-1 text-sm text-gray-600 dark:text-gray-400">Check out the latest organizations that have joined our platform.</p>
-                                    <div class="flex-shrink-0 flex items-center justify-center w-16 h-16 bg-gray-200 rounded-l-md">
-                                        <svg class="h-8 w-8 text-gray-600"
+                                    <div class="flex-shrink-0 flex items-center justify-center w-16 h-16 bg-gray-200 dark:bg-gray-700 rounded-l-md">
+                                        <svg class="h-8 w-8 text-gray-600 dark:text-gray-400"
-                                    <div class="flex flex-1 items-center justify-between truncate rounded-r-md border-b border-r border-t border-gray-200 bg-white">
+                                    <div class="flex flex-1 items-center justify-between truncate rounded-r-md border-b border-r border-t border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800">
                                         <div class="flex-1 truncate px-4 py-2 text-sm">
                                             <a href="{{ org.get_absolute_url }}"
-                                               class="font-medium text-gray-900 hover:text-gray-600">{{ org.name }}</a>
-                                            <p class="text-gray-500">{{ org.created|timesince }} ago</p>
+                                               class="font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-400">{{ org.name }}</a>
+                                            <p class="text-gray-500 dark:text-gray-400">{{ org.created|timesince }} ago</p>
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 3aecef5 and daff229.

📒 Files selected for processing (3)
  • website/models.py (1 hunks)
  • website/templates/organization/register_organization.html (1 hunks)
  • website/views/company.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • website/views/company.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Run Tests
  • GitHub Check: docker-test
🔇 Additional comments (1)
website/models.py (1)

242-243: LGTM! Standard Django pattern implemented correctly.

The get_absolute_url() method follows Django conventions and is consistent with similar methods in Domain (line 336) and Hunt (line 439) models.

Comment on lines +258 to +313
<!-- Notification Messages -->
{% if messages %}
<div id="notification-container"
class="fixed bottom-5 right-5 z-50 space-y-4">
{% for message in messages %}
{% if message.level_tag == 'error' %}
<div id="alert-error-{{ forloop.counter }}"
class="popup-errors flex items-start p-4 mb-4 w-80 text-red-800 border-l-4 border-[#e74c3c] bg-red-50 rounded-md shadow-lg"
role="alert">
<div class="flex-shrink-0 mt-0.5">
<i class="fas fa-exclamation-circle text-[#e74c3c]"></i>
</div>
{% else %}
<div id="alert-success-{{ forloop.counter }}"
class="popup-errors flex items-start p-4 mb-4 w-80 text-green-800 border-l-4 border-green-500 bg-green-50 rounded-md shadow-lg"
role="alert">
<div class="flex-shrink-0 mt-0.5">
<i class="fas fa-check-circle text-green-500"></i>
</div>
<div class="ml-3">
<h3 class="text-sm font-medium text-green-800">{% trans "Success" %}</h3>
<div class="mt-1 text-sm text-green-700">{{ message }}</div>
</div>
<button type="button"
onclick="removeError('alert-success-{{ forloop.counter }}')"
class="ml-auto -mx-1.5 -my-1.5 bg-green-50 text-green-500 rounded-lg p-1.5 hover:bg-green-100 inline-flex h-8 w-8 items-center justify-center"
aria-label="{% trans 'Dismiss' %}">
<span class="sr-only">{% trans "Dismiss" %}</span>
<i class="fas fa-times"></i>
</button>
<div class="ml-3">
<h3 class="text-sm font-medium text-red-800">{% trans "Error" %}</h3>
<div class="mt-1 text-sm text-red-700">{{ message }}</div>
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
</div>
<button type="button"
onclick="removeError('alert-error-{{ forloop.counter }}')"
class="ml-auto -mx-1.5 -my-1.5 bg-red-50 text-red-500 rounded-lg p-1.5 hover:bg-red-100 inline-flex h-8 w-8 items-center justify-center"
aria-label="{% trans 'Dismiss' %}">
<span class="sr-only">{% trans "Dismiss" %}</span>
<i class="fas fa-times"></i>
</button>
</div>
{% else %}
<div id="alert-success-{{ forloop.counter }}"
class="popup-errors flex items-start p-4 mb-4 w-80 text-green-800 border-l-4 border-green-500 bg-green-50 rounded-md shadow-lg"
role="alert">
<div class="flex-shrink-0 mt-0.5">
<i class="fas fa-check-circle text-green-500"></i>
</div>
<div class="ml-3">
<h3 class="text-sm font-medium text-green-800">{% trans "Success" %}</h3>
<div class="mt-1 text-sm text-green-700">{{ message }}</div>
</div>
<button type="button"
onclick="removeError('alert-success-{{ forloop.counter }}')"
class="ml-auto -mx-1.5 -my-1.5 bg-green-50 text-green-500 rounded-lg p-1.5 hover:bg-green-100 inline-flex h-8 w-8 items-center justify-center"
aria-label="{% trans 'Dismiss' %}">
<span class="sr-only">{% trans "Dismiss" %}</span>
<i class="fas fa-times"></i>
</button>
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify message level handling or add explicit checks.

The notification refactor assumes only two message types: error and everything else (treated as success). If the codebase can generate warning, info, or debug messages, they would incorrectly display with success (green) styling.

Run the following script to check if other message levels are used in the codebase:

If other message levels are found, consider adding explicit handling:

             {% for message in messages %}
                 {% if message.level_tag == 'error' %}
                     <div id="alert-error-{{ forloop.counter }}"
                          class="popup-errors flex items-start p-4 mb-4 w-80 text-red-800 border-l-4 border-[#e74c3c] bg-red-50 rounded-md shadow-lg"
                          role="alert">
                         <!-- error content -->
                     </div>
-                {% else %}
+                {% elif message.level_tag == 'success' %}
                     <div id="alert-success-{{ forloop.counter }}"
                          class="popup-errors flex items-start p-4 mb-4 w-80 text-green-800 border-l-4 border-green-500 bg-green-50 rounded-md shadow-lg"
                          role="alert">
                         <!-- success content -->
                     </div>
+                {% else %}
+                    {# Handle warning, info, debug with appropriate styling #}
                 {% endif %}
             {% endfor %}

🏁 Script executed:

#!/bin/bash
# Search for Django messages calls with warning, info, or debug levels
rg -n --type=py -C2 'messages\.(warning|info|debug)\(' 

# Also check for level constants
rg -n --type=py -C2 'messages\.(WARNING|INFO|DEBUG)'

Length of output: 7887


Add explicit handling for warning and info message levels.

Verification found that the codebase uses messages.warning() and messages.info() extensively throughout views (user.py, company.py, issue.py, hackathon.py, organization.py, staking_competitive.py, queue.py, core.py), but the template only conditionally renders error and implicitly treats all other levels as success. This causes warning and info messages to display with green success styling, creating semantic and UX confusion.

Update the template to explicitly handle each level:

             {% for message in messages %}
                 {% if message.level_tag == 'error' %}
                     <div id="alert-error-{{ forloop.counter }}"
                          class="popup-errors flex items-start p-4 mb-4 w-80 text-red-800 border-l-4 border-[#e74c3c] bg-red-50 rounded-md shadow-lg"
                          role="alert">
                         <!-- error content -->
                     </div>
+                {% elif message.level_tag == 'warning' %}
+                    <div id="alert-warning-{{ forloop.counter }}"
+                         class="popup-errors flex items-start p-4 mb-4 w-80 text-amber-800 border-l-4 border-amber-500 bg-amber-50 rounded-md shadow-lg"
+                         role="alert">
+                        <div class="flex-shrink-0 mt-0.5">
+                            <i class="fas fa-exclamation-triangle text-amber-500"></i>
+                        </div>
+                        <div class="ml-3">
+                            <h3 class="text-sm font-medium text-amber-800">{% trans "Warning" %}</h3>
+                            <div class="mt-1 text-sm text-amber-700">{{ message }}</div>
+                        </div>
+                        <button type="button"
+                                onclick="removeError('alert-warning-{{ forloop.counter }}')"
+                                class="ml-auto -mx-1.5 -my-1.5 bg-amber-50 text-amber-500 rounded-lg p-1.5 hover:bg-amber-100 inline-flex h-8 w-8 items-center justify-center"
+                                aria-label="{% trans 'Dismiss' %}">
+                            <span class="sr-only">{% trans "Dismiss" %}</span>
+                            <i class="fas fa-times"></i>
+                        </button>
+                    </div>
+                {% elif message.level_tag == 'info' %}
+                    <div id="alert-info-{{ forloop.counter }}"
+                         class="popup-errors flex items-start p-4 mb-4 w-80 text-blue-800 border-l-4 border-blue-500 bg-blue-50 rounded-md shadow-lg"
+                         role="alert">
+                        <div class="flex-shrink-0 mt-0.5">
+                            <i class="fas fa-info-circle text-blue-500"></i>
+                        </div>
+                        <div class="ml-3">
+                            <h3 class="text-sm font-medium text-blue-800">{% trans "Info" %}</h3>
+                            <div class="mt-1 text-sm text-blue-700">{{ message }}</div>
+                        </div>
+                        <button type="button"
+                                onclick="removeError('alert-info-{{ forloop.counter }}')"
+                                class="ml-auto -mx-1.5 -my-1.5 bg-blue-50 text-blue-500 rounded-lg p-1.5 hover:bg-blue-100 inline-flex h-8 w-8 items-center justify-center"
+                                aria-label="{% trans 'Dismiss' %}">
+                            <span class="sr-only">{% trans "Dismiss" %}</span>
+                            <i class="fas fa-times"></i>
+                        </button>
+                    </div>
-                {% else %}
+                {% elif message.level_tag == 'success' %}
                     <div id="alert-success-{{ forloop.counter }}"
                          class="popup-errors flex items-start p-4 mb-4 w-80 text-green-800 border-l-4 border-green-500 bg-green-50 rounded-md shadow-lg"
                          role="alert">
                         <!-- success content -->
                     </div>
+                {% else %}
+                    {# Fallback for other message levels (e.g., debug) #}
+                    <div id="alert-default-{{ forloop.counter }}"
+                         class="popup-errors flex items-start p-4 mb-4 w-80 text-gray-800 border-l-4 border-gray-500 bg-gray-50 rounded-md shadow-lg"
+                         role="alert">
+                        <div class="flex-shrink-0 mt-0.5">
+                            <i class="fas fa-info-circle text-gray-500"></i>
+                        </div>
+                        <div class="ml-3">
+                            <h3 class="text-sm font-medium text-gray-800">{% trans "Message" %}</h3>
+                            <div class="mt-1 text-sm text-gray-700">{{ message }}</div>
+                        </div>
+                        <button type="button"
+                                onclick="removeError('alert-default-{{ forloop.counter }}')"
+                                class="ml-auto -mx-1.5 -my-1.5 bg-gray-50 text-gray-500 rounded-lg p-1.5 hover:bg-gray-100 inline-flex h-8 w-8 items-center justify-center"
+                                aria-label="{% trans 'Dismiss' %}">
+                            <span class="sr-only">{% trans "Dismiss" %}</span>
+                            <i class="fas fa-times"></i>
+                        </button>
+                    </div>
                 {% endif %}
             {% endfor %}

@github-actions github-actions bot added unresolved-conversations: 2 PR has 2 unresolved conversations and removed unresolved-conversations: 1 PR has 1 unresolved conversation labels Nov 17, 2025
@Satish-Medar Satish-Medar force-pushed the feat/add-recent-orgs-v2 branch from daff229 to 05b8e81 Compare November 17, 2025 17:53
@github-actions github-actions bot added files-changed: 7 PR changes 7 files has-conflicts PR has merge conflicts that need to be resolved and removed files-changed: 3 PR changes 3 files labels Nov 17, 2025
@github-actions
Copy link
Contributor

⚠️ Merge Conflicts Detected

Hi @Satish-Medar!

This pull request has merge conflicts with the base branch that need to be resolved before it can be merged.

To resolve the conflicts:

  1. Sync your branch with the base branch:

    git fetch origin
    git merge origin/main
  2. Resolve any conflicts in your editor

  3. Commit the changes:

    git add .
    git commit -m "Resolve merge conflicts"
    git push

Once you push the resolved conflicts, this label and comment will be automatically updated.

Thank you! 🙏

@github-actions github-actions bot added the pre-commit: passed Pre-commit checks passed label Nov 17, 2025
@Satish-Medar
Copy link
Author

Hi @DonnieBLT and @sidd190 , thank you for the reviews!

I have just:

Pushed a new commit that fixes all the pre-commit formatting issues.

Accepted/fixed all the coderabbitai bot's nitpicks.

Added the local test screenshot to the PR description as requested.

All checks should be green now and it should be ready to merge. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

files-changed: 7 PR changes 7 files has-conflicts PR has merge conflicts that need to be resolved pre-commit: passed Pre-commit checks passed unresolved-conversations: 2 PR has 2 unresolved conversations

Projects

Status: Ready

Development

Successfully merging this pull request may close these issues.

Feature: Add Recently Registered Orgs to Registration Page

3 participants