Adds support for Harassment reports.
This commit is contained in:
@@ -63,6 +63,7 @@ fun RenderReport(
|
|||||||
ReportType.MALWARE -> stringRes(R.string.malware)
|
ReportType.MALWARE -> stringRes(R.string.malware)
|
||||||
ReportType.MOD -> stringRes(R.string.mod)
|
ReportType.MOD -> stringRes(R.string.mod)
|
||||||
ReportType.OTHER -> stringRes(R.string.other)
|
ReportType.OTHER -> stringRes(R.string.other)
|
||||||
|
ReportType.HARASSMENT -> stringRes(R.string.harassment)
|
||||||
null -> stringRes(R.string.other)
|
null -> stringRes(R.string.other)
|
||||||
}
|
}
|
||||||
}.toSet()
|
}.toSet()
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
<string name="impersonation">Impersonation</string>
|
<string name="impersonation">Impersonation</string>
|
||||||
<string name="illegal_behavior">Illegal Behavior</string>
|
<string name="illegal_behavior">Illegal Behavior</string>
|
||||||
<string name="other">Other</string>
|
<string name="other">Other</string>
|
||||||
|
<string name="harassment">Harassment</string>
|
||||||
<string name="unknown">Unknown</string>
|
<string name="unknown">Unknown</string>
|
||||||
<string name="relay_icon">Relay Icon</string>
|
<string name="relay_icon">Relay Icon</string>
|
||||||
<string name="unknown_author">Unknown Author</string>
|
<string name="unknown_author">Unknown Author</string>
|
||||||
|
|||||||
@@ -52,14 +52,15 @@ class ReportEvent(
|
|||||||
private fun defaultReportType(): ReportType {
|
private fun defaultReportType(): ReportType {
|
||||||
defaultType?.let { return it }
|
defaultType?.let { return it }
|
||||||
|
|
||||||
// Works with old and new structures for report.
|
// search for any type in any tag.
|
||||||
var reportType = defaultReportTypes().firstOrNull()
|
val reportType =
|
||||||
if (reportType == null) {
|
defaultReportTypes().firstOrNull()
|
||||||
reportType = tags.mapNotNull { it.getOrNull(2) }.map { ReportType.parseOrNull(it, emptyArray()) }.firstOrNull()
|
?: tags.firstNotNullOfOrNull {
|
||||||
}
|
ReportedAuthorTag.parse(it)?.type
|
||||||
if (reportType == null) {
|
?: ReportedEventTag.parse(it)?.type
|
||||||
reportType = ReportType.SPAM
|
?: ReportedAddressTag.parse(it)?.type
|
||||||
}
|
} ?: ReportType.SPAM
|
||||||
|
|
||||||
defaultType = reportType
|
defaultType = reportType
|
||||||
return reportType
|
return reportType
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ enum class ReportType(
|
|||||||
PROFANITY("profanity"),
|
PROFANITY("profanity"),
|
||||||
MALWARE("malware"),
|
MALWARE("malware"),
|
||||||
MOD("mod"),
|
MOD("mod"),
|
||||||
|
HARASSMENT("Harrassment"),
|
||||||
OTHER("other"),
|
OTHER("other"),
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -51,6 +52,7 @@ enum class ReportType(
|
|||||||
MALWARE.code -> MALWARE
|
MALWARE.code -> MALWARE
|
||||||
MOD.code -> MOD
|
MOD.code -> MOD
|
||||||
"MOD" -> MOD
|
"MOD" -> MOD
|
||||||
|
HARASSMENT.code -> HARASSMENT
|
||||||
OTHER.code -> OTHER
|
OTHER.code -> OTHER
|
||||||
else -> {
|
else -> {
|
||||||
Log.w("ReportedEventTag", "Report type not supported: $code ${tag.joinToString(", ")}")
|
Log.w("ReportedEventTag", "Report type not supported: $code ${tag.joinToString(", ")}")
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import com.vitorpamplona.quartz.utils.arrayOfNotNull
|
|||||||
import com.vitorpamplona.quartz.utils.ensure
|
import com.vitorpamplona.quartz.utils.ensure
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
|
@Deprecated("Old version had [`report`, `<reason>`] tags")
|
||||||
class DefaultReportTag {
|
class DefaultReportTag {
|
||||||
companion object {
|
companion object {
|
||||||
const val TAG_NAME = "report"
|
const val TAG_NAME = "report"
|
||||||
|
|||||||
Reference in New Issue
Block a user