1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-24 05:49:22 +00:00

Users can report their own generated content (thanks Google Play reviewers)

This commit is contained in:
Pierre HUBERT 2022-08-04 13:45:10 +02:00
parent a24bb147c8
commit c5ee235ebd
6 changed files with 21 additions and 6 deletions

View File

@ -104,6 +104,8 @@ class ServerConfigurationHelper {
label: new Map<String, String>.from(cause["label"]))) label: new Map<String, String>.from(cause["label"])))
.toList()), .toList()),
maxCommentLength: reportPolicy["max_comment_length"], maxCommentLength: reportPolicy["max_comment_length"],
canUserReportHisOwnContent:
reportPolicy["can_user_report_his_own_content"],
)); ));
} }

View File

@ -151,8 +151,13 @@ class ReportCause {
class ReportPolicy { class ReportPolicy {
final List<ReportCause> causes; final List<ReportCause> causes;
final int maxCommentLength; final int maxCommentLength;
final bool canUserReportHisOwnContent;
const ReportPolicy({required this.causes, required this.maxCommentLength}); const ReportPolicy({
required this.causes,
required this.maxCommentLength,
required this.canUserReportHisOwnContent,
});
} }
class ServerConfig { class ServerConfig {

View File

@ -135,7 +135,9 @@ class _AboutUserSectionState extends State<AboutUserSection> {
), ),
// Report user // Report user
!widget.user.isCurrentUser && srvConfig!.isReportingEnabled srvConfig!.isReportingEnabled &&
(!widget.user.isCurrentUser ||
srvConfig!.reportPolicy!.canUserReportHisOwnContent)
? ListTile( ? ListTile(
textColor: Colors.red, textColor: Colors.red,
leading: Icon(Icons.flag, color: Colors.red), leading: Icon(Icons.flag, color: Colors.red),

View File

@ -112,7 +112,9 @@ class CommentTile extends StatelessWidget {
child: Text(tr("Delete")!), child: Text(tr("Delete")!),
value: _CommentAction.DELETE, value: _CommentAction.DELETE,
), ),
]..addAll(srvConfig!.isReportingEnabled && !comment.isOwner ]..addAll(srvConfig!.isReportingEnabled &&
(!comment.isOwner ||
srvConfig!.reportPolicy!.canUserReportHisOwnContent)
? [ ? [
PopupMenuItem( PopupMenuItem(
child: Text(tr("Report abuse")!), child: Text(tr("Report abuse")!),

View File

@ -97,8 +97,10 @@ class ConversationMessageTile extends StatelessWidget {
// Report the message // Report the message
PopupMenuItem( PopupMenuItem(
enabled: enabled: srvConfig!.isReportingEnabled &&
srvConfig!.isReportingEnabled && !message.isOwner, (!message.isOwner ||
srvConfig!.reportPolicy!
.canUserReportHisOwnContent),
value: _MenuChoices.REPORT, value: _MenuChoices.REPORT,
child: Text(tr("Report abuse")!), child: Text(tr("Report abuse")!),
), ),

View File

@ -156,7 +156,9 @@ class _PostTileState extends State<PostTile> {
value: _PostActions.DELETE, value: _PostActions.DELETE,
enabled: widget.post.canDelete, enabled: widget.post.canDelete,
), ),
]..addAll(srvConfig!.isReportingEnabled && !widget.post.isOwner ]..addAll(srvConfig!.isReportingEnabled &&
(!widget.post.isOwner ||
srvConfig!.reportPolicy!.canUserReportHisOwnContent)
? [ ? [
PopupMenuItem( PopupMenuItem(
child: Text(tr("Report abuse")!), child: Text(tr("Report abuse")!),