Merge pull request #2 from argoneuscze/modcall_reason
Added check for empty reason for modcalls
This commit is contained in:
		
						commit
						bec2b7aef4
					
				@ -2019,21 +2019,26 @@ void Courtroom::on_spectator_clicked()
 | 
				
			|||||||
void Courtroom::on_call_mod_clicked()
 | 
					void Courtroom::on_call_mod_clicked()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (ao_app->modcall_reason_enabled) {
 | 
					  if (ao_app->modcall_reason_enabled) {
 | 
				
			||||||
    auto box = new QInputDialog();
 | 
					    QMessageBox errorBox;
 | 
				
			||||||
    box->setLabelText("Enter a reason:");
 | 
					    QInputDialog input;
 | 
				
			||||||
    auto code = box->exec();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (code != QDialog::Accepted) {
 | 
					    input.setWindowFlags(Qt::WindowSystemMenuHint);
 | 
				
			||||||
      delete box;
 | 
					    input.setLabelText("Reason:");
 | 
				
			||||||
 | 
					    input.setWindowTitle("Call Moderator");
 | 
				
			||||||
 | 
					    auto code = input.exec();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (code != QDialog::Accepted)
 | 
				
			||||||
 | 
					      return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    QString text = input.textValue();
 | 
				
			||||||
 | 
					    if (text.isEmpty()) {
 | 
				
			||||||
 | 
					      errorBox.critical(nullptr, "Error", "You must provide a reason.");
 | 
				
			||||||
 | 
					      return;
 | 
				
			||||||
 | 
					    } else if (text.length() > 256) {
 | 
				
			||||||
 | 
					      errorBox.critical(nullptr, "Error", "The message is too long.");
 | 
				
			||||||
      return;
 | 
					      return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    auto text = box->textValue();
 | 
					 | 
				
			||||||
    if (text.isEmpty())
 | 
					 | 
				
			||||||
      text = "N/A";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    delete box;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    QStringList mod_reason;
 | 
					    QStringList mod_reason;
 | 
				
			||||||
    mod_reason.append(text);
 | 
					    mod_reason.append(text);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user