From 33c309e18afd7baccc0c82addce45f6e82629b66 Mon Sep 17 00:00:00 2001 From: sea-kelp <66500457+sea-kelp@users.noreply.github.com> Date: Fri, 5 Jan 2024 16:46:53 +0000 Subject: [PATCH] Fix link edit/delete buttons showing when not logged in (#1086) ## Fixes issue Fixes #1085 ## Description of Changes This is a cherry-pick of https://github.com/OrcaCollective/OpenOversight/pull/403 --- Currently, the link edit and delete buttons show up on the officer page when visiting as an anonymous user. (see: https://openoversight.com/officers/83835) This is NOT a security issue as the user is asked to log in after clicking the link but may be confusing to users. ## Notes for Deployment None! ## Screenshots (if appropriate) N/A ## Tests and linting - [x] This branch is up-to-date with the `develop` branch. - [x] `pytest` passes on my local development environment. - [x] `pre-commit` passes on my local development environment. --- .../app/templates/partials/links_and_videos_row.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenOversight/app/templates/partials/links_and_videos_row.html b/OpenOversight/app/templates/partials/links_and_videos_row.html index e4987eefc..a345fdb8f 100644 --- a/OpenOversight/app/templates/partials/links_and_videos_row.html +++ b/OpenOversight/app/templates/partials/links_and_videos_row.html @@ -6,7 +6,7 @@

Links

{% for link in list %}
  • {{ link.title or link.url }} - {% if officer and (is_admin_or_coordinator or link.creator_id == current_user.id) %} + {% if officer and (is_admin_or_coordinator or link.created_by == current_user.id) %} Edit @@ -43,7 +43,7 @@

    Videos

  • {% if link.title %}
    {{ link.title }}
    {% endif %} {% if officer and (current_user.is_admin_or_coordinator(officer.department) - or link.creator_id == current_user.id) %} + or link.created_by == current_user.id) %}
    Edit @@ -82,7 +82,7 @@

    Other videos

  • {{ link.title or link.url }} {% if officer and (current_user.is_admin_or_coordinator(officer.department) - or link.creator_id == current_user.id) %} + or link.created_by == current_user.id) %} Edit