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
209
Issues
209
List
Boards
Labels
Service Desk
Milestones
Merge Requests
29
Merge Requests
29
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
b8d55a17
Commit
b8d55a17
authored
40 minutes ago
by
Emiliano Balbuena
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(feat): Pro homepage content aggregator
parent
218a2fe9
epic/minds-pro
1 merge request
!292
WIP: (feat): Minds Pro (development branch) - Release 2
Pipeline
#76026244
passed with stages
in 10 minutes and 34 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
6 deletions
+30
-6
channel.php
Controllers/api/v2/feeds/channel.php
+6
-0
Manager.php
Core/Feeds/Top/Manager.php
+2
-1
Repository.php
Core/Feeds/Top/Repository.php
+22
-5
No files found.
Controllers/api/v2/feeds/channel.php
View file @
b8d55a17
...
...
@@ -61,6 +61,9 @@ class channel implements Interfaces\Api
$type
=
'group'
;
$container_guid
=
null
;
break
;
case
'all'
:
$type
=
'all'
;
break
;
}
//
...
...
@@ -101,6 +104,8 @@ class channel implements Interfaces\Api
$forcePublic
=
(
bool
)
(
$_GET
[
'force_public'
]
??
false
);
$exclude
=
explode
(
','
,
$_GET
[
'exclude'
]
??
''
);
$query
=
null
;
if
(
isset
(
$_GET
[
'query'
]))
{
...
...
@@ -134,6 +139,7 @@ class channel implements Interfaces\Api
'query'
=>
$query
,
'single_owner_threshold'
=>
0
,
'pinned_guids'
=>
$type
===
'activity'
?
array_reverse
(
$container
->
getPinnedPosts
())
:
null
,
'exclude'
=>
$exclude
,
];
if
(
isset
(
$_GET
[
'nsfw'
]))
{
...
...
This diff is collapsed.
Click to expand it.
Core/Feeds/Top/Manager.php
View file @
b8d55a17
...
...
@@ -96,6 +96,7 @@ class Manager
'filter_hashtags'
=>
false
,
'pinned_guids'
=>
null
,
'as_activities'
=>
false
,
'exclude'
=>
null
,
],
$opts
);
if
(
isset
(
$opts
[
'query'
])
&&
$opts
[
'query'
])
{
...
...
@@ -107,7 +108,7 @@ class Manager
$response
=
new
Response
(
$result
);
return
$response
;
}
}
$feedSyncEntities
=
[];
$scores
=
[];
...
...
This diff is collapsed.
Click to expand it.
Core/Feeds/Top/Repository.php
View file @
b8d55a17
...
...
@@ -53,6 +53,7 @@ class Repository
'exclude_moderated'
=>
false
,
'moderation_reservations'
=>
null
,
'pinned_guids'
=>
null
,
'exclude'
=>
null
,
],
$opts
);
if
(
!
$opts
[
'type'
])
{
...
...
@@ -67,6 +68,8 @@ class Repository
throw
new
\Exception
(
'Unsupported period'
);
}
$type
=
$opts
[
'type'
];
$body
=
[
'_source'
=>
array_unique
([
'guid'
,
...
...
@@ -75,7 +78,7 @@ class Repository
'time_created'
,
'access_id'
,
'moderator_guid'
,
$this
->
getSourceField
(
$
opts
[
'type'
]
),
$this
->
getSourceField
(
$
type
),
]),
'query'
=>
[
'function_score'
=>
[
...
...
@@ -98,7 +101,7 @@ class Repository
'sort'
=>
[],
];
/*if ($
opts['type']
=== 'group' && false) {
/*if ($
type
=== 'group' && false) {
if (!isset($body['query']['function_score']['query']['bool']['must_not'])) {
$body['query']['function_score']['query']['bool']['must_not'] = [];
}
...
...
@@ -107,7 +110,7 @@ class Repository
'access_id' => ['0', '1', '2'],
],
];
} elseif ($
opts['type']
=== 'user') {
} elseif ($
type
=== 'user') {
$body['query']['function_score']['query']['bool']['must'][] = [
'term' => [
'access_id' => '2',
...
...
@@ -236,7 +239,7 @@ class Repository
}
}
if
(
$
opts
[
'type'
]
!==
'group'
&&
$opts
[
'access_id'
]
!==
null
)
{
if
(
$
type
!==
'group'
&&
$opts
[
'access_id'
]
!==
null
)
{
$body
[
'query'
][
'function_score'
][
'query'
][
'bool'
][
'must'
][]
=
[
'terms'
=>
[
'access_id'
=>
Text
::
buildArray
(
$opts
[
'access_id'
]),
...
...
@@ -294,6 +297,14 @@ class Repository
}
}
if
(
$opts
[
'exclude'
])
{
$body
[
'query'
][
'function_score'
][
'query'
][
'bool'
][
'must_not'
][]
=
[
'terms'
=>
[
'guid'
=>
Text
::
buildArray
(
$opts
[
'exclude'
]),
],
];
}
// firehose options
...
...
@@ -338,9 +349,15 @@ class Repository
//
$esType
=
$opts
[
'type'
];
if
(
$esType
===
'all'
)
{
$esType
=
'object:image,object:video,object:blog'
;
}
$query
=
[
'index'
=>
$this
->
index
,
'type'
=>
$
opts
[
'type'
]
,
'type'
=>
$
esType
,
'body'
=>
$body
,
'size'
=>
$opts
[
'limit'
],
'from'
=>
$opts
[
'offset'
],
...
...
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