Multiple comment submissions for a diff is prevented now.

Summary:
It was possible to submit a comment multiple times if the submit
button was pressed more than once quickly. Added javascript code
that disables the button when it is clicked.

Test Plan:
Tried to click the button multiple times very quickly, but the
button was disabled after the first click.

Reviewed By: epriestley
Reviewers: epriestley, jungejason
Commenters: aran
CC: aran, epriestley, tuomaspelkonen
Differential Revision: 337
This commit is contained in:
tuomaspelkonen
2011-05-23 14:33:54 -07:00
parent 3dd12e7cc6
commit d21a056f1c
4 changed files with 66 additions and 0 deletions

View File

@@ -284,6 +284,18 @@ celerity_register_resource_map(array(
),
'disk' => '/rsrc/js/application/core/behavior-tokenizer.js',
),
'javelin-behavior-aphront-form-disable-on-submit' =>
array(
'uri' => '/res/6c659ede/rsrc/js/application/core/behavior-form.js',
'type' => 'js',
'requires' =>
array(
0 => 'javelin-behavior',
1 => 'javelin-stratcom',
2 => 'javelin-dom',
),
'disk' => '/rsrc/js/application/core/behavior-form.js',
),
'javelin-behavior-dark-console' =>
array(
'uri' => '/res/044c171f/rsrc/js/application/core/behavior-dark-console.js',

View File

@@ -64,6 +64,11 @@ final class AphrontFormView extends AphrontView {
public function render() {
require_celerity_resource('aphront-form-view-css');
Javelin::initBehavior(
'aphront-form-disable-on-submit',
array());
return javelin_render_tag(
'form',
array(

View File

@@ -7,6 +7,7 @@
phutil_require_module('phabricator', 'infrastructure/celerity/api');
phutil_require_module('phabricator', 'infrastructure/javelin/api');
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
phutil_require_module('phabricator', 'view/base');