summaryrefslogtreecommitdiff
path: root/indra/llui/llnotifications.cpp
diff options
context:
space:
mode:
authorGilbert Gonzales <gilbert@lindenlab.com>2013-01-08 12:21:47 -0800
committerGilbert Gonzales <gilbert@lindenlab.com>2013-01-08 12:21:47 -0800
commit974720373d608a8cbcd3cd26c125b6487b5926a2 (patch)
tree7698fed1eb85a59f83c65fbba11b21351c590902 /indra/llui/llnotifications.cpp
parentdbe1d2f0933db59493d11e9b3ab2d84ca884e28a (diff)
CHUI-660: Problem: Upon auto-existing DND mode upon startup, the notification form elements (buttonts) were added to the form. But then deserialized form elements were also being added to the form causing duplicate buttons. As a solution, only add on the deserialized form elements that exceed the amount in the template.
Diffstat (limited to 'indra/llui/llnotifications.cpp')
-rw-r--r--indra/llui/llnotifications.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index 386345177d..ebdb4d5024 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -320,6 +320,11 @@ void LLNotificationForm::addElement(const std::string& type, const std::string&
mFormData.append(element);
}
+void LLNotificationForm::addElement(const LLSD& element)
+{
+ mFormData.append(element);
+}
+
void LLNotificationForm::append(const LLSD& sub_form)
{
if (sub_form.isArray())
@@ -818,7 +823,18 @@ void LLNotification::init(const std::string& template_name, const LLSD& form_ele
//mSubstitutions["_ARGS"] = get_all_arguments_as_text(mSubstitutions);
mForm = LLNotificationFormPtr(new LLNotificationForm(*mTemplatep->mForm));
- mForm->append(form_elements);
+
+ //Prevents appending elements(buttons) that the template already had
+ if(form_elements.isArray()
+ && mForm->getNumElements() < form_elements.size())
+ {
+ LLSD::array_const_iterator it = form_elements.beginArray() + mForm->getNumElements();;
+
+ for(; it != form_elements.endArray(); ++it)
+ {
+ mForm->addElement(*it);
+ }
+ }
// apply substitution to form labels
mForm->formatElements(mSubstitutions);