Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge staging into production, 2024 Feb 22 edition #1326

Merged
merged 26 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
feac4a2
Add type annotations to ajax_melody_list view
jacobdgm Feb 13, 2024
54a8437
Add volpiano-display-utilities dependency
dchiller Feb 8, 2024
7d1fbc0
Remove unused next_chant import in views/chant.py
dchiller Feb 8, 2024
3259c99
Remove unused lxml import from views/chant.py
dchiller Feb 8, 2024
504a915
Update volpiano-display-utilities to v1.1.1
dchiller Feb 13, 2024
460d1e3
Use volpiano-display-utilities in chant syllabification edit
dchiller Feb 13, 2024
fc4ee7c
Use volpiano-display-utilities for chant detail view
dchiller Feb 13, 2024
a5e029e
Use volpiano-display-utilities in source chant edit view and template
dchiller Feb 13, 2024
bff0996
Remove unused imports from align_text_mel.py in views/chant.py
dchiller Feb 13, 2024
2e0b935
Remove unused syllabification and alignment tools and associated tests
dchiller Feb 13, 2024
ae7f1d6
fix bug in ajax_melody_list
jacobdgm Feb 13, 2024
5046d48
Write AjaxMelodyViewTest
jacobdgm Feb 13, 2024
d905d02
permissions: change user_can_edit_sequences permissions
lucasmarchd01 Feb 14, 2024
d5e47fe
delete export_chants_to_csv.py
jacobdgm Feb 15, 2024
4f7dc8c
nginx configuration: Specify all server_names in cantusdb.conf.produc…
jacobdgm Feb 15, 2024
6e1abf4
nginx configuration: Specify all server_names in cantusdb.conf.staging
jacobdgm Feb 15, 2024
f3d8f94
Delete ChantInventoryView
jacobdgm Feb 15, 2024
6629421
SourceInventoryView: Apply select_related optimization to diff_db field
jacobdgm Feb 15, 2024
e434c0f
Merge pull request #1317 from jacobdgm/1238-inventory-optimize
jacobdgm Feb 15, 2024
670f983
Merge pull request #1314 from jacobdgm/1186-ajax-melody
jacobdgm Feb 16, 2024
8121aba
Merge pull request #1313 from lucasmarchd01/issue-1294
lucasmarchd01 Feb 16, 2024
c0f9064
cantusdb.conf.production: Redirect traffic from www.cantusdatabase.or…
jacobdgm Feb 16, 2024
3b650b1
Merge pull request #1315 from jacobdgm/1289-server_names
jacobdgm Feb 16, 2024
8bab2b4
nginx configuration: redirect http traffic directly to https://cantus…
jacobdgm Feb 20, 2024
cdce59e
Merge pull request #1322 from jacobdgm/improve-1289
jacobdgm Feb 22, 2024
ae3873b
Merge pull request #1324 from DDMAL/develop
jacobdgm Feb 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 9 additions & 4 deletions config/nginx/conf.d/cantusdb.conf.production
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
server {
# Redirect all http traffic to corresponding canonical https page
listen 80;

server_name cantusdatabase.org www.cantusdatabase.org mass.cantusdatabase.org;

server_tokens off;

location ^~ /.well-known/acme-challenge/ {
root /var/www/lego;
}

location / {
return 301 https://$host$request_uri;
return 301 https://cantusdatabase.org$request_uri;
}
}

server {
# Redirect all https traffic for mass.cantusdatabase.org to cantusdatabase.org
# Redirect all https traffic for www.cantusdatabase.org and mass.cantusdatabase.org
# to cantusdatabase.org
listen 443 ssl;

server_name mass.cantusdatabase.org;
server_name www.cantusdatabase.org mass.cantusdatabase.org;

ssl_certificate /etc/nginx/ssl/live/certificates/cantusdatabase.org.crt;
ssl_certificate_key /etc/nginx/ssl/live/certificates/cantusdatabase.org.key;
Expand All @@ -27,8 +31,9 @@ server {
}

server {

listen 443 default_server http2 ssl;

server_name cantusdatabase.org;

ssl_certificate /etc/nginx/ssl/live/certificates/cantusdatabase.org.crt;
ssl_certificate_key /etc/nginx/ssl/live/certificates/cantusdatabase.org.key;
Expand Down
8 changes: 6 additions & 2 deletions config/nginx/conf.d/cantusdb.conf.staging
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
server {
# redirect all http traffic to corresponding canonical https page
listen 80;

server_name staging.cantusdatabase.org staging-alias.cantusdatabase.org;

server_tokens off;

location ^~ /.well-known/acme-challenge/ {
root /var/www/lego;
}

location / {
return 301 https://$host$request_uri;
return 301 https://staging.cantusdatabase.org$request_uri;
}
}

Expand All @@ -32,8 +35,9 @@ server {
}

server {

listen 443 default_server http2 ssl;

server_name staging.cantusdatabase.org;

# ssl_certificate /etc/nginx/ssl/live/certificates/cantusdatabase.org.crt;
# ssl_certificate_key /etc/nginx/ssl/live/certificates/cantusdatabase.org.key;
Expand Down
365 changes: 0 additions & 365 deletions django/cantusdb_project/align_text_mel.py

This file was deleted.

223 changes: 0 additions & 223 deletions django/cantusdb_project/latin_syllabification.py

This file was deleted.

23 changes: 21 additions & 2 deletions django/cantusdb_project/main_app/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,31 @@ def user_can_view_sequence(user: User, sequence: Sequence) -> bool:
return (source is not None) and ((source.published) or (user_is_authenticated))


def user_can_edit_sequences(user: User) -> bool:
def user_can_edit_sequences(user: User, sequence: Sequence) -> bool:
"""
Checks if the user has permission to edit a Sequence object.
Used in SequenceDetail and SequenceEdit views.
"""
return user.groups.filter(name="project manager").exists()
source = sequence.source
if user.is_anonymous or (source is None):
return False

source_id = source.id
user_is_assigned_to_source: bool = user.sources_user_can_edit.filter(
id=source_id
).exists()

user_is_project_manager: bool = user.groups.filter(name="project manager").exists()
user_is_editor: bool = user.groups.filter(name="editor").exists()
user_is_contributor: bool = user.groups.filter(name="contributor").exists()

return (
(user_is_project_manager)
or (user_is_editor and user_is_assigned_to_source)
or (user_is_editor and source.created_by == user)
or (user_is_contributor and user_is_assigned_to_source)
or (user_is_contributor and source.created_by == user)
)


def user_can_create_sources(user: User) -> bool:
Expand Down
14 changes: 6 additions & 8 deletions django/cantusdb_project/main_app/templates/chant_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,12 @@ <h3>{{ chant.incipit }}</h3>
<p><small>Syllabification is based on saved syllabized text.</small></p>
{% endif %}
<dd>
{% for zip in syllabized_text_with_melody %}
{% for syl_mel, syl_text in zip %}
<span style="float: left">
<div style="font-family: volpiano; font-size: 36px">{{ syl_mel }}</div>
<!-- "mt" is margin at the top, so that the lowest note in volpiano don't overlap with text -->
<div class="mt-2" style="font-size: 12px; "><pre>{{ syl_text }}</pre></div>
</span>
{% endfor %}
{% for syl_text, syl_mel in syllabized_text_with_melody %}
<span style="float: left">
<div style="font-family: volpiano; font-size: 36px">{{ syl_mel }}</div>
<!-- "mt" is margin at the top, so that the lowest note in volpiano don't overlap with text -->
<div class="mt-2" style="font-size: 12px; "><pre>{{ syl_text }}</pre></div>
</span>
{% endfor %}
</dd>
</div>
Expand Down
14 changes: 6 additions & 8 deletions django/cantusdb_project/main_app/templates/chant_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,12 @@
<p><small>Syllabification is based on saved syllabized text.</small></p>
{% endif %}
<dd>
{% for zip in syllabized_text_with_melody %}
{% for syl_mel, syl_text in zip %}
<span style="float: left">
<div style="font-family: volpiano; font-size: 36px">{{ syl_mel }}</div>
<!-- "mt" is margin at the top, so that the lowest note in volpiano don't overlap with text -->
<div class="mt-2" style="font-size: 12px; "><pre>{{ syl_text }}</pre></div>
</span>
{% endfor %}
{% for syl_text, syl_mel in syllabized_text_with_melody %}
<span style="float: left">
<div style="font-family: volpiano; font-size: 36px">{{ syl_mel }}</div>
<!-- "mt" is margin at the top, so that the lowest note in volpiano don't overlap with text -->
<div class="mt-2" style="font-size: 12px; "><pre>{{ syl_text }}</pre></div>
</span>
{% endfor %}
</dd>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,12 @@ <h3>Edit Syllabification</h3>
<small>Syllabification is based on saved syllabized text.</small>
<br>
{% endif %}
{% for zip in syllabized_text_with_melody %}
{% for syl_mel, syl_text in zip %}
<span style="float: left">
<div style="font-family: volpiano; font-size: 28px">{{ syl_mel }}</div>
<!-- "mt" is margin at the top, so that the lowest note in volpiano don't overlap with text -->
<div class="mt-2" style="font-size: 10px"><pre>{{ syl_text }}</pre></div>
</span>
{% endfor %}
{% for syl_text, syl_mel in syllabized_text_with_melody %}
<span style="float: left">
<div style="font-family: volpiano; font-size: 28px">{{ syl_mel }}</div>
<!-- "mt" is margin at the top, so that the lowest note in volpiano don't overlap with text -->
<div class="mt-2" style="font-size: 10px"><pre>{{ syl_text }}</pre></div>
</span>
{% endfor %}
</div>
</div>
Expand Down