Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Backend - Engine
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
216
Issues
216
List
Boards
Labels
Service Desk
Milestones
Merge Requests
31
Merge Requests
31
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Backend - Engine
Commits
b9e36ab7
Commit
b9e36ab7
authored
1 day ago
by
Juan Manuel Solaro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(feat) top feeds should be filter by created time
parent
ba39424c
epic/post-scheduler
1 merge request
!294
WIP: epic/post-scheduler
Pipeline
#77085347
failed with stages
in 4 minutes and 17 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
Repository.php
Core/Feeds/Top/Repository.php
+18
-1
No files found.
Core/Feeds/Top/Repository.php
View file @
b9e36ab7
...
...
@@ -29,10 +29,11 @@ class Repository
/**
* @param array $opts
* @param bool $filter_by_created_time
* @return \Generator|ScoredGuid[]
* @throws \Exception
*/
public
function
getList
(
array
$opts
=
[])
public
function
getList
(
array
$opts
=
[]
,
bool
$filter_by_time_created
=
true
)
{
$opts
=
array_merge
([
'offset'
=>
0
,
...
...
@@ -53,6 +54,7 @@ class Repository
'exclude_moderated'
=>
false
,
'moderation_reservations'
=>
null
,
'pinned_guids'
=>
null
,
'time_created_upper'
=>
$filter_by_time_created
?
time
()
:
null
,
],
$opts
);
if
(
!
$opts
[
'type'
])
{
...
...
@@ -254,6 +256,21 @@ class Repository
];
}
// Filter by time created to cut out scheduled feeds
if
(
$opts
[
'time_created_upper'
])
{
if
(
!
isset
(
$body
[
'query'
][
'function_score'
][
'query'
][
'bool'
][
'must'
]))
{
$body
[
'query'
][
'function_score'
][
'query'
][
'bool'
][
'must'
]
=
[];
}
$body
[
'query'
][
'function_score'
][
'query'
][
'bool'
][
'must'
][]
=
[
'range'
=>
[
'time_created'
=>
[
'lte'
=>
(
int
)
$opts
[
'time_created_upper'
],
],
],
];
}
//
if
(
$opts
[
'query'
])
{
$words
=
explode
(
' '
,
$opts
[
'query'
]);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment