summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-12-28 15:49:14 -0800
committerEvan Prodromou <evan@status.net>2009-12-28 15:49:14 -0800
commit98a579fedf36ff795e255a4b345651df0ee230bc (patch)
tree2eba012e0094cced9580523051b8ed88b6aefd6b /actions
parent5f6df8c0c4274e7d900335bba87341f9768e7467 (diff)
parentfa3301cf84ee0a78c4e00c7bd309de8a769fd848 (diff)
Merge branch 'master' into 0.9.x
Diffstat (limited to 'actions')
-rw-r--r--actions/apiblockcreate.php13
-rw-r--r--actions/apiblockdestroy.php13
-rw-r--r--actions/block.php8
-rw-r--r--actions/unblock.php13
4 files changed, 37 insertions, 10 deletions
diff --git a/actions/apiblockcreate.php b/actions/apiblockcreate.php
index e79dec32d..c26485f59 100644
--- a/actions/apiblockcreate.php
+++ b/actions/apiblockcreate.php
@@ -109,9 +109,16 @@ class ApiBlockCreateAction extends ApiAuthAction
return;
}
- if ($this->user->hasBlocked($this->other)
- || $this->user->block($this->other)
- ) {
+ if (!$this->user->hasBlocked($this->other)) {
+ if (Event::handle('StartBlockProfile', array($this->user, $this->other))) {
+ $result = $this->user->block($this->other);
+ if ($result) {
+ Event::handle('EndBlockProfile', array($this->user, $this->other));
+ }
+ }
+ }
+
+ if ($this->user->hasBlocked($this->other)) {
$this->initDocument($this->format);
$this->showProfile($this->other, $this->format);
$this->endDocument($this->format);
diff --git a/actions/apiblockdestroy.php b/actions/apiblockdestroy.php
index 328f18ab0..666f308f4 100644
--- a/actions/apiblockdestroy.php
+++ b/actions/apiblockdestroy.php
@@ -97,9 +97,16 @@ class ApiBlockDestroyAction extends ApiAuthAction
return;
}
- if (!$this->user->hasBlocked($this->other)
- || $this->user->unblock($this->other)
- ) {
+ if ($this->user->hasBlocked($this->other)) {
+ if (Event::handle('StartUnblockProfile', array($this->user, $this->other))) {
+ $result = $this->user->unblock($this->other);
+ if ($result) {
+ Event::handle('EndUnblockProfile', array($this->user, $this->other));
+ }
+ }
+ }
+
+ if (!$this->user->hasBlocked($this->other)) {
$this->initDocument($this->format);
$this->showProfile($this->other, $this->format);
$this->endDocument($this->format);
diff --git a/actions/block.php b/actions/block.php
index 71a34e087..5fae45dff 100644
--- a/actions/block.php
+++ b/actions/block.php
@@ -156,7 +156,12 @@ class BlockAction extends ProfileFormAction
{
$cur = common_current_user();
- $result = $cur->block($this->profile);
+ if (Event::handle('StartBlockProfile', array($cur, $this->profile))) {
+ $result = $cur->block($this->profile);
+ if ($result) {
+ Event::handle('EndBlockProfile', array($cur, $this->profile));
+ }
+ }
if (!$result) {
$this->serverError(_('Failed to save block information.'));
@@ -164,4 +169,3 @@ class BlockAction extends ProfileFormAction
}
}
}
-
diff --git a/actions/unblock.php b/actions/unblock.php
index c60458cd3..0f63e1dae 100644
--- a/actions/unblock.php
+++ b/actions/unblock.php
@@ -71,8 +71,17 @@ class UnblockAction extends ProfileFormAction
function handlePost()
{
- $cur = common_current_user();
- $result = $cur->unblock($this->profile);
+ $cur = common_current_user();
+
+ $result = false;
+
+ if (Event::handle('StartUnblockProfile', array($cur, $this->profile))) {
+ $result = $cur->unblock($this->profile);
+ if ($result) {
+ Event::handle('EndUnblockProfile', array($cur, $this->profile));
+ }
+ }
+
if (!$result) {
$this->serverError(_('Error removing the block.'));
return;