id = $data['id']; } public function processRequest() { $rule = id(new HeraldRule())->load($this->id); if (!$rule) { return new Aphront404Response(); } $request = $this->getRequest(); $user = $request->getUser(); if ($user->getPHID() != $rule->getAuthorPHID() && !$user->getIsAdmin()) { return new Aphront400Response(); } if ($request->isFormPost()) { $rule->delete(); if ($request->isAjax()) { return new AphrontRedirectResponse(); } else { return id(new AphrontRedirectResponse())->setURI('/herald/'); } } $dialog = new AphrontDialogView(); $dialog->setUser($request->getUser()); $dialog->setTitle('Really delete this rule?'); $dialog->appendChild( "Are you sure you want to delete the rule ". "'".phutil_escape_html($rule->getName())."'?"); $dialog->addSubmitButton('Delete'); $dialog->addCancelButton('/herald/'); $dialog->setSubmitURI($request->getPath()); return id(new AphrontDialogResponse())->setDialog($dialog); } }