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

Upstream batch 2 #358

Merged
merged 15 commits into from
Oct 9, 2023
Merged

Upstream batch 2 #358

merged 15 commits into from
Oct 9, 2023

Conversation

sea-kelp
Copy link
Collaborator

@sea-kelp sea-kelp commented Sep 6, 2023

Description of Changes

Pulling in second batch of upstream commits

Notes for Deployment

FLASK_ENV Deprecation (f26c0):

  • Change ENVIRONMENT in .env file to ENV to match upstream

EmailClient Changes (a1833 and 4649f):

  • Add OO_SERVICE_EMAIL and OO_HELP_EMAIL to .env
  • I think we may also need to add MAIL_USE_TLS to .env

Full setup instructions on setting up email can be found in CONTRIB.md.

Please double-check that emails are still being sent once these changes are deployed!

Screenshots (if appropriate)

Tests and linting

  • I have rebased my changes on main

  • just lint passes

  • just test passes

@sea-kelp sea-kelp requested a review from a team as a code owner September 6, 2023 06:43
abandoned-prototype and others added 15 commits October 4, 2023 22:44
* Backport csv-import.

* Fix reference issue with upload script if officers aren't defined

* backport csv_import

* Add unit/job creation on upload for the advanced assignments importer

* Update docs

* Update required/optional fields for csv_import.

* Allow field named unit_name.

* Add assignment overwrite functionality.

* Add unit test for assignment overwriting command.

* Update documentation with added flag.

* Pin package versions.

Co-authored-by: Madison Swain-Bowden <[email protected]>
* Move utils to its own package

* Move constants to own file

* Update Makefile

* Update forms.py

* Update test_utils.py

* Use absolute imports

* Update 59e9993c169c_change_faces_to_thumbnails.py

* Update .gitignore
* Make sure adding mockdata is only run once.

* Fix tests.
lucyparsons#927

Add the ability to send emails from a Google Workspace account using a
GCP service account and update the feature's respective documentation.

- Need `service_account_key.json` file that is stored in LPL document
storage.

---------

Co-authored-by: abandoned-prototype <[email protected]>
 lucyparsons#954

Added inheritance to the `Config` objects, removed unnecessary functions
from the `Config` classes, and removed the custom constants and replaced
them with `HTTPMethod` constants.

 - [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.
lucyparsons#959

Move `models` to its own package to prevent circular dependencies and
address straggling relative imports.

 - [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.
## Fixes Issue
https://github.com/lucyparsons/OpenOversight/actions/runs/5510368096/jobs/10044531971

## Description of Changes
For the config to be properly accessed in the `email_client`, a `with
app.context:` line needed to be added or the config needed to be added
as a parameter to the `EmailClient`.

## Notes for Deployment
This should fix the issue.

## Screenshots (if appropriate)
- Validated fix by creating a new user on my local development
environment.
<img width="1139" alt="Screenshot 2023-07-10 at 11 26 55 AM"
src="https://github.com/lucyparsons/OpenOversight/assets/5885605/615add77-0f11-4c46-885d-58826000974c">

## 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.
I removed the use of the `FLASK_ENV` variable in the application and
replaced it with the `ENV` variable. This was done to remove the warning
that you'll see below and to simply the potential updating of Flask to a
version higher than `v2.3`.

```console
'FLASK_ENV' is deprecated and will not be used in Flask 2.3. Use 'FLASK_DEBUG' instead.
```

<details><summary>Console Log Output Before Change</summary>

```console
2023-07-11 15:42:33 openoversight-postgres-1  |
2023-07-11 15:42:33 openoversight-postgres-1  | PostgreSQL Database directory appears to contain a database; Skipping initialization
2023-07-11 15:42:33 openoversight-postgres-1  |
2023-07-11 15:42:33 openoversight-postgres-1  | 2023-07-11 20:42:33.064 UTC [1] LOG:  starting PostgreSQL 15.3 (Debian 15.3-1.pgdg120+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
2023-07-11 15:42:33 openoversight-postgres-1  | 2023-07-11 20:42:33.064 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2023-07-11 15:42:33 openoversight-postgres-1  | 2023-07-11 20:42:33.064 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2023-07-11 15:42:33 openoversight-postgres-1  | 2023-07-11 20:42:33.065 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-07-11 15:42:33 openoversight-postgres-1  | 2023-07-11 20:42:33.069 UTC [29] LOG:  database system was shut down at 2023-07-11 20:42:24 UTC
2023-07-11 15:42:33 openoversight-postgres-1  | 2023-07-11 20:42:33.073 UTC [1] LOG:  database system is ready to accept connections
2023-07-11 15:42:33 openoversight-web-1       | yarn run v1.22.19
2023-07-11 15:42:33 openoversight-web-1       | warning package.json: No license field
2023-07-11 15:42:33 openoversight-web-1       | $ sass OpenOversight/app/static/scss/index.scss OpenOversight/app/static/dist/index.css
2023-07-11 15:42:34 openoversight-web-1       | Done in 0.76s.
2023-07-11 15:42:34 openoversight-web-1       | yarn run v1.22.19
2023-07-11 15:42:34 openoversight-web-1       | warning package.json: No license field
2023-07-11 15:42:34 openoversight-web-1       | $ sass --watch OpenOversight/app/static/scss/index.scss OpenOversight/app/static/dist/index.css
2023-07-11 15:42:34 openoversight-web-1       | 'FLASK_ENV' is deprecated and will not be used in Flask 2.3. Use 'FLASK_DEBUG' instead.
2023-07-11 15:42:34 openoversight-web-1       | /usr/local/lib/python3.11/site-packages/flask_limiter/extension.py:293: UserWarning: Using the in-memory storage for tracking rate limits as no storage was explicitly specified. This is not recommended for production use. See: https://flask-limiter.readthedocs.io#configuring-a-storage-backend for documentation about configuring the storage backend.
2023-07-11 15:42:34 openoversight-web-1       |   warnings.warn(
2023-07-11 15:42:34 openoversight-web-1       | Sass is watching for changes. Press Ctrl-C to stop.
2023-07-11 15:42:34 openoversight-web-1       |
2023-07-11 15:42:34 openoversight-web-1       | [2023-07-11 20:42:34,720] INFO in __init__: OpenOversight startup
2023-07-11 15:42:34 openoversight-web-1       | 'FLASK_ENV' is deprecated and will not be used in Flask 2.3. Use 'FLASK_DEBUG' instead.
2023-07-11 15:42:34 openoversight-web-1       | 'FLASK_ENV' is deprecated and will not be used in Flask 2.3. Use 'FLASK_DEBUG' instead.
2023-07-11 15:42:34 openoversight-web-1       |  * Serving Flask app 'OpenOversight.app'
2023-07-11 15:42:34 openoversight-web-1       |  * Debug mode: on
2023-07-11 15:42:34 openoversight-web-1       | WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
2023-07-11 15:42:34 openoversight-web-1       |  * Running on all addresses (0.0.0.0)
2023-07-11 15:42:34 openoversight-web-1       |  * Running on http://127.0.0.1:3000
2023-07-11 15:42:34 openoversight-web-1       |  * Running on http://172.18.0.3:3000
2023-07-11 15:42:34 openoversight-web-1       | Press CTRL+C to quit
2023-07-11 15:42:34 openoversight-web-1       |  * Restarting with stat
2023-07-11 15:42:35 openoversight-web-1       | 'FLASK_ENV' is deprecated and will not be used in Flask 2.3. Use 'FLASK_DEBUG' instead.
```
</details>

<details><summary>Console Log Output After Change</summary>

```console
2023-07-11 15:37:52 openoversight-postgres-1  |
2023-07-11 15:37:52 openoversight-postgres-1  | PostgreSQL Database directory appears to contain a database; Skipping initialization
2023-07-11 15:37:52 openoversight-postgres-1  |
2023-07-11 15:37:52 openoversight-postgres-1  | 2023-07-11 20:37:52.079 UTC [1] LOG:  starting PostgreSQL 15.3 (Debian 15.3-1.pgdg120+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
2023-07-11 15:37:52 openoversight-postgres-1  | 2023-07-11 20:37:52.079 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2023-07-11 15:37:52 openoversight-postgres-1  | 2023-07-11 20:37:52.079 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2023-07-11 15:37:52 openoversight-postgres-1  | 2023-07-11 20:37:52.081 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-07-11 15:37:52 openoversight-postgres-1  | 2023-07-11 20:37:52.085 UTC [29] LOG:  database system was shut down at 2023-07-11 20:37:08 UTC
2023-07-11 15:37:52 openoversight-postgres-1  | 2023-07-11 20:37:52.090 UTC [1] LOG:  database system is ready to accept connections
2023-07-11 15:37:52 openoversight-web-1       | yarn run v1.22.19
2023-07-11 15:37:52 openoversight-web-1       | warning package.json: No license field
2023-07-11 15:37:52 openoversight-web-1       | $ sass OpenOversight/app/static/scss/index.scss OpenOversight/app/static/dist/index.css
2023-07-11 15:37:53 openoversight-web-1       | Done in 0.84s.
2023-07-11 15:37:53 openoversight-web-1       | yarn run v1.22.19
2023-07-11 15:37:53 openoversight-web-1       | warning package.json: No license field
2023-07-11 15:37:53 openoversight-web-1       | $ sass --watch OpenOversight/app/static/scss/index.scss OpenOversight/app/static/dist/index.css
2023-07-11 15:37:53 openoversight-web-1       | /usr/local/lib/python3.11/site-packages/flask_limiter/extension.py:293: UserWarning: Using the in-memory storage for tracking rate limits as no storage was explicitly specified. This is not recommended for production use. See: https://flask-limiter.readthedocs.io#configuring-a-storage-backend for documentation about configuring the storage backend.
2023-07-11 15:37:53 openoversight-web-1       |   warnings.warn(
2023-07-11 15:37:53 openoversight-web-1       | [2023-07-11 20:37:53,820] INFO in __init__: OpenOversight startup
2023-07-11 15:37:53 openoversight-web-1       |  * Serving Flask app 'OpenOversight.app'
2023-07-11 15:37:53 openoversight-web-1       |  * Debug mode: off
2023-07-11 15:37:53 openoversight-web-1       | WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
2023-07-11 15:37:53 openoversight-web-1       |  * Running on all addresses (0.0.0.0)
2023-07-11 15:37:53 openoversight-web-1       |  * Running on http://127.0.0.1:3000
2023-07-11 15:37:53 openoversight-web-1       |  * Running on http://172.18.0.3:3000
2023-07-11 15:37:53 openoversight-web-1       | Press CTRL+C to quit
2023-07-11 15:37:53 openoversight-web-1       | Sass is watching for changes. Press Ctrl-C to stop.
```
</details>

 - [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.

---------

Co-authored-by: Madison Swain-Bowden <[email protected]>
lucyparsons#798

Add the ability for the user to filter officers by the availability of a
photo, format the `list_officer.html` file using
[`djlint`](https://www.djlint.com/), correct carrot behavior on officer
search, center displayed officer photos, and update relevant test case.

Images on the search page are now centered (laptop screen):
<img width="1469" alt="Screenshot 2023-07-11 at 12 18 34 PM"
src="https://github.com/lucyparsons/OpenOversight/assets/5885605/2ee9a10d-9f3c-40ad-be19-9f43442cc9f5">

Images on the search page are now centered (phone screen):
<img width="621" alt="Screenshot 2023-07-11 at 12 18 45 PM"
src="https://github.com/lucyparsons/OpenOversight/assets/5885605/3b318ee1-78c0-45ad-af92-f807188adb2d">

The carrots 🥕 now respond correctly when their respective menus are
opened:
URL:
`http://localhost:3000/department/1?last_name=&first_name=&badge=&min_age=16&max_age=85&unique_internal_identifier=&require_photo=True&submit=Submit`
<img width="1470" alt="Screenshot 2023-07-11 at 2 21 50 PM"
src="https://github.com/lucyparsons/OpenOversight/assets/5885605/d73b2c68-93ae-46b4-ad94-14666608fe56">

 - [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.
lucyparsons#239

Added [`djLint`](https://www.djlint.com/docs/languages/jinja/) to the
`pre-commit` process and formatted files accordingly.

 - [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.

`pre-commit` output:
```console
(openoversight) xxxxxx@MacBook-Air-5 OpenOversight % make lint
pre-commit run --all-files
trim trailing whitespace.................................................Passed
check docstring is first.................................................Passed
check that executables have shebangs.....................................Passed
check json...............................................................Passed
check for case conflicts.................................................Passed
check toml...........................................(no files to check)Skipped
check for merge conflicts................................................Passed
check xml................................................................Passed
check yaml...............................................................Passed
fix end of files.........................................................Passed
check for broken symlinks............................(no files to check)Skipped
mixed line ending........................................................Passed
fix python encoding pragma...............................................Passed
pretty format json.......................................................Passed
fix requirements.txt.....................................................Passed
check blanket noqa.......................................................Passed
check for not-real mock methods..........................................Passed
check for eval().........................................................Passed
use logger.warning(......................................................Passed
Run isort to sort imports................................................Passed
Run pydocstyle...........................................................Passed
Do not use shebangs in non-executable files..............................Passed
flake8...................................................................Passed
black....................................................................Passed
djLint formatting........................................................Passed
(openoversight) xxxxxx@MacBook-Air-5 OpenOversight %
```
lucyparsons#239

I added `djlint` linting to the `pre-commit` script and made the
corresponding changes.

 - [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.
## Fixes issue
lucyparsons#931

## Description of Changes
I centered and addressed sizing issues with the officer profile pictures
in the profile page, officer list page, and officer image page.

## Screenshots (if appropriate)
Located in the comments.

## 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.
lucyparsons#947

Added an email action that lets the user know that their password has
changed and added validation that emails were being sent in the tests.

- The `OO_ADMIN_EMAIL` environment variable needs to be added to the
production `.env` file.

<img width="1074" alt="Screenshot 2023-07-13 at 1 44 06 PM"
src="https://github.com/lucyparsons/OpenOversight/assets/5885605/1d0195db-b8fb-4e96-8f20-945a8b0633e7">

 - [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.
Copy link
Collaborator

@AetherUnbound AetherUnbound left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM!

@AetherUnbound AetherUnbound merged commit 35788fe into main Oct 9, 2023
2 checks passed
@AetherUnbound AetherUnbound deleted the upstream-batch-2 branch October 9, 2023 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants