Skip to content

Commit

Permalink
Fixed fix #192
Browse files Browse the repository at this point in the history
  • Loading branch information
Parziphal committed Aug 14, 2016
1 parent b009bb7 commit 04dfa53
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 21 deletions.
18 changes: 9 additions & 9 deletions app/controllers/TagSubscriptionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ protected function filters()
]
];
}

public function create()
{
$this->response()->headers()->setContentType('text/javascript');
$this->setLayout(false);

if ($this->request()->isPost()) {
if (current_user()->tag_subscriptions->size() >= CONFIG()->max_tag_subscriptions) {
$this->tag_subscription = null;
} else {
$this->tag_subscription = TagSubscription::create(['user_id' => current_user()->id, 'tag_query' => '']);
$this->tag_subscription = TagSubscription::create(['user_id' => current_user()->id, 'tag_query' => '', 'name' => 'new tagsub']);
}
}
}

public function update()
{
if ($this->request()->isPost()) {
Expand All @@ -37,24 +37,24 @@ public function update()
}
}
}

$this->notice("Tag subscriptions updated");
$this->redirectTo('user#edit');
}

public function index()
{
$this->tag_subscriptions = current_user()->tag_subscriptions;
}

public function destroy()
{
$this->response()->headers()->setContentType('text/javascript');
$this->setLayout(false);

if ($this->request()->isPost()) {
$this->tag_subscription = TagSubscription::find($this->params()->id);

if (current_user()->has_permission($this->tag_subscription)) {
$this->tag_subscription->destroy();
}
Expand Down
12 changes: 0 additions & 12 deletions app/models/TagSubscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,4 @@ static public function process_all()
}
}
}

protected function validations()
{
return [
'name' => [
'length' => ['minimum' => 1]
],
'tag_query' => [
'length' => ['minimum' => 1]
],
];
}
}

0 comments on commit 04dfa53

Please sign in to comment.