summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-05-17 22:14:26 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-05-17 22:14:26 +0300
commit9373f64f49ad9d0676731041466d353274ee51bd (patch)
tree90eea11c7b8403e991811cca07a0579b6d24c6e6
parentd2e242ab632a051e0b357efa1fdd0a1a64027f44 (diff)
SL-3007 Small improvements for auto filling abuse reports
-rw-r--r--indra/newview/llchathistory.cpp28
-rw-r--r--indra/newview/llfloaterreporter.cpp22
-rw-r--r--indra/newview/llfloaterreporter.h4
-rw-r--r--indra/newview/skins/default/xui/en/floater_report_abuse.xml5
4 files changed, 42 insertions, 17 deletions
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<LLTextBox>("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<LLTextBox>("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<LLFloaterReporter>("reporter");
+ if (self)
+ {
+ std::string description = self->getString("chat_report_format", args);
+ self->getChild<LLUICtrl>("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<LLFloaterReporter>("reporter");
- if (self)
- {
- self->getChild<LLUICtrl>("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<LLFloater> 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
</floater.string>
+ <floater.string
+ name="chat_report_format">
+Time: [MSG_TIME]
+Text: [MSG_DESCRIPTION]
+ </floater.string>
<texture_picker
allow_no_texture="true"
default_image_name="None"