modules/DialogManagedReport.py
authorSomeone <someone@somenet.org>
Wed, 19 Oct 2022 21:00:52 +0000 (23:00 +0200)
committerSomeone <someone@somenet.org>
Wed, 19 Oct 2022 21:00:52 +0000 (23:00 +0200)
modules/DialogManagedReport.py

index 99eeee16cb5ad6c36d3764ff9c16c8de6b6d5b2b..7be68e50d998cb80b8948adbfc4e5996583f98c2 100644 (file)
@@ -16,7 +16,7 @@ class DialogManagedReport(AbstractCommand):
     CONFIG = {"display_name": "somebot-command", "auto_complete": True,
               "auto_complete_hint": "<permalink> [<reason>]",
              }
-    CONFIG["auto_complete_desc"] = CONFIG["description"] = AbstractCommand.ICON_PRIVATE+"Report a post. Run in same channel. Opens dialog if no reason is given."
+    CONFIG["auto_complete_desc"] = CONFIG["description"] = AbstractCommand.ICON_PRIVATE+"Report given post. Run in same channel. Opens dialog if no reason is given."
 
 
     def __init__(self, team_id, report_chan_id):
@@ -51,12 +51,35 @@ class DialogManagedReport(AbstractCommand):
                 "submit_label":"Report",
                 "state": post["id"],
                 "elements":[{
-                    "display_name": "Reason",
-                    "placeholder": "Write the reason here.",
+                    "display_name": "What's going on?",
                     "name": "report_reason",
-                    "type": "textarea",
-                    "help_text": "The reason is submitted to channel and team admin_as.",
+                    "type": "radio",
+                    "options": [{
+                            "text": "It's annoying or not interesting",
+                            "value": "not_interesting"
+                        },{
+                            "text": "I'm in this post and I don't like it",
+                            "value": "im_in_it_and_i_dont_like_it"
+                        },{
+                            "text": "I think it shouldn't be on Mattermost",
+                            "value": "should_not_be_on_mm"
+                        },{
+                            "text": "It's spam",
+                            "value": "spam"
+                        },{
+                            "text": "Other (Fill in below)",
+                            "value": "other"
+                        }
+                    ],
                     "optional": False,
+                    "default": "other"
+                },{
+                    "display_name": "Other reason or additional details",
+                    "placeholder": "Write a custom reason or additional details here.",
+                    "name": "report_other_reason",
+                    "type": "textarea",
+                    "help_text": "The report is submitted to channel and team admin_as.",
+                    "optional": True,
                 }]
             }
 
@@ -70,4 +93,4 @@ class DialogManagedReport(AbstractCommand):
         team = self.bot.api.get_team(data["team_id"])
         chan = self.bot.api.get_channel(data["channel_id"])
 
-        self.bot.api.create_post(self.report_chan_id, "``AUTODELETE-MONTH`` ``/"+self.TRIGGER+"`` used by ``@"+user["username"]+"`` in ``"+team["name"]+"::"+chan["name"]+"``\n#### Reported post: https://mattermost.fsinf.at/"+team["name"]+"/pl/"+data["state"]+"\nReason:\n```\n"+data["submission"]["report_reason"].strip()+"\n```")
+        self.bot.api.create_post(self.report_chan_id, "``AUTODELETE-MONTH`` ``/"+self.TRIGGER+"`` used by ``@"+user["username"]+"`` in ``"+team["name"]+"::"+chan["name"]+"``\n#### Reported post: https://mattermost.fsinf.at/"+team["name"]+"/pl/"+data["state"]+"\nReason: "+data["submission"]["report_reason"]+"\n```\n"+data["submission"]["report_other_reason"].strip()+"\n```")