1
0
mirror of https://github.com/flarum/core.git synced 2025-10-18 18:26:07 +02:00

went over most of the changed attributes from the other pr

This commit is contained in:
Daniel Klabbers
2018-04-17 14:22:38 +02:00
parent efa3b62fb8
commit a2927b725f
21 changed files with 122 additions and 106 deletions

View File

@@ -23,7 +23,7 @@ class DiscussionSearch extends AbstractSearch
/**
* {@inheritdoc}
*/
protected $defaultSort = ['lastTime' => 'desc'];
protected $defaultSort = ['lastPostedAt' => 'desc'];
/**
* @var array

View File

@@ -54,6 +54,6 @@ class AuthorGambit extends AbstractRegexGambit
$ids[] = $this->users->getIdForUsername($username);
}
$search->getQuery()->whereIn('start_user_id', $ids, 'and', $negate);
$search->getQuery()->whereIn('user_id', $ids, 'and', $negate);
}
}

View File

@@ -37,9 +37,9 @@ class CreatedGambit extends AbstractRegexGambit
// provided with a YYYY-MM-DD..YYYY-MM-DD range, then find discussions
// that were started during that period.
if (empty($matches[3])) {
$search->getQuery()->whereDate('start_time', $negate ? '!=' : '=', $matches[1]);
$search->getQuery()->whereDate('created_at', $negate ? '!=' : '=', $matches[1]);
} else {
$search->getQuery()->whereBetween('start_time', [$matches[1], $matches[3]], 'and', $negate);
$search->getQuery()->whereBetween('created_at', [$matches[1], $matches[3]], 'and', $negate);
}
}
}

View File

@@ -34,9 +34,9 @@ class HiddenGambit extends AbstractRegexGambit
$search->getQuery()->where(function ($query) use ($negate) {
if ($negate) {
$query->whereNull('hide_time')->where('comments_count', '>', 0);
$query->whereNull('hidden_at')->where('comment_count', '>', 0);
} else {
$query->whereNotNull('hide_time')->orWhere('comments_count', 0);
$query->whereNotNull('hidden_at')->orWhere('comment_count', 0);
}
});
}

View File

@@ -53,9 +53,9 @@ class UnreadGambit extends AbstractRegexGambit
$search->getQuery()->where(function ($query) use ($readIds, $negate, $actor) {
if (! $negate) {
$query->whereNotIn('id', $readIds)->where('last_time', '>', $actor->read_time ?: 0);
$query->whereNotIn('id', $readIds)->where('last_posted_at', '>', $actor->marked_all_as_read_at ?: 0);
} else {
$query->whereIn('id', $readIds)->orWhere('last_time', '<=', $actor->read_time ?: 0);
$query->whereIn('id', $readIds)->orWhere('last_posted_at', '<=', $actor->marked_all_as_read_at ?: 0);
}
});
}