From e129986a49a9e1ee3ffef8a98a3dc83a310c95c9 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 24 Jan 2022 23:36:56 +0200 Subject: SL-3007 Ability to report abuse from chat --- indra/newview/llchathistory.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'indra/newview/llchathistory.cpp') diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index c110e0d815..dffd523b02 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -48,6 +48,7 @@ #include "llspeakers.h" //for LLIMSpeakerMgr #include "lltrans.h" #include "llfloaterreg.h" +#include "llfloaterreporter.h" #include "llfloatersidepanelcontainer.h" #include "llmutelist.h" #include "llstylemap.h" @@ -403,6 +404,10 @@ public: { LLAvatarActions::pay(getAvatarId()); } + else if (level == "report_abuse") + { + LLFloaterReporter::showFromChat(mAvatarID, mFrom, getChild("time_box")->getValue().asString(), mText); + } else if(level == "block_unblock") { LLAvatarActions::toggleMute(getAvatarId(), LLMute::flagVoiceChat); @@ -477,6 +482,10 @@ public: { return canModerate(userdata); } + else if (level == "report_abuse") + { + return gAgentID != mAvatarID; + } else if (level == "can_ban_member") { return canBanGroupMember(getAvatarId()); @@ -628,6 +637,11 @@ public: mSessionID = chat.mSessionID; mSourceType = chat.mSourceType; + // To be able to report a message, we need a copy of it's text + // and it's easier to store text directly than trying to get + // it from a lltextsegment or chat's mEditor + mText = chat.mText; + //*TODO overly defensive thing, source type should be maintained out there if((chat.mFromID.isNull() && chat.mFromName.empty()) || (chat.mFromName == SYSTEM_FROM && chat.mFromID.isNull())) { @@ -977,6 +991,7 @@ protected: EChatSourceType mSourceType; std::string mFrom; LLUUID mSessionID; + std::string mText; S32 mMinUserNameWidth; const LLFontGL* mUserNameFont; -- cgit v1.3 From 1f542bf5427787577a564cd716b005c19500d54a Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 25 Jan 2022 23:30:20 +0200 Subject: SL-3007 mac build fix --- indra/newview/llchathistory.cpp | 3 ++- indra/newview/llfloaterreporter.cpp | 2 +- indra/newview/llfloaterreporter.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/newview/llchathistory.cpp') diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index dffd523b02..f286e4c075 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -406,7 +406,8 @@ public: } else if (level == "report_abuse") { - LLFloaterReporter::showFromChat(mAvatarID, mFrom, getChild("time_box")->getValue().asString(), mText); + std::string time = getChild("time_box")->getValue().asString(); + LLFloaterReporter::showFromChat(mAvatarID, mFrom, time, mText); } else if(level == "block_unblock") { diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 5b5af06e60..1c10bf3ca3 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -660,7 +660,7 @@ void LLFloaterReporter::showFromAvatar(const LLUUID& avatar_id, const std::strin } // static -void LLFloaterReporter::showFromChat(const LLUUID& avatar_id, const std::string& avatar_name, std::string& time, std::string& description) +void LLFloaterReporter::showFromChat(const LLUUID& avatar_id, const std::string& avatar_name, const std::string& time, const std::string& description) { show(avatar_id, avatar_name); setDescription(time + "\n" + description); diff --git a/indra/newview/llfloaterreporter.h b/indra/newview/llfloaterreporter.h index 14ba4d6c58..50a7fcaff3 100644 --- a/indra/newview/llfloaterreporter.h +++ b/indra/newview/llfloaterreporter.h @@ -93,7 +93,7 @@ public: static void showFromObject(const LLUUID& object_id, const LLUUID& experience_id = LLUUID::null); static void showFromAvatar(const LLUUID& avatar_id, const std::string avatar_name); - static void showFromChat(const LLUUID& avatar_id, const std::string& avatar_name, std::string& time, std::string& description); + static void showFromChat(const LLUUID& avatar_id, const std::string& avatar_name, const std::string& time, const std::string& description); static void showFromExperience(const LLUUID& experience_id); static void onClickSend (void *userdata); -- cgit v1.3 From 9373f64f49ad9d0676731041466d353274ee51bd Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 17 May 2022 22:14:26 +0300 Subject: SL-3007 Small improvements for auto filling abuse reports --- indra/newview/llchathistory.cpp | 28 ++++++++++++++++++++-- indra/newview/llfloaterreporter.cpp | 22 ++++++++--------- indra/newview/llfloaterreporter.h | 4 ---- .../skins/default/xui/en/floater_report_abuse.xml | 5 ++++ 4 files changed, 42 insertions(+), 17 deletions(-) (limited to 'indra/newview/llchathistory.cpp') diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index f286e4c075..5edc8a1291 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -406,8 +406,30 @@ public: } else if (level == "report_abuse") { - std::string time = getChild("time_box")->getValue().asString(); - LLFloaterReporter::showFromChat(mAvatarID, mFrom, time, mText); + std::string time_string; + if (mTime > 0) // have frame time + { + time_t current_time = time_corrected(); + time_t message_time = current_time - LLFrameTimer::getElapsedSeconds() + mTime; + + time_string = "[" + LLTrans::getString("TimeMonth") + "]/[" + + LLTrans::getString("TimeDay") + "]/[" + + LLTrans::getString("TimeYear") + "] [" + + LLTrans::getString("TimeHour") + "]:[" + + LLTrans::getString("TimeMin") + "]"; + + LLSD substitution; + + substitution["datetime"] = (S32)message_time; + LLStringUtil::format(time_string, substitution); + } + else + { + // From history. This might be not full. + // See LLChatLogParser::parse if it needs to include full date + time_string = getChild("time_box")->getValue().asString(); + } + LLFloaterReporter::showFromChat(mAvatarID, mFrom, time_string, mText); } else if(level == "block_unblock") { @@ -642,6 +664,7 @@ public: // and it's easier to store text directly than trying to get // it from a lltextsegment or chat's mEditor mText = chat.mText; + mTime = chat.mTime; //*TODO overly defensive thing, source type should be maintained out there if((chat.mFromID.isNull() && chat.mFromName.empty()) || (chat.mFromName == SYSTEM_FROM && chat.mFromID.isNull())) @@ -993,6 +1016,7 @@ protected: std::string mFrom; LLUUID mSessionID; std::string mText; + F64 mTime; S32 mMinUserNameWidth; const LLFontGL* mUserNameFont; diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 1c10bf3ca3..2df4ca973d 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -663,7 +663,17 @@ void LLFloaterReporter::showFromAvatar(const LLUUID& avatar_id, const std::strin void LLFloaterReporter::showFromChat(const LLUUID& avatar_id, const std::string& avatar_name, const std::string& time, const std::string& description) { show(avatar_id, avatar_name); - setDescription(time + "\n" + description); + + LLStringUtil::format_map_t args; + args["[MSG_TIME]"] = time; + args["[MSG_DESCRIPTION]"] = description; + + LLFloaterReporter *self = LLFloaterReg::findTypedInstance("reporter"); + if (self) + { + std::string description = self->getString("chat_report_format", args); + self->getChild("details_edit")->setValue(description); + } } void LLFloaterReporter::setPickedObjectProperties(const std::string& object_name, const std::string& owner_name, const LLUUID owner_id) @@ -1033,13 +1043,3 @@ void LLFloaterReporter::onClose(bool app_quitting) mSnapshotTimer.stop(); gSavedPerAccountSettings.setBOOL("PreviousScreenshotForReport", app_quitting); } - -// static -void LLFloaterReporter::setDescription(const std::string& description) -{ - LLFloaterReporter *self = LLFloaterReg::findTypedInstance("reporter"); - if (self) - { - self->getChild("details_edit")->setValue(description); - } -} diff --git a/indra/newview/llfloaterreporter.h b/indra/newview/llfloaterreporter.h index 50a7fcaff3..b6c70e866d 100644 --- a/indra/newview/llfloaterreporter.h +++ b/indra/newview/llfloaterreporter.h @@ -113,10 +113,8 @@ private: static void show(const LLUUID& object_id, const std::string& avatar_name = LLStringUtil::null, const LLUUID& experience_id = LLUUID::null); void takeScreenshot(bool use_prev_screenshot = false); - void sendReportViaCaps(std::string url); void uploadImage(); bool validateReport(); - void setReporterID(); LLSD gatherReport(); void sendReportViaLegacy(const LLSD & report); void sendReportViaCaps(std::string url, std::string sshot_url, const LLSD & report); @@ -128,8 +126,6 @@ private: void setFromAvatarID(const LLUUID& avatar_id); void onAvatarNameCache(const LLUUID& avatar_id, const LLAvatarName& av_name); - static void setDescription(const std::string& description); - static void requestAbuseCategoriesCoro(std::string url, LLHandle handle); static void finishedARPost(const LLSD &); diff --git a/indra/newview/skins/default/xui/en/floater_report_abuse.xml b/indra/newview/skins/default/xui/en/floater_report_abuse.xml index f60269ecba..343e72f057 100644 --- a/indra/newview/skins/default/xui/en/floater_report_abuse.xml +++ b/indra/newview/skins/default/xui/en/floater_report_abuse.xml @@ -11,6 +11,11 @@ name="Screenshot"> Screenshot + +Time: [MSG_TIME] +Text: [MSG_DESCRIPTION] + Date: Mon, 5 Sep 2022 23:57:42 +0300 Subject: SL-3007 Small improvements for auto filling abuse reports #2 --- indra/newview/llchathistory.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'indra/newview/llchathistory.cpp') diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 4f8182936d..7ff24f64ac 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -119,6 +119,7 @@ public: mSourceType(CHAT_SOURCE_UNKNOWN), mFrom(), mSessionID(), + mCreationTime(time_corrected()), mMinUserNameWidth(0), mUserNameFont(NULL), mUserNameTextBox(NULL), @@ -425,9 +426,24 @@ public: } else { - // From history. This might be not full. - // See LLChatLogParser::parse if it needs to include full date + // From history. This might be empty or not full. + // See LLChatLogParser::parse time_string = getChild("time_box")->getValue().asString(); + + // Just add current date if not full. + // Should be fine since both times are supposed to be stl + if (!time_string.empty() && time_string.size() < 7) + { + time_string = "[" + LLTrans::getString("TimeMonth") + "]/[" + + LLTrans::getString("TimeDay") + "]/[" + + LLTrans::getString("TimeYear") + "] " + time_string; + + LLSD substitution; + // To avoid adding today's date to yesterday's timestamp, + // use creation time instead of current time + substitution["datetime"] = (S32)mCreationTime; + LLStringUtil::format(time_string, substitution); + } } LLFloaterReporter::showFromChat(mAvatarID, mFrom, time_string, mText); } @@ -1022,7 +1038,8 @@ protected: std::string mFrom; LLUUID mSessionID; std::string mText; - F64 mTime; + F64 mTime; // IM's frame time + time_t mCreationTime; // Views's time S32 mMinUserNameWidth; const LLFontGL* mUserNameFont; -- cgit v1.3