Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Frontend
Project
Project
Details
Activity
Releases
Dependency List
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
800
Issues
800
List
Boards
Labels
Service Desk
Milestones
Merge Requests
59
Merge Requests
59
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Packages
Packages
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 Frontend
Commits
9e55994e
Commit
9e55994e
authored
6 minutes ago
by
Mark Harding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(fix): cast to activities if in top feeds
parent
9f1dc904
master
No related merge requests found
Pipeline
#70505601
running with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
3 deletions
+31
-3
entities.service.ts
src/app/common/services/entities.service.ts
+15
-1
feeds.service.ts
src/app/common/services/feeds.service.ts
+15
-2
sorted.component.ts
src/app/modules/newsfeed/feeds/sorted.component.ts
+1
-0
No files found.
src/app/common/services/entities.service.ts
View file @
9e55994e
...
...
@@ -17,6 +17,7 @@ type EntityObservables = Map<string, EntityObservable>
export
class
EntitiesService
{
entities
:
EntityObservables
=
new
Map
<
string
,
EntityObservable
>
();
castToActivites
:
boolean
=
false
;
constructor
(
protected
client
:
Client
,
...
...
@@ -91,6 +92,16 @@ export class EntitiesService {
return
this
.
entities
.
get
(
urn
);
}
/**
* Cast to activities or not
* @param cast boolean
* @return EntitiesService
*/
setCastToActivities
(
cast
:
boolean
):
EntitiesService
{
this
.
castToActivites
=
cast
;
return
this
;
}
/**
* Fetch entities
* @param urns string[]
...
...
@@ -99,7 +110,10 @@ export class EntitiesService {
async
fetch
(
urns
:
string
[]):
Promise
<
Array
<
Object
>>
{
try
{
const
response
:
any
=
await
this
.
client
.
get
(
'
api/v2/entities/
'
,
{
urns
});
const
response
:
any
=
await
this
.
client
.
get
(
'
api/v2/entities/
'
,
{
urns
,
as_activities
:
this
.
castToActivites
?
1
:
0
,
});
if
(
!
response
.
entities
.
length
)
{
for
(
const
urn
of
urns
)
{
...
...
This diff is collapsed.
Click to expand it.
src/app/common/services/feeds.service.ts
View file @
9e55994e
...
...
@@ -41,6 +41,7 @@ export class FeedsService {
pageSize
:
Observable
<
number
>
;
endpoint
:
string
=
''
;
params
:
any
=
{
sync
:
1
};
castToActivities
:
boolean
=
false
;
rawFeed
:
BehaviorSubject
<
Object
[]
>
=
new
BehaviorSubject
([]);
feed
:
Observable
<
BehaviorSubject
<
Object
>
[]
>
;
...
...
@@ -64,7 +65,9 @@ export class FeedsService {
switchMap
(
async
feed
=>
{
return
feed
.
slice
(
0
,
await
this
.
pageSize
.
pipe
(
first
()).
toPromise
())
}),
switchMap
(
feed
=>
this
.
entitiesService
.
getFromFeed
(
feed
)),
switchMap
(
feed
=>
this
.
entitiesService
.
setCastToActivities
(
this
.
castToActivities
)
.
getFromFeed
(
feed
)),
tap
(
feed
=>
{
if
(
feed
.
length
)
// We should have skipped but..
this
.
inProgress
.
next
(
false
);
...
...
@@ -103,9 +106,19 @@ export class FeedsService {
return
this
;
}
setCastToActivities
(
cast
:
boolean
):
FeedsService
{
this
.
castToActivities
=
cast
;
return
this
;
}
fetch
():
FeedsService
{
this
.
inProgress
.
next
(
true
);
this
.
client
.
get
(
this
.
endpoint
,
{...
this
.
params
,
...{
limit
:
150
}})
// Over 12 scrolls
this
.
client
.
get
(
this
.
endpoint
,
{
...
this
.
params
,
...{
limit
:
150
,
// Over 12 scrolls
as_activities
:
this
.
castToActivities
?
1
:
0
,
}})
.
then
((
response
:
any
)
=>
{
this
.
inProgress
.
next
(
false
);
this
.
rawFeed
.
next
(
response
.
entities
);
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/newsfeed/feeds/sorted.component.ts
View file @
9e55994e
...
...
@@ -214,6 +214,7 @@ export class NewsfeedSortedComponent implements OnInit, OnDestroy {
nsfw
,
})
.
setLimit
(
12
)
.
setCastToActivities
(
true
)
.
fetch
();
}
catch
(
e
)
{
...
...
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