fix: import unpublished exam rooms and add opt-in school HTML feedback
This commit is contained in:
@@ -103,6 +103,7 @@ class FeedbackSubmission {
|
||||
this.school,
|
||||
this.attachments = const [],
|
||||
this.diagnosticLog,
|
||||
this.diagnosticHtml,
|
||||
});
|
||||
|
||||
factory FeedbackSubmission.problem({
|
||||
@@ -112,6 +113,7 @@ class FeedbackSubmission {
|
||||
List<FeedbackAttachment> attachments = const [],
|
||||
FeedbackLimits limits = FeedbackLimits.defaults,
|
||||
Uint8List? diagnosticLog,
|
||||
Uint8List? diagnosticHtml,
|
||||
}) {
|
||||
final text = message.trim();
|
||||
if (text.isEmpty) throw const FeedbackException('请填写问题或建议');
|
||||
@@ -122,6 +124,10 @@ class FeedbackSubmission {
|
||||
(diagnosticLog.isEmpty || diagnosticLog.length > 256 * 1024)) {
|
||||
throw const FeedbackException('日志附件不能超过256 KB');
|
||||
}
|
||||
if (diagnosticHtml != null &&
|
||||
(diagnosticHtml.isEmpty || diagnosticHtml.length > 2 * 1024 * 1024)) {
|
||||
throw const FeedbackException('网页排查附件不能超过2 MB');
|
||||
}
|
||||
return FeedbackSubmission._(
|
||||
id: id,
|
||||
kind: FeedbackKind.problem,
|
||||
@@ -131,6 +137,9 @@ class FeedbackSubmission {
|
||||
diagnosticLog: diagnosticLog == null
|
||||
? null
|
||||
: Uint8List.fromList(diagnosticLog).asUnmodifiableView(),
|
||||
diagnosticHtml: diagnosticHtml == null
|
||||
? null
|
||||
: Uint8List.fromList(diagnosticHtml).asUnmodifiableView(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -161,6 +170,7 @@ class FeedbackSubmission {
|
||||
final String? school;
|
||||
final List<FeedbackAttachment> attachments;
|
||||
final Uint8List? diagnosticLog;
|
||||
final Uint8List? diagnosticHtml;
|
||||
|
||||
static String newId() {
|
||||
final random = Random.secure();
|
||||
|
||||
Reference in New Issue
Block a user