viewer#2311 When email or profile image upload fails show a more fitting reason

master
Andrey Kleshchev 2024-08-19 08:41:10 +03:00 committed by Andrey Kleshchev
parent c04fae068b
commit 627d512c47
4 changed files with 34 additions and 1 deletions

View File

@ -984,6 +984,7 @@ void LLViewerAssetUpload::HandleUploadError(LLCore::HttpStatus status, LLSD &res
label = result["label"].asString();
}
LLFloaterSnapshot* floater_snapshot = LLFloaterSnapshot::findInstance();
if (result.has("message"))
{
reason = result["message"].asString();
@ -994,6 +995,12 @@ void LLViewerAssetUpload::HandleUploadError(LLCore::HttpStatus status, LLSD &res
{
case 404:
reason = LLTrans::getString("AssetUploadServerUnreacheble");
if (floater_snapshot
&& floater_snapshot->isWaitingState()
&& uploadInfo->getAssetType() == LLAssetType::AT_IMAGE_JPEG)
{
label = "CannotUploadSnapshotEmailTooBig";
}
break;
case 499:
reason = LLTrans::getString("AssetUploadServerDifficulties");
@ -1030,7 +1037,6 @@ void LLViewerAssetUpload::HandleUploadError(LLCore::HttpStatus status, LLSD &res
// Todo: move these floater specific actions into proper callbacks
// Let the Snapshot floater know we have failed uploading.
LLFloaterSnapshot* floater_snapshot = LLFloaterSnapshot::findInstance();
if (floater_snapshot && floater_snapshot->isWaitingState())
{
if (uploadInfo->getAssetType() == LLAssetType::AT_IMAGE_JPEG)

View File

@ -38,6 +38,7 @@
// newview
#include "llavataractions.h" // for getProfileURL()
#include "llviewermedia.h" // FIXME: don't use LLViewerMedia internals
#include "llnotificationsutil.h"
#include "llcorehttputil.h"
@ -132,6 +133,10 @@ void LLWebProfile::uploadImageCoro(LLPointer<LLImageFormatted> image, std::strin
if (!status)
{
if (image->getDataSize() > MAX_WEB_DATASIZE)
{
LLNotificationsUtil::add("CannotUploadSnapshotWebTooBig");
}
LL_WARNS("Snapshots") << "Failed to get image upload config" << LL_ENDL;
LLWebProfile::reportImageUploadStatus(false);
return;

View File

@ -57,6 +57,8 @@ public:
static void setAuthCookie(const std::string& cookie);
static void setImageUploadResultCallback(status_callback_t cb) { mStatusCallback = cb; }
static constexpr S32 MAX_WEB_DATASIZE = 8 * 1024 * 1024; // 8MB
private:
static LLCore::HttpHeaders::ptr_t buildDefaultHeaders();

View File

@ -2388,6 +2388,26 @@ Unable to upload [FILE] due to the following reason: [REASON]
Please try again later.
<tag>fail</tag>
</notification>
<notification
icon="alertmodal.tga"
name="CannotUploadSnapshotEmailTooBig"
type="alertmodal">
Unable to upload snapshot [FILE] due to the following reason: [REASON]
File might be too big, try reducing resolution, quality or try again later.
<tag>fail</tag>
</notification>
<notification
icon="alertmodal.tga"
name="CannotUploadSnapshotWebTooBig"
type="alertmodal">
Unable to upload snapshot.
File might be too big, try reducing resolution or try again later.
<tag>fail</tag>
</notification>
<notification
icon="notifytip.tga"