MAINT-8985 FIXED User is able to send friendship request to a friend from the group menu

maxim_productengine 2018-08-22 18:02:31 +03:00
parent e041ffc5ff
commit 36594400a2
3 changed files with 27 additions and 0 deletions

View File

@ -1836,6 +1836,19 @@ BOOL LLScrollListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
menu_name, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance());
if (mPopupMenu)
{
if (mIsFriendSignal)
{
bool isFriend = *(*mIsFriendSignal)(uuid);
LLView* addFriendButton = mPopupMenu->getChild<LLView>("add_friend");
LLView* removeFriendButton = mPopupMenu->getChild<LLView>("remove_friend");
if (addFriendButton && removeFriendButton)
{
addFriendButton->setEnabled(!isFriend);
removeFriendButton->setEnabled(isFriend);
}
}
mPopupMenu->show(x, y);
LLMenuGL::showPopup(this, mPopupMenu, x, y);
return TRUE;
@ -3110,3 +3123,11 @@ void LLScrollListCtrl::onFocusLost()
LLUICtrl::onFocusLost();
}
boost::signals2::connection LLScrollListCtrl::setIsFriendCallback(const is_friend_signal_t::slot_type& cb)
{
if (!mIsFriendSignal)
{
mIsFriendSignal = new is_friend_signal_t();
}
return mIsFriendSignal->connect(cb);
}

View File

@ -90,6 +90,7 @@ public:
typedef boost::signals2::signal<S32 (S32,const LLScrollListItem*,const LLScrollListItem*),maximum<S32> > sort_signal_t;
typedef boost::signals2::signal<bool(const LLUUID& user_id)> is_friend_signal_t;
struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
{
@ -393,6 +394,8 @@ public:
return mSortCallback->connect(cb);
}
boost::signals2::connection setIsFriendCallback(const is_friend_signal_t::slot_type& cb);
protected:
// "Full" interface: use this when you're creating a list that has one or more of the following:
@ -515,6 +518,8 @@ private:
std::vector<sort_column_t> mSortColumns;
sort_signal_t* mSortCallback;
is_friend_signal_t* mIsFriendSignal;
}; // end class LLScrollListCtrl
#endif // LL_SCROLLLISTCTRL_H

View File

@ -834,6 +834,7 @@ BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root)
// Show the member's profile on double click.
mMembersList->setDoubleClickCallback(onMemberDoubleClick, this);
mMembersList->setContextMenu(LLScrollListCtrl::MENU_AVATAR);
mMembersList->setIsFriendCallback(LLAvatarActions::isFriend);
LLSD row;
row["columns"][0]["column"] = "name";