Exemplo n.º 1
0
 public function mark_as_read()
 {
     $this->updateAttribute('has_seen', true);
     if (!Dmail::where("to_id = ? AND has_seen = false", current_user()->id)->exists()) {
         current_user()->updateAttribute('has_mail', false);
     }
 }
Exemplo n.º 2
0
 public function destroy_and_notify($current_user, $reason)
 {
     # TODO:
     if (!empty($this->creator_id) && $this->creator_id != $current_user->id) {
         $msg = "A tag implication you submitted (" . $this->predicate->name . " → " . $this->consequent->name . ") was deleted for the following reason: " . $reason;
         Dmail::create(array('from_id' => current_user()->id, 'to_id' => $this->creator_id, 'title' => "One of your tag implications was deleted", 'body' => $msg));
     }
     $this->destroy();
 }
Exemplo n.º 3
0
 public function markAllRead()
 {
     if ($this->params()->commit == "Yes") {
         foreach (Dmail::where("to_id = ? and has_seen = false", $this->current_user->id)->take() as $dmail) {
             $dmail->updateAttribute('has_seen', true);
         }
         $this->current_user->updateAttribute('has_mail', false);
         $this->respond_to_success("All messages marked as read", ['action' => "inbox"]);
     } else {
         $this->redirectTo("#inbox");
     }
 }
Exemplo n.º 4
0
 public function destroy_and_notify($current_user, $reason)
 {
     if ($this->creator_id && $this->creator_id != $current_user->id) {
         $msg = "A tag alias you submitted (" . $this->name . " → " . $this->alias_name() . ") was deleted for the following reason: " . $reason;
         Dmail::create(array('from_id' => current_user()->id, 'to_id' => $this->creator_id, 'title' => "One of your tag aliases was deleted", 'body' => $msg));
     }
     $this->destroy();
 }