Граф коммитов

44 Коммитов

Автор SHA1 Сообщение Дата
Daniel Smith e2ce1d405e
Use FeatureEntry for most client-side use cases (#2433)
* Use FeatureEntry entity for most client-side uses

* leave notify and amendments to Feature for now

* handle redis keys
2022-11-06 12:57:40 -08:00
Jason Robbins bb973677f2
Do double-writes of star_count. (#2428) 2022-11-02 10:04:48 -07:00
Daniel Smith 49fb21595d
Run mypy in Github continuous integration checks (#2324)
* run mypy in CI

* more type hint fixing

* Update requirements.txt

* google.cloud import workaround

https://github.com/python/mypy/issues/10360

* Revert "google.cloud import workaround"

This reverts commit e03dbc7bbeb67acc81f57b9c5d905b9141952dbc.

* mypy google.cloud workaround

https://github.com/python/mypy/issues/12985

* fix regular tests

* remove --install-types flag

* last mypy fix

* type fixes for address_reasons

* move email lists creation

* update for newly merged changes

* Fix regular tests

* Changes suggested by @jrobbins

* Catch invalid requests

* small type hint

* Change methods to properly override

* revert to previous implementation

* revert test

* add back original validate request type method

* remove unused import and rearrange methods

* remove comment string casting; add test back

* add ndb ignore

* Update test_html_rendering.html

* mypy fix

* remove merge addition
2022-10-24 06:40:21 -07:00
James C Scott III ad9ee9ae31
Remove all references to django (#2358)
* Remove all references to django

Replace any functionality with flask

* more cleanup

* fix template test after removing empty comment

* remove unused test_app
2022-10-19 13:51:39 -04:00
Daniel Smith 9ed293d7a2
Change existing handler classes to properly override request methods (#2342)
* Change methods to properly override

* Update comments_api.py

* Update comments_api.py
2022-10-16 08:39:35 +02:00
James C Scott III 9e35ea1353
Replace django templates for email with jinja2 templates (#2276)
* Replace django templates for email with jinja2 templates

This commit converts the email templates from django templates to jinja2
templates.

It also creates a new helper function: flask_compat_get_template_path

This function uses the existing configuration for django templates and
uses it to return a string used to locate the templates for jinja2.

Fixes #2030

* Add rendered test templates for email notifications

* ignore testdata folder for gcloud
2022-09-28 12:44:32 -04:00
Daniel Smith 01eca367ee
Add basic logging for some cron tasks (#2272)
* add basic logging for some cron tasks

* better variable naming
2022-09-26 16:54:59 -07:00
Jason Robbins 84cbd9016a
Refactored reminders and added prepublication notice. (#2262)
* Refactored reminders and added prepublication notice.

* Added links to references

* Improved tests

* Update internals/reminders.py

Co-authored-by: Daniel Smith <56164590+DanielRyanSmith@users.noreply.github.com>

* Updated comment

Co-authored-by: Daniel Smith <56164590+DanielRyanSmith@users.noreply.github.com>
2022-09-23 10:23:55 -07:00
James C Scott III 229cae9d31
Add cc field to features (#2252)
* Add cc field to features

Closes #2240. Similar implementation as editors.

Users who are cc'd on features can see unlisted features.

internals/core_models.py:
- Add new cc_recipients field. Defaults to empty list if field is not there.

internals/notifier.py
- Adds reason for being notified as a person in the cc_recipients field

internals/search.py
- Add the shorthand query for `cc:me`

internals/search_queries.py
- Add the ability to search the cc_recipients field by adding it to QUERIABLE_FIELDS

static/elements/chromedash-guide-metadata.js
- Add the ability to view the value on the metadata display
  - Maps cc_recipients to individual mailto links ccRecipient
    - Note: ccRecipient is camelCase

static/elements/form-field-specs.js
- Declare a new form field cc_recipients

static/elements/form-definition.js
- Add the cc_recipients field to the metadata form field

* cc_recipients changes to persist on create/update

These changes allow changes to cc_recipients to persist on feature
create or update

* Check if cc_recipients empty

cc_recipients can be missing from the object due to del_none
in core_models.py
Also fomat_for_template currently returns cc_recipients at a different level
and not inside the chrome object. As a result, need to change
the chromedash-guide-metadata file to look for the data at the right place.

* Use short hand CC instead of carbon copy
2022-09-21 13:15:22 -04:00
Kyle Ju aebc0d3211
Add JSONIFY = True to NotifyInactiveUsersHandler get requests (#2261)
Co-authored-by: Kyle Ju <kyleju@chromium.org>
2022-09-20 16:21:47 -07:00
Jason Robbins a61d5aa952
Fix passing feature ID to the accuracy email. (#2260)
* Fix passing feature ID to the accuracy email.

* add unit test
2022-09-20 15:27:44 -07:00
Daniel Smith a49ef32b30
Handle inactive users (#2243)
* handle inactive users

Notify inactive users at 6 months and remove inactive users at 9 months

* Changes suggested by @jrobbins

* update comment
2022-09-15 13:43:22 -07:00
Jason Robbins 0fc62d05ff
Clarify where we load features directly from the DB, not cache. (#2239) 2022-09-13 16:30:34 -07:00
Kyle Ju e5f9a7b642
Create Redis staging setup (#2211)
* Redis staging setup

* Add an if for staging

* Implement Redis caching APIs (#2212)

* Redis APIs

* Nit

* Partially migrate Ramcache usage to Redis (#2214)

* Migrate all fields except feature-related cache

* Fix

* Address comments

Co-authored-by: Kyle Ju <kyleju@chromium.org>

Co-authored-by: Kyle Ju <kyleju@chromium.org>

Co-authored-by: Kyle Ju <kyleju@chromium.org>
2022-09-12 13:56:50 -07:00
Jason Robbins 772225dbb3
Guard cron handlers. (#2229) 2022-09-12 10:52:53 -07:00
Jason Robbins 7d5cb886cb
Fix milestone table in accurate-as-of email. (#2228) 2022-09-12 10:52:18 -07:00
Jason Robbins b6ffd03b86
Remove custom subclass for stars. (#2164) 2022-08-24 11:15:41 -07:00
Jason Robbins 697cf9b38d
Refactor remaining models.py code into core_models.py (#2160)
* Refactor remaining models.py to core_models.py.

* Move tests to the right _test file.
2022-08-23 16:00:02 -07:00
Jason Robbins 689483c0f3
Refactor user-related models into a separate file. (#2141) 2022-08-17 18:14:19 -07:00
Jason Robbins 0972d89600
Refactor models.py enums into core_enums.py. (#2106) 2022-08-12 15:49:32 -07:00
Jason Robbins 411f9fe51c
Several small tweaks to accuracy verification (#2103) 2022-08-11 17:37:32 -07:00
Daniel Smith 6cdddfa2e9
Add form for feature owners to verify feature data accuracy (#2090)
* Add accuracy verification page

* remove cron check and fix tests

* More tests added

* change text to match design doc

* fix tests and naming

* refactoring for clarity
2022-08-09 12:56:09 -04:00
Daniel Smith 8625cf3c61
Send reminders to verify accuracy of data before important milestones (#2078)
* accuracy notifications cron job

* send emails in staging environment

* Update templates/accuracy_notice_email.html

Co-authored-by: Joe Medley <jmedley@google.com>

* changes suggested by @jrobbins

* remove unnecessary type conversion

* typo fix

Co-authored-by: Joe Medley <jmedley@google.com>
2022-08-08 11:33:18 -04:00
Daniel Smith 36d7f09968
Feature owners and editors receive notification of changes. (#2068)
* feature owners and editors receive notifications

* comment typo fix
2022-07-28 15:22:26 -05:00
Jason Robbins 09a9a09992
Add Reply-To header to email notifications. (#2031)
* Add Reply-To header to email notifications.

* Update internals/notifier_test.py

Co-authored-by: Daniel Smith <56164590+DanielRyanSmith@users.noreply.github.com>

Co-authored-by: Daniel Smith <56164590+DanielRyanSmith@users.noreply.github.com>
2022-07-15 16:24:21 -07:00
Jason Robbins 4530eeafa0
In notifications, display full email addr rather than nickname. (#2028)
* In notifications, display full email addr rather than nickname.

* Rename vars, and improve tests.
2022-07-15 10:26:01 -07:00
Jason Robbins dc981e39fe
Store intent thread subject lines and use them. (#1878)
* Store intent thread subject lines and use them.

* Avoid double Re: prefix.
2022-05-10 17:45:20 -07:00
Jason Robbins e13a4cbea0
Addressed some code scanning warnings. (#1699)
* Addressed some code scanning warnings.

* Use urlparse as recommended by code scanner
2022-01-25 11:11:39 -08:00
Jason Robbins d56526b7f4
Fix URL quoting of message-id to allow email threading. (#1664) 2022-01-07 16:13:27 -08:00
Jason Robbins fa4755dc34
Small fixes to intent email handling. (#1623)
* Small fixes to intent email handling.

* Make py2 test more realistic.
2021-11-30 10:43:40 -08:00
Jason Robbins 7ab852cb80
Implement posting review comments to blink-dev mailing list. (#1611)
* Implement posting review comments to blink-dev mailing list.

* Update internals/notifier.py

Co-authored-by: Kyle Ju <kyleju@google.com>

Co-authored-by: Kyle Ju <kyleju@google.com>
2021-11-22 14:41:00 -08:00
Jason Robbins a17119f915
Send smaller log lines (#1575)
* progress

* progress
2021-10-07 12:48:50 -07:00
Jason Robbins e77396a8cc
Make app deployable with py3. (#1559)
* Make app deployable with py3.

* Handle empty API posts
2021-09-24 15:19:17 -07:00
Jason Robbins 548828aaa0
Some easy pylint fixes. (#1557) 2021-09-23 12:04:33 -07:00
Kyle Ju b6bb10195a
Run 2to3 to detect py2 to py3 changes (#1551)
* Run 2to3 -w -n .

* Update internals/fetchmetrics.py

* Update internals/models.py

* Update internals/notifier.py

* Update pages/blink_handler.py

* Update internals/fetchmetrics.py
2021-09-22 18:23:14 -07:00
Jason Robbins 1981777c20
Implement myfeatures page boxes for starred-by:me and owner:me (#1533)
* wrote code

* Added unit tests and removed unwanted CSS.

* Use warning() because warn() is deprecated.

* Update internals/models.py

Co-authored-by: Kyle Ju <kyleju@google.com>

* Incorporated review comments.

Co-authored-by: Kyle Ju <kyleju@google.com>
2021-09-17 17:20:25 -07:00
Jason Robbins ecd96ba8dd
Split app into py2 and py3 services. (#1460)
* Split app into py2 and py3 services.

* fix typo

* Also deploy app-py3 and upgrade skipfiles to .gcloudignore.

* fix typo

* addressed review comments
2021-08-17 15:35:08 -07:00
Shivam Agarwal fd6018bd3d
20210618 gae ndb to cloud ndb (#1365)
* Added Cloud NDB to requirements

* google-cloud-core 1.7.0 requires google-auth<2.0dev,>=1.24.0, but you'll have google-auth 1.20.1 which is incompatible.

* Running DataStore Emulator on port 15606 and setting environment variable for the same

* Replaced GAE NDB imports with Cloud NDB imports

* Solved Error: No Context for Ramcache

* Solved No NDB Context Error for Cloud NDB

* Fixed Error No object QueryOptions

* Removed clear_datstore flag

* Fixed to_dict() method

* Added explicit call to method for stashing values while editing a feature

* Using Cloud NDB in testbed

* Updated README with JRE instructions and setting the DJANGO_SETTTINGS_MODULE environment variable for django.setup

* Added Env Variable for datastore emulator

* Migrated accounts_api_test.py

* Migrated approvals_api_test.py

* Migrated Comments.py and Cues_api_test.py

* Migrated Features.py

* Migrated metricsdata_test.py

* Migrated stars_api_test.py

* Fixed Deprecation warning for query options

* Migrated token_refresh_api_test.py

* Migrated basehandlers_test.py

* Migrated permissions_test.py

* Migrated ramcache_test.py

* Migrated secrets_test.py

* Migrated xsrf_test.py

* Migrated fetchmetrics_test.py

* Migrated models_test.py

* Migrated notifier_test.py

* Migrated processes_test.py

* Migrated featuredetail_test.py

* Migrated featurelist_test.py

* Migrated guide_test.py

* Migrated intentpreview_test.py

* Migrated samples_test.py

* Removed some unused stubs

* Set the consistency of datastore emulator to be 1

* Resetting the database emulator before running the tests

* Added npm targets for starting and stopping emulator

* Updated README and Developer Docs

* Removed unused imports

* Made NDB calls DRY
2021-06-28 19:05:04 -07:00
Shivam Agarwal 299516574f
GAE DB Client to GAE NDB (#1352)
* Migrated models.py

* Migrated bulkloader_helpers.py

* Migrated accounts_api.py

* Migrated models.py

* Migrated ramcache.py

* Migrated secrets.py

* Migrated basehandlers.py

* Migrated metricsdata.py

* Migrated fetchmetrics.py

* Migrated notifiers

* blink_handler

* guide.py

* users.py

* fix_data.py

* appengine.py

* Migrated all order() function calls

* Fixed filterby[]

* Migrated all filter() queries

* Migrated some left out lines

* Fixed Bug: json_dump would result in TypeError

* Fixed bug - key() is not callable

* Bug Fix: Query Filters were not working

* Fixed Bug: JSON output of feature list would not contain feature id

* Removed unused ndb import

* Fixed Bug: old_val would have properties wrappped in _BaseValue

* Migrated Tests

* Fixed Test: capstone has no attribute delete()

* Fixed Bug: A filter won't work

* Fixed Bug: Index out of range if self.Blink_components length is 0

* Fixed Bug: Some order statements won't work

* Assigning default value to Feature_blink_components

* Fixed Bug: A filter won't work

* Fetching singleton using ancestor for strong consistency

* Moved the ancestor query for strong consistency to replace the correct original query

* Replaced _pre_put_hook with _from_pb

* Fix: NDB picked up old properties while looping over self.properties

* Fix: NDB would generate diffs if None is compared with empty strings
2021-06-17 13:47:02 -07:00
Shivam Agarwal 8fbebb7989
20210418 google sign in (#1275)
* Added Google Platform Library

* Added Meta Element for Client ID

* Added Google Sign-In Button

* Authenticating the id_token on our backend

* Saving id_token in flask session, using the id_token to fetch the current user and replaced the usages of AppEngine Users API (not from *_tests.py)

* Correct the flow on pressing SignIn and SignOut

* Code refactor

* Added Comment for is_current_user_admin

* Supporting GAE Users library for post request

* Made some fixes

* Changed Admin User condition

* Reloading only on 200 response code

* Do not require sign in and xsrf token while sending post request for login

* Sign Out using Google Sign In if cookie is not set after login

* Clearing the session if the id_token stored in the session variable becomes invalid or expires

* Replaced GAE Users from tests

* Replaced GAE users with framework users in tests.py
2021-05-06 16:37:30 -07:00
Jason Robbins dabcfb780f
Implement XSRF tokens for HTML forms (not enforced yet). (#1266)
* Implement XSRF tokens (but not enforced yet).

* Also add tokens to user list page.
2021-04-15 09:48:06 -07:00
Jason Robbins 9b18859808
Refactor code for accessing JSON parameters. (#1260) 2021-04-12 15:46:21 -07:00
Jason Robbins 55c9cd2925
Refactor models.py into internals/. (#1236)
* Refactor models.py into internals/.

* Trivial change to re-trigger travis.

* Updated an import
2021-03-24 13:13:02 -07:00
Jason Robbins 891e84d7a3
Refactor internal stuff into new internals/ directory. (#1235) 2021-03-23 13:09:00 -07:00