Skip to content

Commit

Permalink
Merge branch 'main' into CONCD-924-rsar-merge-feature
Browse files Browse the repository at this point in the history
  • Loading branch information
rasarkar authored Oct 28, 2024
2 parents eb536f4 + 65af313 commit 77ef11f
Show file tree
Hide file tree
Showing 10 changed files with 405 additions and 22 deletions.
7 changes: 3 additions & 4 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion concordia/static/js/src/viewer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global OpenSeadragon screenfull debounce */
/* global OpenSeadragon screenfull debounce displayMessage */

const viewerData = document.getElementById('viewer-data').dataset;

Expand Down Expand Up @@ -221,4 +221,13 @@ thresholdDown.addEventListener('click', function () {
let reset = document.getElementById('viewer-reset');
reset.addEventListener('click', resetImageFilterForms);

seadragonViewer.addHandler('open-failed', function (eventData) {
let message = eventData.message;
displayMessage(
'error',
'Unable to display image: ' + message,
'openseadragon-open-failed',
);
});

export {seadragonViewer};
16 changes: 4 additions & 12 deletions concordia/static/scss/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -941,19 +941,11 @@ body .disabled > .page-link {

@include media-breakpoint-up(md) {
.carousel-control-next-icon {
background-image: url('data:image/svg+xml;charset=utf8,%3Csvg%20height%3D%2255%22%20viewBox%3D%220%200%2033%2055%22%20width%3D%2233%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22m1221.23218%20395.14282c0%20.428572-.21429.910716-.53571%201.232145l-24.96432%2024.964315c-.32143.321429-.80357.535715-1.23214.535715-.42858%200-.91072-.214286-1.23215-.535715l-2.67857-2.678574c-.32143-.321429-.53572-.750001-.53572-1.232145%200-.428572.21429-.910715.53572-1.232144l21.05359-21.053597-21.05359-21.053596c-.32143-.321429-.53572-.803573-.53572-1.232144%200-.428572.21429-.910716.53572-1.232145l2.67857-2.678574c.32143-.321429.80357-.535715%201.23215-.535715.42857%200%20.91071.214286%201.23214.535715l24.96432%2024.964315c.32142.321429.53571.803572.53571%201.232144z%22%20fill%3D%22%23fff%22%20fill-rule%3D%22evenodd%22%20stroke%3D%22%23333%22%20stroke-width%3D%22.5%22%20transform%3D%22translate%28-1189%20-368%29%22/%3E%3C/svg%3E');
}

.carousel-control-next:hover .carousel-control-next-icon {
background-image: url('data:image/svg+xml;charset=utf8,%3Csvg%20height%3D%2255%22%20viewBox%3D%220%200%2033%2055%22%20width%3D%2233%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22m1221.23218%20395.14282c0%20.428572-.21429.910716-.53571%201.232145l-24.96432%2024.964315c-.32143.321429-.80357.535715-1.23214.535715-.42858%200-.91072-.214286-1.23215-.535715l-2.67857-2.678574c-.32143-.321429-.53572-.750001-.53572-1.232145%200-.428572.21429-.910715.53572-1.232144l21.05359-21.053597-21.05359-21.053596c-.32143-.321429-.53572-.803573-.53572-1.232144%200-.428572.21429-.910716.53572-1.232145l2.67857-2.678574c.32143-.321429.80357-.535715%201.23215-.535715.42857%200%20.91071.214286%201.23214.535715l24.96432%2024.964315c.32142.321429.53571.803572.53571%201.232144z%22%20fill%3D%22%23FC4C02%22%20fill-rule%3D%22evenodd%22%20stroke%3D%22%23fff%22%20stroke-width%3D%22.5%22%20transform%3D%22translate%28-1189%20-368%29%22/%3E%3C/svg%3E');
background-image: url('data:image/svg+xml;charset=utf8,%3Csvg%20height%3D%2255%22%20viewBox%3D%220%200%2033%2055%22%20width%3D%2233%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22m1221.23218%20395.14282c0%20.428572-.21429.910716-.53571%201.232145l-24.96432%2024.964315c-.32143.321429-.80357.535715-1.23214.535715-.42858%200-.91072-.214286-1.23215-.535715l-2.67857-2.678574c-.32143-.321429-.53572-.750001-.53572-1.232145%200-.428572.21429-.910715.53572-1.232144l21.05359-21.053597-21.05359-21.053596c-.32143-.321429-.53572-.803573-.53572-1.232144%200-.428572.21429-.910716.53572-1.232145l2.67857-2.678574c.32143-.321429.80357-.535715%201.23215-.535715.42857%200%20.91071.214286%201.23214.535715l24.96432%2024.964315c.32142.321429.53571.803572.53571%201.232144z%22%20fill%3D%22%230076ad%22%20fill-rule%3D%22evenodd%22%20stroke%3D%22%23333%22%20stroke-width%3D%22.5%22%20transform%3D%22translate%28-1189%20-368%29%22/%3E%3C/svg%3E');
}

.carousel-control-prev-icon {
background-image: url('data:image/svg+xml;charset=utf8,%3Csvg%20height%3D%2255%22%20viewBox%3D%220%200%2033%2055%22%20width%3D%2233%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22m100.946469%20372.85708c0%20.428571-.214286.910715-.535715%201.232144l-21.0535968%2021.053596%2021.0535968%2021.053597c.321429.321429.535715.803572.535715%201.232144s-.214286.910716-.535715%201.232145l-2.6785749%202.678574c-.321429.321429-.8035724.535715-1.2321444.535715-.4285719%200-.9107153-.214286-1.2321443-.535715l-24.9643155-24.964315c-.3214289-.321429-.5357149-.803573-.5357149-1.232145s.214286-.910715.5357149-1.232144l24.9643155-24.964315c.321429-.321429.8035724-.535715%201.2321443-.535715.428572%200%20.9107154.214286%201.2321444.535715l2.6785749%202.678574c.321429.321429.535715.750001.535715%201.232145z%22%20fill%3D%22%23fff%22%20fill-rule%3D%22evenodd%22%20stroke%3D%22%23333%22%20stroke-width%3D%22.5%22%20transform%3D%22translate%28-69%20-368%29%22/%3E%3C/svg%3E');
}

.carousel-control-prev:hover .carousel-control-prev-icon {
background-image: url('data:image/svg+xml;charset=utf8,%3Csvg%20height%3D%2255%22%20viewBox%3D%220%200%2033%2055%22%20width%3D%2233%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22m100.946469%20372.85708c0%20.428571-.214286.910715-.535715%201.232144l-21.0535968%2021.053596%2021.0535968%2021.053597c.321429.321429.535715.803572.535715%201.232144s-.214286.910716-.535715%201.232145l-2.6785749%202.678574c-.321429.321429-.8035724.535715-1.2321444.535715-.4285719%200-.9107153-.214286-1.2321443-.535715l-24.9643155-24.964315c-.3214289-.321429-.5357149-.803573-.5357149-1.232145s.214286-.910715.5357149-1.232144l24.9643155-24.964315c.321429-.321429.8035724-.535715%201.2321443-.535715.428572%200%20.9107154.214286%201.2321444.535715l2.6785749%202.678574c.321429.321429.535715.750001.535715%201.232145z%22%20fill%3D%22%23FC4C02%22%20fill-rule%3D%22evenodd%22%20stroke%3D%22%23fff%22%20stroke-width%3D%22.5%22%20transform%3D%22translate%28-69%20-368%29%22/%3E%3C/svg%3E');
background-image: url('data:image/svg+xml;charset=utf8,%3Csvg%20height%3D%2255%22%20viewBox%3D%220%200%2033%2055%22%20width%3D%2233%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22m100.946469%20372.85708c0%20.428571-.214286.910715-.535715%201.232144l-21.0535968%2021.053596%2021.0535968%2021.053597c.321429.321429.535715.803572.535715%201.232144s-.214286.910716-.535715%201.232145l-2.6785749%202.678574c-.321429.321429-.8035724.535715-1.2321444.535715-.4285719%200-.9107153-.214286-1.2321443-.535715l-24.9643155-24.964315c-.3214289-.321429-.5357149-.803573-.5357149-1.232145s.214286-.910715.5357149-1.232144l24.9643155-24.964315c.321429-.321429.8035724-.535715%201.2321443-.535715.428572%200%20.9107154.214286%201.2321444.535715l2.6785749%202.678574c.321429.321429.535715.750001.535715%201.232145z%22%20fill%3D%22%230076ad%22%20fill-rule%3D%22evenodd%22%20stroke%3D%22%23333%22%20stroke-width%3D%22.5%22%20transform%3D%22translate%28-69%20-368%29%22/%3E%3C/svg%3E');
}
}

Expand All @@ -972,8 +964,8 @@ body .disabled > .page-link {
width: 12px;

&.active {
background-color: $accent;
border-color: $white;
background-color: $blue;
border-color: $blue;
}
}

Expand Down
6 changes: 5 additions & 1 deletion concordia/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,18 @@ <h2 class="h3 fw-normal text-center text-lg-start">Follow
integrity="sha384-PKOJCSVL6suo2Qz9Hs4hkrZqX7S6iLwadxXxBEa0h0ycsuoDNZCiAcHlPGHYxU6l"
crossorigin="anonymous"></script>
<script>
// Don't load Sentry if this is the "always online" version of the page,
// which is the version CloudFlare serves if the actual site is down
if (navigator.userAgent.indexOf("CloudFlare-AlwaysOnline") < 0) {
Sentry.init({
'dsn': '{{ SENTRY_FRONTEND_DSN }}',
'release': '{{ APPLICATION_VERSION }}',
'environment': '{{ CONCORDIA_ENVIRONMENT }}',
'blacklistUrls': [
/^moz-extension/
]
],
// Turnstile 300xxx and 600xxx errors indicate the user failed validation. We don't want those in Sentry
'ignoreErrors': ["[Cloudflare Turnstile] Error: 600", "[Cloudflare Turnstile] Error: 300"]
});
}
</script>
Expand Down
1 change: 0 additions & 1 deletion concordia/templates/transcriptions/asset_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@
Contact us
</a>
</div>

</div>
</div>
</div>
Expand Down
70 changes: 69 additions & 1 deletion concordia/tests/test_account_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
Tests for user account-related views
"""

from django.core import mail
from unittest.mock import patch

from django import forms
from django.core import mail, signing
from django.core.cache import cache
from django.test import TestCase, override_settings
from django.urls import reverse

Expand All @@ -24,6 +28,12 @@ class ConcordiaViewTests(
This class contains the unit tests for the view in the concordia app.
"""

def setUp(self):
cache.clear()

def tearDown(self):
cache.clear()

def test_AccountProfileView_get(self):
"""
Test the http GET on route account/profile
Expand Down Expand Up @@ -151,6 +161,64 @@ def test_email_reconfirmation(self):
concordia_user.get_email_for_reconfirmation(), email_data["email"]
)
confirmation_key = concordia_user.get_email_reconfirmation_key()

# Check if user failing validation is handled
with patch("concordia.models.ConcordiaUser.full_clean") as mock:
mock.side_effect = forms.ValidationError("Testing error")
error_response = self.client.get(
reverse(
"email-reconfirmation",
kwargs={"confirmation_key": confirmation_key},
)
)
self.assertEqual(error_response.status_code, 403)
self.assertTemplateUsed(
error_response, "account/email_reconfirmation_failed.html"
)

# Check if invalid data from confirmation key is handled
with patch("django.core.signing.loads") as mock:
mock.return_value = {
"username": "bad-username",
"email": "bad-email-address",
}
error_response = self.client.get(
reverse(
"email-reconfirmation",
kwargs={"confirmation_key": confirmation_key},
)
)
self.assertEqual(error_response.status_code, 403)
self.assertTemplateUsed(
error_response, "account/email_reconfirmation_failed.html"
)

# Check if signing errors are handled
with patch("django.core.signing.loads") as mock:
mock.side_effect = signing.BadSignature()
error_response = self.client.get(
reverse(
"email-reconfirmation",
kwargs={"confirmation_key": confirmation_key},
)
)
self.assertEqual(error_response.status_code, 403)
self.assertTemplateUsed(
error_response, "account/email_reconfirmation_failed.html"
)

mock.side_effect = signing.SignatureExpired()
error_response = self.client.get(
reverse(
"email-reconfirmation",
kwargs={"confirmation_key": confirmation_key},
)
)
self.assertEqual(error_response.status_code, 403)
self.assertTemplateUsed(
error_response, "account/email_reconfirmation_failed.html"
)

confirmation_response = self.client.get(
reverse(
"email-reconfirmation",
Expand Down
Loading

0 comments on commit 77ef11f

Please sign in to comment.