Update to latest commit from Parziphal
This commit is contained in:
parent
a37ad9a625
commit
bb9d01f924
@ -99,20 +99,21 @@ class CommentController extends ApplicationController
|
||||
$query = Comment::order('id desc');
|
||||
$search_query = explode(' ', $this->params()->query);
|
||||
$search_terms = array();
|
||||
$user_search = false;
|
||||
|
||||
foreach ($search_query as $s) {
|
||||
if (!$s) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strpos($s, 'user:') === 0 && strlen($s) > 5) {
|
||||
if (!$user_search && strpos($s, 'user:') === 0 && strlen($s) > 5) {
|
||||
list($search_type, $param) = explode(':', $s);
|
||||
|
||||
if ($user = User::where(['name' => $param])->first()) {
|
||||
$query->where('user_id = ?', $user->id);
|
||||
} else {
|
||||
$query->where('false');
|
||||
$user_search = true;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -121,8 +122,7 @@ class CommentController extends ApplicationController
|
||||
|
||||
if ($search_terms) {
|
||||
$query->where('body LIKE ?', '%' . implode('%', $search_terms) . '%');
|
||||
} else {
|
||||
# MI: this query makes no sense, it will return nothing.
|
||||
} elseif (!$user_search) {
|
||||
$query->where('false');
|
||||
}
|
||||
|
||||
|
@ -3,8 +3,12 @@
|
||||
<?= $this->tag('meta', array('property' => 'og:title', 'content' => $this->html_title())) ?>
|
||||
<?= $this->tag('meta', array('property' => 'og:type', 'content' => 'article')) ?>
|
||||
<?= $this->tag('meta', array('property' => 'og:url', 'content' => $this->urlFor(array('post#show', 'id' => $this->post->id, 'only_path' => false)))) ?>
|
||||
<?= $this->tag('meta', array('property' => 'og:image', 'content' => $this->post->sample_url())) ?>
|
||||
<?= $this->tag('meta', array('property' => 'og:site_name', 'content' => CONFIG()->app_name)) ?>
|
||||
<?= $this->tag('meta', array('property' => 'og:description', 'content' => $this->post->tags())) ?>
|
||||
<?php # Reddit Thumbnail ?>
|
||||
<?= $this->tag('link', array('rel' => 'image_src', 'href' => $this->post->sample_url())) ?>
|
||||
<?php
|
||||
if (CONFIG()->can_see_post(current_user(), $this->post)) {
|
||||
echo $this->tag('link', array('rel' => 'image_src', 'href' => $this->post->sample_url()));
|
||||
echo $this->tag('meta', array('property' => 'og:image', 'content' => $this->post->sample_url()));
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user