Skip to content
This repository was archived by the owner on Feb 3, 2024. It is now read-only.

Commit 91c29eb

Browse files
committed
JS Repairs with Hidden
1 parent 906f37d commit 91c29eb

File tree

5 files changed

+7
-49
lines changed

5 files changed

+7
-49
lines changed

quotefault/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def hide(quote_id):
325325
"""
326326
metadata = get_metadata()
327327
quote = Quote.query.get(quote_id)
328-
if not metadata['is_admin']:
328+
if not (metadata['uid'] == quote.submitter or metadata['uid'] == quote.speaker or metadata['is_admin']):
329329
abort(403)
330330
if not quote:
331331
abort(404)

quotefault/templates/bootstrap/admin.html

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,6 @@
1010
{% with messages = get_flashed_messages(with_categories=true) %}
1111
{% if messages %}
1212
{% for category, message in messages %}
13-
<script>
14-
switch (category) {
15-
case warning:
16-
category = warning
17-
case error:
18-
category = danger
19-
case
20-
default:
21-
category = success
22-
}
23-
</script>
2413
<div class="alert alert-{{ category }}" role="alert">
2514
{{ message }}
2615
</div>

quotefault/templates/bootstrap/hidden.html

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,18 @@
1010
// Get the modal
1111
var modal = document.getElementById(`unhide_${id}`);
1212
modal.style.display = "block";
13-
}
14-
function unhideClose(id){
15-
// Get the modal
16-
var modal = document.getElementById(`unhide_${id}`);
17-
modal.style.display = "none";
18-
}
13+
}
14+
function unhideClose(id){
15+
// Get the modal
16+
var modal = document.getElementById(`unhide_${id}`);
17+
modal.style.display = "none";
18+
}
1919
</script>
2020
<div class="container">
2121
<!-- flash relevant message when submit button is clicked -->
2222
{% with messages = get_flashed_messages(with_categories=true) %}
2323
{% if messages %}
2424
{% for category, message in messages %}
25-
<script>
26-
switch (category) {
27-
case warning:
28-
category = warning
29-
case error:
30-
category = danger
31-
default:
32-
category = success
33-
}
34-
</script>
3525
<div class="alert alert-{{ category }}" role="alert">
3626
{{ message }}
3727
</div>

quotefault/templates/bootstrap/main.html

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,6 @@
66
{% with messages = get_flashed_messages(with_categories=true) %}
77
{% if messages %}
88
{% for category, message in messages %}
9-
<script>
10-
switch (category) {
11-
case warning:
12-
category = warning
13-
case error:
14-
category = danger
15-
case
16-
default:
17-
category = success
18-
}
19-
</script>
209
<div class="alert alert-{{ category }}" role="alert">
2110
{{ message }}
2211
</div>

quotefault/templates/bootstrap/storage.html

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,6 @@
3232
{% with messages = get_flashed_messages(with_categories=true) %}
3333
{% if messages %}
3434
{% for category, message in messages %}
35-
<script>
36-
switch (category) {
37-
case warning:
38-
category = warning
39-
case error:
40-
category = danger
41-
default:
42-
category = success
43-
}
44-
</script>
4535
<div class="alert alert-{{ category }}" role="alert">
4636
{{ message }}
4737
</div>

0 commit comments

Comments
 (0)