Skip to content

Commit

Permalink
Merge branch 'master' into mjr/sms-usage-tile
Browse files Browse the repository at this point in the history
  • Loading branch information
mjriley committed Dec 4, 2024
2 parents 1adcaf3 + 8bbee13 commit 6400bd1
Show file tree
Hide file tree
Showing 211 changed files with 1,442 additions and 1,894 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,16 @@ jobs:
JS_SETUP: yes
KAFKA_HOSTNAME: kafka
STRIPE_PRIVATE_KEY: ${{ secrets.STRIPE_PRIVATE_KEY }}
run: scripts/docker test --exitfirst -vv --reusedb=1 --divided-we-run=${{ matrix.DIVIDED_WE_RUN }} --showlocals --max-test-time=29 -p no:cacheprovider
run: >-
scripts/docker test
--exitfirst
--verbosity=2
--reusedb=1
--no-migrations
--divided-we-run=${{ matrix.DIVIDED_WE_RUN }}
--showlocals
--max-test-time=29
-p no:cacheprovider
- name: "Codecov upload"
env:
TOKEN: ${{ secrets.CODECOV_TOKEN }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ hqDefine('accounting/js/renew_plan_selection', [
'knockout',
'hqwebapp/js/initial_page_data',
'hqwebapp/js/toggles',
'commcarehq',
], function (
$,
ko,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% load i18n %}
{% load crispy_forms_tags %}

{% requirejs_main "hqwebapp/js/bootstrap3/crud_paginated_list_init" %}
{% js_entry_b3 "hqwebapp/js/bootstrap3/crud_paginated_list_init" %}

{% block pagination_header %}
<h2>{% trans 'Manage Accounting Admins' %}</h2>
Expand Down
7 changes: 1 addition & 6 deletions corehq/apps/app_manager/fixtures/mobile_ucr.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,7 @@ def _get_apps(self, restore_state, restore_user):

if app_aware_sync_app:
apps = [app_aware_sync_app]
elif (
toggles.RESTORE_ACCESSIBLE_REPORTS_ONLY.enabled(restore_user.domain)
and restore_state.params.is_webapps
# only way to reliably know that this is a web apps restore, not live preview
and not restore_user.request_user.can_view_apps(restore_user.domain)
):
elif toggles.RESTORE_ACCESSIBLE_REPORTS_ONLY.enabled(restore_user.domain):
apps = []
for app in get_web_apps_available_to_user(restore_user.domain, restore_user._couch_user):
if not is_remote_app(app):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
{% initial_page_data 'intro_only' intro_only %}
{% initial_page_data 'langs' app.langs %}
{% initial_page_data 'latest_build_id' latest_build_id %}
{% initial_page_data 'sms_contacts' sms_contacts %}
{% initial_page_data 'confirm' confirm %}
{% initial_page_data 'upstream_url' upstream_url_template %}
{% initial_page_data 'show_release_mode' show_release_mode %}
Expand Down
2 changes: 0 additions & 2 deletions corehq/apps/app_manager/templates/app_manager/apps_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@
{% endcompress %}

{% include 'hqwebapp/includes/atwho.html' %}
<script src="{% static 'bootstrap3-typeahead/bootstrap3-typeahead.min.js' %}"></script>
<script src="{% static 'hqwebapp/js/bootstrap-multi-typeahead.js' %}"></script>

{% include 'hqwebapp/includes/ui_element_js.html' %}
{% compress js %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@
</span>
</label>
</div>
<form method="post" action="{% url "send_to_recipients" domain %}">{% csrf_token %}
<form method="post" action="{% url "send_to_recipients" domain %}">
{% csrf_token %}
<div class="form-group">
<label>{% trans "Send to" %}</label>
<input type="text" name="recipients" value="" class="form-control"
data-bind="multiTypeahead: $root.recipients" />
<select name="recipients" id="sms-recipients" class="form-control" multiple data-bind="staticSelect2: {}">
{% for contact in sms_contacts %}
<option>{{ contact }}</option>
{% endfor %}
</select>
</div>
<div class="form-group">
<textarea class="bitly form-control vertical-resize" name="message"
Expand Down
5 changes: 1 addition & 4 deletions corehq/apps/app_manager/views/releases.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,7 @@ def get_releases_context(request, domain, app_id):
'can_view_cloudcare': has_privilege(request, privileges.CLOUDCARE),
'has_mobile_workers': get_doc_count_in_domain_by_class(domain, CommCareUser) > 0,
'latest_released_version': get_latest_released_app_version(domain, app_id),
'sms_contacts': (
get_sms_autocomplete_context(request, domain)['sms_contacts']
if can_send_sms else []
),
'sms_contacts': get_sms_autocomplete_context(domain) if can_send_sms else [],
'build_profile_access': build_profile_access,
'application_profile_url': reverse(LanguageProfilesView.urlname, args=[domain, app_id]),
'latest_build_id': get_latest_build_id(domain, app_id),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,56 +27,56 @@
<!--/ko-->
</div>
<!--ko if: !$root._.isEmpty(result.errors)-->
<div class="alert alert-warning">
<ul class="list-unstyled">
<!--ko foreach: result.errors-->
<!--ko if: rows-->
<li>
<!--ko if: column-->
<p><strong>
<!-- ko if: rows.length == 1-->
{% blocktrans %}
<span data-bind="text: rows.length"></span> row had an invalid
"<span data-bind="text: column"></span>" cell and was not saved
{% endblocktrans %}
<!--ko foreach: result.errors-->
<div class="alert alert-warning">
<!--ko if: rows-->
<!--ko if: column-->
<h6>
<!-- ko if: rows.length == 1-->
{% blocktrans %}
<span data-bind="text: rows.length"></span> row had an invalid
"<span data-bind="text: column"></span>" cell and was not saved
{% endblocktrans %}
<!--/ko-->
<!-- ko if: rows.length > 1-->
{% blocktrans %}
<span data-bind="text: rows.length"></span> rows had invalid
"<span data-bind="text: column"></span>" cells and were not saved
{% endblocktrans %}
<!--/ko-->
</h6>
<!--/ko-->
<!-- ko if: rows.length > 1-->
{% blocktrans %}
<span data-bind="text: rows.length"></span> rows had invalid
"<span data-bind="text: column"></span>" cells and were not saved
{% endblocktrans %}
<!--ko if: !column -->
<h6 data-bind="text: title"></h6>
<!--/ko-->
</strong></p>
<!--/ko-->
<!--ko if: !column -->
<p><strong data-bind="text: title"></strong></p>
<!--/ko-->
<p data-bind="text: description">
</p>
<p data-bind="visible: sample, text: sample">
</p>
<div data-bind="visible: rows.length">
<button type="button"
class="btn btn-outline-primary btn-sm"
data-bs-toggle="collapse"
data-bind="attr: {
'data-bs-target': '#rowDetailsCollapse-' + $parentContext.$index(),
'aria-controls': 'rowDetailsCollapse-' + $parentContext.$index()
}"
aria-expanded="false">
{% trans "Toggle Affected Row(s)" %}
</button>
<div class="collapse"
data-bind="attr: { id: 'rowDetailsCollapse-' + $parentContext.$index() }">
<div class="card card-body mt-3"
data-bind="text: rows.join(', ')"></div>
<p data-bind="text: description"></p>
<p data-bind="visible: sample, text: sample"></p>
<div data-bind="visible: rows.length">
<button
type="button"
class="btn btn-outline-primary btn-sm"
data-bs-toggle="collapse"
data-bind="attr: {
'data-bs-target': '#rowDetailsCollapse-' + $parentContext.$index() + '-' + $index(),
'aria-controls': 'rowDetailsCollapse-' + $parentContext.$index() + '-' + $index()
}"
aria-expanded="false"
>
{% trans "Toggle Affected Row(s)" %}
</button>
<div
class="collapse"
data-bind="attr: { id: 'rowDetailsCollapse-' + $parentContext.$index() + '-' + $index() }"
>
<div
class="card card-body mt-3"
data-bind="text: rows.join(', ')"
></div>
</div>
</div>
</div>
</li>
<!--/ko-->
<!--/ko-->
</ul>
</div>
<!--/ko-->
</div>
<!--/ko-->
<!--/ko-->
<!--/ko-->
<!--ko if: state == $root.states.SUCCESS && !result-->
Expand Down
12 changes: 9 additions & 3 deletions corehq/apps/case_search/tests/test_filter_dsl.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,20 @@ def test_datetime_system_property_filter_optimized(self, mock_get_timezone):

@freeze_time('2023-05-16T13:01:51Z')
@flag_enabled('CASE_SEARCH_INDEXED_METADATA')
@patch("corehq.apps.case_search.xpath_functions.comparison.get_timezone_for_domain",
return_value=pytz.timezone('America/Los_Angeles'))
def test_system_date_property_comparison(self, mock_get_timezone):
def test_system_datetime_property_comparison(self):
parsed = parse_xpath("last_modified < datetime-add(now(), 'weeks', -2)")
expected_filter = filters.date_range('modified_on', lt='2023-05-02T13:01:51+00:00')
built_filter = build_filter_from_ast(parsed, SearchFilterContext("domain"))
self.checkQuery(built_filter, expected_filter, is_raw_query=True)

@freeze_time('2023-05-16T13:01:51Z')
@flag_enabled('CASE_SEARCH_INDEXED_METADATA')
def test_system_datetime_property_match(self):
parsed = parse_xpath("last_modified = now()")
expected_filter = filters.term('modified_on', '2023-05-16T13:01:51+00:00')
built_filter = build_filter_from_ast(parsed, SearchFilterContext("domain"))
self.checkQuery(built_filter, expected_filter, is_raw_query=True)

def test_not_filter(self):
parsed = parse_xpath("not(name = 'farid')")
expected_filter = filters.NOT(case_property_query('name', 'farid'))
Expand Down
2 changes: 2 additions & 0 deletions corehq/apps/case_search/xpath_functions/comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ def _create_system_datetime_query(domain, meta_property, op, value, node):
raise CaseFilterError(str(e), serialize(node))

if isinstance(date_or_datetime, datetime):
if op == EQ:
return filters.term(meta_property.es_field_name, value)
range_kwargs = {RANGE_OP_MAPPING[op]: date_or_datetime}
else:
timezone = get_timezone_for_domain(domain)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('cleanup', '0016_add_deletedsqldoc'),
]

operations = [
migrations.RunSQL("""
DROP TABLE IF EXISTS "oauth_integrations_googleapitoken" CASCADE;
DROP TABLE IF EXISTS "oauth_integrations_livegooglesheetrefreshstatus" CASCADE;
DROP TABLE IF EXISTS "oauth_integrations_livegooglesheetschedule" CASCADE;
"""),
]


"""
Dropped entities can be checked with the following query:
select pg_describe_object(classid, objid, objsubid)
from pg_depend
where refobjid in (
'oauth_integrations_googleapitoken'::regclass,
'oauth_integrations_livegooglesheetrefreshstatus'::regclass,
'oauth_integrations_livegooglesheetschedule'::regclass
);
Example output (from staging, the same as a local dev setup):
type oauth_integrations_livegooglesheetschedule
type oauth_integrations_livegooglesheetrefreshstatus
type oauth_integrations_googleapitoken
toast table pg_toast.pg_toast_2980995
toast table pg_toast.pg_toast_2980982
toast table pg_toast.pg_toast_2892669
sequence oauth_integrations_livegooglesheetschedule_id_seq
sequence oauth_integrations_livegooglesheetrefreshstatus_id_seq
sequence oauth_integrations_googleapitoken_id_seq
index oauth_integrations_livegoo_schedule_id_064aa4f4
index oauth_integrations_livegoo_export_config_id_200127ab
index oauth_integrations_liveg_export_config_id_200127ab_like
index oauth_integrations_googleapitoken_user_id_9d01255f
default value for column id of table oauth_integrations_livegooglesheetschedule
default value for column id of table oauth_integrations_livegooglesheetrefreshstatus
default value for column id of table oauth_integrations_googleapitoken
constraint oauth_integrations_livegooglesheetschedule_pkey on table oauth_integrations_livegooglesheetschedule
constraint oauth_integrations_livegooglesheetrefreshstatus_pkey on table oauth_integrations_livegooglesheetrefreshstatus
constraint oauth_integrations_l_schedule_id_064aa4f4_fk_oauth_int on table oauth_integrations_livegooglesheetrefreshstatus
constraint oauth_integrations_googleapitoken_pkey on table oauth_integrations_googleapitoken
constraint oauth_integrations_g_user_id_9d01255f_fk_auth_user on table oauth_integrations_googleapitoken
"""
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ hqDefine("cloudcare/js/form_entry/web_form_session", [
'cloudcare/js/form_entry/utils',
'cloudcare/js/form_entry/form_ui',
'cloudcare/js/formplayer/utils/utils',
'cloudcare/js/formplayer/users/models',
], function (
$,
ko,
Expand All @@ -20,7 +21,8 @@ hqDefine("cloudcare/js/form_entry/web_form_session", [
taskQueue,
formEntryUtils,
formUI,
utils
utils,
UsersModels
) {
function WebFormSession(params) {
var self = {};
Expand Down Expand Up @@ -478,6 +480,7 @@ hqDefine("cloudcare/js/form_entry/web_form_session", [
};

self.changeLang = function (lang) {
updateDisplayOptionLang(lang);
self.serverRequest(
{
'action': constants.CHANGE_LOCALE,
Expand Down Expand Up @@ -623,9 +626,16 @@ hqDefine("cloudcare/js/form_entry/web_form_session", [
var urlObject = utils.currentUrlToObject();
urlObject.changeLang = lang;
menusController.selectMenu(urlObject);
updateDisplayOptionLang(lang);
});
}

function updateDisplayOptionLang(lang) {
var displayOptions = UsersModels.getCurrentUser().displayOptions;
displayOptions.language = lang;
UsersModels.saveDisplayOptions(displayOptions);
}

return {
WebFormSession: WebFormSession,
applyLangListener: applyLangListener,
Expand Down
16 changes: 16 additions & 0 deletions corehq/apps/domain/migrations/0015_delete_projectlimit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Generated by Django 4.2.16 on 2024-11-25 15:32

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('domain', '0014_appreleasemodesetting'),
]

operations = [
migrations.DeleteModel(
name='ProjectLimit',
),
]
14 changes: 0 additions & 14 deletions corehq/apps/domain/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1107,20 +1107,6 @@ def disallowed_ucr_expressions(cls, domain_name):
return restricted_expressions - allowed_expressions_for_domain


class ProjectLimitType():
LIVE_GOOGLE_SHEETS = 'lgs'

CHOICES = (
(LIVE_GOOGLE_SHEETS, "Live Google Sheets"),
)


class ProjectLimit(models.Model):
domain = models.CharField(max_length=256, db_index=True)
limit_type = models.CharField(max_length=5, choices=ProjectLimitType.CHOICES)
limit_value = models.IntegerField(default=20)


class OperatorCallLimitSettings(models.Model):
CALL_LIMIT_MINIMUM = 1
CALL_LIMIT_MAXIMUM = 1000
Expand Down
1 change: 1 addition & 0 deletions corehq/apps/domain/static/domain/js/internal_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ hqDefine("domain/js/internal_settings", [
'hqwebapp/js/initial_page_data',
'hqwebapp/js/multiselect_utils',
'jquery-ui/ui/widgets/datepicker',
'commcarehq',
], function (
$,
ko,
Expand Down

This file was deleted.

Loading

0 comments on commit 6400bd1

Please sign in to comment.