Skip to content
Snippets Groups Projects
Commit 6bb9ec41 authored by Andrey Kleshchev's avatar Andrey Kleshchev
Browse files

MAINT-8498 Fixed item offers not appearing after friednship offer

parent 1bdf76dd
No related branches found
No related tags found
No related merge requests found
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include "llstylemap.h" #include "llstylemap.h"
#include "llslurl.h" #include "llslurl.h"
#include "lllayoutstack.h" #include "lllayoutstack.h"
#include "llnotifications.h"
#include "llnotificationsutil.h" #include "llnotificationsutil.h"
#include "lltoastnotifypanel.h" #include "lltoastnotifypanel.h"
#include "lltooltip.h" #include "lltooltip.h"
...@@ -1315,44 +1316,52 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL ...@@ -1315,44 +1316,52 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
// notify processing // notify processing
if (chat.mNotifId.notNull()) if (chat.mNotifId.notNull())
{ {
bool create_toast = true;
for (LLToastNotifyPanel::instance_iter ti(LLToastNotifyPanel::beginInstances())
, tend(LLToastNotifyPanel::endInstances()); ti != tend; ++ti)
{
LLToastNotifyPanel& panel = *ti;
LLIMToastNotifyPanel * imtoastp = dynamic_cast<LLIMToastNotifyPanel *>(&panel);
const std::string& notification_name = panel.getNotificationName();
if (notification_name == "OfferFriendship" && panel.isControlPanelEnabled() && imtoastp)
{
create_toast = false;
break;
}
}
if (create_toast)
{
LLNotificationPtr notification = LLNotificationsUtil::find(chat.mNotifId); LLNotificationPtr notification = LLNotificationsUtil::find(chat.mNotifId);
if (notification != NULL) if (notification != NULL)
{ {
LLIMToastNotifyPanel* notify_box = new LLIMToastNotifyPanel( bool create_toast = true;
notification, chat.mSessionID, LLRect::null, !use_plain_text_chat_history, mEditor); if (notification->getName() == "OfferFriendship")
{
//Prepare the rect for the view // We don't want multiple friendship offers to appear, this code checks if there are previous offers
LLRect target_rect = mEditor->getDocumentView()->getRect(); // by iterating though all panels.
// squeeze down the widget by subtracting padding off left and right // Note: it might be better to simply add a "pending offer" flag somewhere
target_rect.mLeft += mLeftWidgetPad + mEditor->getHPad(); for (LLToastNotifyPanel::instance_iter ti(LLToastNotifyPanel::beginInstances())
target_rect.mRight -= mRightWidgetPad; , tend(LLToastNotifyPanel::endInstances()); ti != tend; ++ti)
notify_box->reshape(target_rect.getWidth(), notify_box->getRect().getHeight()); {
notify_box->setOrigin(target_rect.mLeft, notify_box->getRect().mBottom); LLToastNotifyPanel& panel = *ti;
LLIMToastNotifyPanel * imtoastp = dynamic_cast<LLIMToastNotifyPanel *>(&panel);
const std::string& notification_name = panel.getNotificationName();
if (notification_name == "OfferFriendship"
&& panel.isControlPanelEnabled()
&& imtoastp)
{
create_toast = false;
break;
}
}
}
LLInlineViewSegment::Params params; if (create_toast)
params.view = notify_box; {
params.left_pad = mLeftWidgetPad; LLIMToastNotifyPanel* notify_box = new LLIMToastNotifyPanel(
params.right_pad = mRightWidgetPad; notification, chat.mSessionID, LLRect::null, !use_plain_text_chat_history, mEditor);
mEditor->appendWidget(params, "\n", false);
//Prepare the rect for the view
LLRect target_rect = mEditor->getDocumentView()->getRect();
// squeeze down the widget by subtracting padding off left and right
target_rect.mLeft += mLeftWidgetPad + mEditor->getHPad();
target_rect.mRight -= mRightWidgetPad;
notify_box->reshape(target_rect.getWidth(), notify_box->getRect().getHeight());
notify_box->setOrigin(target_rect.mLeft, notify_box->getRect().mBottom);
LLInlineViewSegment::Params params;
params.view = notify_box;
params.left_pad = mLeftWidgetPad;
params.right_pad = mRightWidgetPad;
mEditor->appendWidget(params, "\n", false);
}
} }
} }
}
// usual messages showing // usual messages showing
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment