fixed dmails

This commit is contained in:
Parziphal 2013-11-03 13:34:02 -05:00
parent 730d4d77c5
commit 734c9a2e59
2 changed files with 3 additions and 4 deletions

View File

@ -73,7 +73,6 @@ class DmailController extends ApplicationController
public function markAllRead() public function markAllRead()
{ {
vpe('a');
if ($this->params()->commit == "Yes") { if ($this->params()->commit == "Yes") {
foreach (Dmail::where("to_id = ? and has_seen = false", $this->current_user->id)->take() as $dmail) foreach (Dmail::where("to_id = ? and has_seen = false", $this->current_user->id)->take() as $dmail)
$dmail->updateAttribute('has_seen', true); $dmail->updateAttribute('has_seen', true);

View File

@ -71,17 +71,17 @@ class Dmail extends Rails\ActiveRecord\Base
} }
} }
protected function setToName($name) public function setToName($name)
{ {
if (!$user = User::where(['name' => $name])->first()) if (!$user = User::where(['name' => $name])->first())
return; return;
$this->to_id = $user->id; $this->to_id = $user->id;
} }
protected function setFromName($name) public function setFromName($name)
{ {
if (!$user = User::where(['name' => $name])->first()) if (!$user = User::where(['name' => $name])->first())
return; return;
$this->from_id = $user->id; $this->from_id = $user->id;
} }
} }