Commit 95c107f
Merge upstream commits (#534)
* Add invalid ID tests for `main.views` (lucyparsons#1124)
There were a handful of routes where we did not validate the initial ID
parameters. Additionally, I standardized how object querying was done
within the `main.views` file.
- [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.
* Remove unnecessary `mockdata` parameters (lucyparsons#1126)
lucyparsons#1125
Removed the `mockdata` parameter from test functions that don't require
it.
- [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.
* Finish audit fields for `users` table (lucyparsons#1129)
lucyparsons#1004
Added `disabled_by`, `disabled_at`, `approved_at`, `approved_by`, and
`confirmed_at`, and `confirmed_by` fields to the `users` table so that
we could keep track of users actions on the platform at a more granular
level. I also removed the previously mentioned columns corresponding
boolean columns.
- [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.
- [x] The `flask db upgrade` and `flask db downgrade` functions work for
both migrations.
```console
I have no name!@c38d30934aa7:/usr/src/app$ %
(env) michaelp@MacBook-Air-18 OpenOversight % docker exec -it openoversight-web-1 bash
I have no name!@5027495d31c0:/usr/src/app$ flask db downgrade
...
INFO [alembic.runtime.migration] Running downgrade 99c50fc8d294 -> bf254c0961ca, complete audit field addition to users
I have no name!@5027495d31c0:/usr/src/app$ flask db downgrade
...
INFO [alembic.runtime.migration] Running downgrade bf254c0961ca -> 5865f488470c, add remaining audit fields for users table
I have no name!@5027495d31c0:/usr/src/app$ flask db downgrade
...
INFO [alembic.runtime.migration] Running downgrade 5865f488470c -> 939ea0f2b26d, change salary column types
I have no name!@5027495d31c0:/usr/src/app$ flask db upgrade
...
INFO [alembic.runtime.migration] Running upgrade 939ea0f2b26d -> 5865f488470c, change salary column types
INFO [alembic.runtime.migration] Running upgrade 5865f488470c -> bf254c0961ca, add remaining audit fields for users table
INFO [alembic.runtime.migration] Running upgrade bf254c0961ca -> 99c50fc8d294, complete audit field addition to users
I have no name!@5027495d31c0:/usr/src/app$
```
* Fix the `/find` department sort (lucyparsons#1133)
## Fixes issue
Addresses TO-DO in code.
## Description of Changes
The `/find` route was using an unsorted list of departments unlike the
rest of the application.
Before:
<img width="1334" alt="Screenshot 2024-11-06 at 10 13 13 PM"
src="https://github.com/user-attachments/assets/8c6b832a-109e-465a-a6ec-c102524eb43b">
After:
<img width="1324" alt="Screenshot 2024-11-06 at 10 13 36 PM"
src="https://github.com/user-attachments/assets/1f639518-a750-498e-8a26-6f5784ad052b">
## 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.
* Standardize model `__repr__` functions (lucyparsons#1140)
## Description of Changes
Addressed inconsistencies with the model `__repr__` functions.
Mostly making this because this PR got a bit out of control:
lucyparsons#1138
## 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.
* Restructure application routing (lucyparsons#1141)
Sets the groundwork for this issue:
lucyparsons#385
Simplifying the import logic for the `auth` and `main` routes of the
application. This also sets up the work for this PR:
lucyparsons#1138
- [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.
* Add generic `__repr__` and `to_dict` functions (lucyparsons#1143)
Adds a generic `__repr__` function and and a generic `to_dict` function
so that objects can be serialized in the future. The reason I didn't use
the SQLAlchemy class like we talked about in the previous PR was because
that would require a complete rework of most object instantiations and
how properties are ordered. For a greater view into that, you can look
at this PR: lucyparsons#1142
- [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.
* Add static `Department` functions (lucyparsons#1150)
Moved `Department`-related methods to the `Department` object.
- [x] This branch is up-to-date with the `develop` branch.
- [x] Ran `make create_db_diagram` command.
- [x] `pytest` passes on my local development environment.
- [x] `pre-commit` passes on my local development environment.
* Remove audit fields from `Description` download (lucyparsons#1151)
## Description of Changes
Removed audit fields from the `Description` download function. They leak
user information and provide data that isn't particularly useful outside
of internal auditing.
## Tests and Linting
- [x] This branch is up-to-date with the `develop` branch.
- [x] Ran `make create_db_diagram` command.
- [x] `pytest` passes on my local development environment.
- [x] `pre-commit` passes on my local development environment.
* UX Re-design (lucyparsons#1155)
* Fix submit image page and python sqlite bug (lucyparsons#1157)
## Description of Changes
_Changes carried over from
https://github.com/OrcaCollective/OpenOversight/pull/533_
Fix bug where submit image page department selector was not submitting
images to the correct department.
It looks like the current implementation was using `selectedIndex` (the
index of the selected `<option>` element in the `<select>`) to determine
the initial department id, which assumes the departments are loaded in
order:
https://github.com/OrcaCollective/OpenOversight/blob/2c5ad9a74687943eac5e71a874c0f4ceb4784fa0/OpenOversight/app/templates/submit_image.html#L79-L82
## Notes for Deployment
None!
## Screenshots (if appropriate)
N/A
## Testing instructions
1. Log in as admin user.
2. Create a new department "Peoria Police Department (PPD)" at
http://localhost:3000/departments/new.
3. Update the user's preferred department to PPD at
http://localhost:3000/auth/change-dept/.
4. Visit the Submit Image page (http://localhost:3000/submit) and
confirm that the populated department is BPD.
5. Upload an image.
6. Verify in devtools that an image was submitted to
http://localhost:3000/upload/departments/4.
7. Update the department selector to Springfield Police Department.
8. Upload an image.
9. Verify in devtools that an image was submitted to
http://localhost:3000/upload/departments/1.
10. Change the preferred department to Springfield Police Department at
http://localhost:3000/auth/change-dept/.
11. Visit the Submit Image page (http://localhost:3000/submit) and
confirm that the populated department is now SPD.
12. Upload an image.
13. Verify in devtools that an image was submitted to
http://localhost:3000/upload/departments/1.
## Checks
- [x] I have rebased my changes on `main`
- [x] `just lint` passes
- [x] `just test` passes
* Default to "N/A" if dept state is invalid (lucyparsons#1159)
## Description of Changes
Default to "N/A" if department state is invalid
In [the
migration](https://github.com/lucyparsons/OpenOversight/blob/develop/OpenOversight/migrations/versions/2023-07-26-1551_18f43ac4622f_add_state_column_to_departments.py)
where we introduced the department state column, we defaulted to empty
string for existing departments. We think this may have broken the
browse page when trying to load the browse page.
## Notes for Deployment
None!
## Screenshots (if appropriate)
N/A
## Tests and Linting
Reproduced the internal server error by setting the department state to
empty string
```
openoversight-dev=# update departments set state='' where id = 1;
```
Checked that the error was no longer displayed once this change was
implemented
- [x] This branch is up-to-date with the `develop` branch.
- [ ] Ran `make create_db_diagram` command.
- [x] `pytest` passes on my local development environment.
- [x] `pre-commit` passes on my local development environment.
* Fix department selector on submit image page
* Re-add dropzone
* Update contact email
---------
Co-authored-by: Michael Plunkett <[email protected]>1 parent 2c5ad9a commit 95c107f
File tree
125 files changed
+3609
-6946
lines changed- OpenOversight
- app
- auth
- main
- models
- static
- css
- images
- js
- webfonts
- Inter
- Titillium_Web
- templates
- auth
- partials
- utils
- migrations/versions
- tests
- routes
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
125 files changed
+3609
-6946
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | 9 | | |
12 | 10 | | |
13 | | - | |
14 | 11 | | |
15 | 12 | | |
| 13 | + | |
16 | 14 | | |
17 | 15 | | |
| 16 | + | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | 32 | | |
38 | 33 | | |
39 | 34 | | |
| |||
52 | 47 | | |
53 | 48 | | |
54 | 49 | | |
55 | | - | |
56 | | - | |
| 50 | + | |
| 51 | + | |
57 | 52 | | |
58 | 53 | | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
| 54 | + | |
64 | 55 | | |
65 | 56 | | |
66 | 57 | | |
| |||
77 | 68 | | |
78 | 69 | | |
79 | 70 | | |
80 | | - | |
| 71 | + | |
81 | 72 | | |
82 | 73 | | |
83 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
14 | | - | |
15 | | - | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| 43 | + | |
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
| |||
57 | 60 | | |
58 | 61 | | |
59 | 62 | | |
60 | | - | |
| 63 | + | |
| 64 | + | |
61 | 65 | | |
62 | 66 | | |
63 | 67 | | |
| |||
67 | 71 | | |
68 | 72 | | |
69 | 73 | | |
70 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
71 | 77 | | |
72 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
73 | 83 | | |
74 | 84 | | |
75 | 85 | | |
| |||
112 | 122 | | |
113 | 123 | | |
114 | 124 | | |
115 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
116 | 131 | | |
117 | 132 | | |
118 | 133 | | |
119 | | - | |
| 134 | + | |
120 | 135 | | |
121 | 136 | | |
122 | 137 | | |
| |||
141 | 156 | | |
142 | 157 | | |
143 | 158 | | |
144 | | - | |
| 159 | + | |
145 | 160 | | |
146 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
147 | 164 | | |
148 | 165 | | |
149 | 166 | | |
| |||
313 | 330 | | |
314 | 331 | | |
315 | 332 | | |
316 | | - | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
317 | 345 | | |
318 | 346 | | |
319 | 347 | | |
320 | 348 | | |
321 | 349 | | |
322 | 350 | | |
323 | 351 | | |
324 | | - | |
| 352 | + | |
325 | 353 | | |
326 | | - | |
327 | | - | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
328 | 358 | | |
329 | 359 | | |
330 | 360 | | |
| |||
353 | 383 | | |
354 | 384 | | |
355 | 385 | | |
356 | | - | |
| 386 | + | |
357 | 387 | | |
358 | 388 | | |
359 | 389 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
97 | 96 | | |
98 | 97 | | |
99 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
100 | 103 | | |
101 | 104 | | |
102 | 105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
90 | 101 | | |
91 | 102 | | |
92 | 103 | | |
| |||
99 | 110 | | |
100 | 111 | | |
101 | 112 | | |
| 113 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
| |||
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
43 | | - | |
| 42 | + | |
44 | 43 | | |
45 | 44 | | |
46 | 45 | | |
| |||
161 | 160 | | |
162 | 161 | | |
163 | 162 | | |
164 | | - | |
165 | 163 | | |
166 | | - | |
167 | | - | |
168 | 164 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
106 | | - | |
| 105 | + | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 125 | + | |
| 126 | + | |
131 | 127 | | |
132 | 128 | | |
133 | 129 | | |
| |||
287 | 283 | | |
288 | 284 | | |
289 | 285 | | |
290 | | - | |
| 286 | + | |
291 | 287 | | |
292 | 288 | | |
293 | 289 | | |
| |||
409 | 405 | | |
410 | 406 | | |
411 | 407 | | |
412 | | - | |
| 408 | + | |
413 | 409 | | |
414 | 410 | | |
415 | 411 | | |
| |||
424 | 420 | | |
425 | 421 | | |
426 | 422 | | |
427 | | - | |
| 423 | + | |
428 | 424 | | |
429 | 425 | | |
430 | 426 | | |
| |||
434 | 430 | | |
435 | 431 | | |
436 | 432 | | |
437 | | - | |
| 433 | + | |
438 | 434 | | |
439 | 435 | | |
440 | 436 | | |
| |||
535 | 531 | | |
536 | 532 | | |
537 | 533 | | |
538 | | - | |
| 534 | + | |
539 | 535 | | |
540 | 536 | | |
541 | 537 | | |
| |||
0 commit comments