mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-04 04:04:18 +00:00 
			
		
		
		
	Users can report their own generated content (thanks Google Play reviewers)
This commit is contained in:
		@@ -104,6 +104,8 @@ class ServerConfigurationHelper {
 | 
			
		||||
                        label: new Map<String, String>.from(cause["label"])))
 | 
			
		||||
                    .toList()),
 | 
			
		||||
                maxCommentLength: reportPolicy["max_comment_length"],
 | 
			
		||||
                canUserReportHisOwnContent:
 | 
			
		||||
                    reportPolicy["can_user_report_his_own_content"],
 | 
			
		||||
              ));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -151,8 +151,13 @@ class ReportCause {
 | 
			
		||||
class ReportPolicy {
 | 
			
		||||
  final List<ReportCause> causes;
 | 
			
		||||
  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 {
 | 
			
		||||
 
 | 
			
		||||
@@ -135,7 +135,9 @@ class _AboutUserSectionState extends State<AboutUserSection> {
 | 
			
		||||
          ),
 | 
			
		||||
 | 
			
		||||
          // Report user
 | 
			
		||||
          !widget.user.isCurrentUser && srvConfig!.isReportingEnabled
 | 
			
		||||
          srvConfig!.isReportingEnabled &&
 | 
			
		||||
                  (!widget.user.isCurrentUser ||
 | 
			
		||||
                      srvConfig!.reportPolicy!.canUserReportHisOwnContent)
 | 
			
		||||
              ? ListTile(
 | 
			
		||||
                  textColor: Colors.red,
 | 
			
		||||
                  leading: Icon(Icons.flag, color: Colors.red),
 | 
			
		||||
 
 | 
			
		||||
@@ -112,7 +112,9 @@ class CommentTile extends StatelessWidget {
 | 
			
		||||
                child: Text(tr("Delete")!),
 | 
			
		||||
                value: _CommentAction.DELETE,
 | 
			
		||||
              ),
 | 
			
		||||
            ]..addAll(srvConfig!.isReportingEnabled && !comment.isOwner
 | 
			
		||||
            ]..addAll(srvConfig!.isReportingEnabled &&
 | 
			
		||||
                    (!comment.isOwner ||
 | 
			
		||||
                        srvConfig!.reportPolicy!.canUserReportHisOwnContent)
 | 
			
		||||
                ? [
 | 
			
		||||
                    PopupMenuItem(
 | 
			
		||||
                      child: Text(tr("Report abuse")!),
 | 
			
		||||
 
 | 
			
		||||
@@ -97,8 +97,10 @@ class ConversationMessageTile extends StatelessWidget {
 | 
			
		||||
 | 
			
		||||
                        // Report the message
 | 
			
		||||
                        PopupMenuItem(
 | 
			
		||||
                          enabled:
 | 
			
		||||
                              srvConfig!.isReportingEnabled && !message.isOwner,
 | 
			
		||||
                          enabled: srvConfig!.isReportingEnabled &&
 | 
			
		||||
                              (!message.isOwner ||
 | 
			
		||||
                                  srvConfig!.reportPolicy!
 | 
			
		||||
                                      .canUserReportHisOwnContent),
 | 
			
		||||
                          value: _MenuChoices.REPORT,
 | 
			
		||||
                          child: Text(tr("Report abuse")!),
 | 
			
		||||
                        ),
 | 
			
		||||
 
 | 
			
		||||
@@ -156,7 +156,9 @@ class _PostTileState extends State<PostTile> {
 | 
			
		||||
              value: _PostActions.DELETE,
 | 
			
		||||
              enabled: widget.post.canDelete,
 | 
			
		||||
            ),
 | 
			
		||||
          ]..addAll(srvConfig!.isReportingEnabled && !widget.post.isOwner
 | 
			
		||||
          ]..addAll(srvConfig!.isReportingEnabled &&
 | 
			
		||||
                  (!widget.post.isOwner ||
 | 
			
		||||
                      srvConfig!.reportPolicy!.canUserReportHisOwnContent)
 | 
			
		||||
              ? [
 | 
			
		||||
                  PopupMenuItem(
 | 
			
		||||
                    child: Text(tr("Report abuse")!),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user