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

P4-4131: missing Send Msg confirmation box #279

Merged
merged 8 commits into from
Dec 2, 2022
4 changes: 4 additions & 0 deletions engage/archives/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
class ArchiveOverrides(ClassOverrideMixinMustBeFirst, Archive):
override_ignore = ignoreDjangoModelAttrs(Archive)

# we do not want Django to perform any magic inheritance
class Meta:
abstract = True

@classmethod
def s3_client(cls):
# use same code as the currently working api/v2 s3 downloads
Expand Down
5 changes: 5 additions & 0 deletions engage/channels/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
class ChannelOverrides(ClassOverrideMixinMustBeFirst, Channel):
override_ignore = ignoreDjangoModelAttrs(Channel)

# we do not want Django to perform any magic inheritance
class Meta:
abstract = True

@classmethod
def create(
cls,
Expand All @@ -33,6 +37,7 @@ def create(

#endclass ChannelOverrides


from temba.channels.types.android.type import AndroidType
class AndroidTypeOverrides(ClassOverrideMixinMustBeFirst, AndroidType):
override_ignore = ('_abc_impl',)
Expand Down
5 changes: 5 additions & 0 deletions engage/contacts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@

from temba.contacts.models import ContactField


class ContactFieldOverrides(ClassOverrideMixinMustBeFirst, ContactField):
override_ignore = ignoreDjangoModelAttrs(ContactField)

# we do not want Django to perform any magic inheritance
class Meta:
abstract = True

@classmethod
def get_or_create(cls, org, user, key, label=None, show_in_table=None, value_type=None, priority=None):
try:
Expand Down
9 changes: 9 additions & 0 deletions engage/msgs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
class MsgModelOverride(ClassOverrideMixinMustBeFirst, Msg):
override_ignore = ignoreDjangoModelAttrs(Msg)

# we do not want Django to perform any magic inheritance
class Meta:
abstract = True

def archive(self):
"""
Archives this message
Expand All @@ -35,9 +39,14 @@ def restore(self):

#endclass MsgModelOverride


class LabelModelOverride(ClassOverrideMixinMustBeFirst, Label):
override_ignore = ignoreDjangoModelAttrs(Label)

# we do not want Django to perform any magic inheritance
class Meta:
abstract = True

#MAX_ORG_LABELS = 250
# remove hard-coded limit in favor of settings-based max limit
MAX_ORG_LABELS = settings.MAX_ORG_LABELS
Expand Down
31 changes: 21 additions & 10 deletions engage/static/engage/js/broadcast_send.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
$(document).ready(function() {
let rootSelectorName = "#send-message";
if ( $(document.querySelector('temba-modax')
let rootSelectorName = "#send-msg";
if ( $(document.querySelector("#send-message") ) !== undefined ) {
rootSelectorName = "#send-message";
}
else if ( $(document.querySelector("#send-message-modal") ) !== undefined ) {
rootSelectorName = "#send-message-modal";
}
else if ( $(document.querySelector("temba-modax")
.shadowRoot.querySelector("temba-dialog")
.shadowRoot.querySelector(".dialog-footer")
.querySelector("temba-button[primary]"))[0] !== undefined )
{
rootSelectorName = "temba-modax";
}

let selector = $(document.querySelector(rootSelectorName)
.shadowRoot.querySelector("temba-dialog")
.shadowRoot.querySelector(".dialog-footer")
.querySelector("temba-button[primary]")
.shadowRoot.querySelector("div")
);
if (selector) {
let selector;
try {
selector = $(document.querySelector(rootSelectorName)
.shadowRoot.querySelector("temba-dialog")
.shadowRoot.querySelector(".dialog-footer")
.querySelector("temba-button[primary]")
.shadowRoot.querySelector("div")
);
} catch (e) {
selector = null;
}
if ( selector && !selector.hasClass("confirm-click-handler") ) {
let bIsAskingUser = false; //code might take a brief moment, prevent mutli-click-dialogs
$(selector).on("click", function (e) {
$(selector).addClass("confirm-click-handler").on("click", function (e) {
let bUserChoseOK = false;
if ( !bIsAskingUser ) {
bIsAskingUser = true;
Expand Down