Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
retribute.me
webclient
Commits
feda5102
Verified
Commit
feda5102
authored
Jun 07, 2019
by
Eliot Berriot
Browse files
Better handling of toots date
parent
e2741625
Pipeline
#4241
passed with stages
in 1 minute and 18 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
src/sources/mastodon.js
View file @
feda5102
...
...
@@ -98,14 +98,20 @@ export default {
// results.progress = 0
// results.progressCount
results
.
accounts
=
{}
let
cont
=
true
while
(
cont
)
{
let
tooOld
=
0
let
maxOld
=
5
while
(
tooOld
<
maxOld
)
{
let
response
=
await
client
.
get
(
url
,
{
params
:
{
limit
:
40
}})
response
.
data
.
forEach
((
f
)
=>
{
let
date
=
moment
(
f
.
created_at
)
// ugly hack because we don't have any way to query favorite date, and mastodon
// return toots in reverse favorite date order, so favoriting a very old toot
// can result in little to no suggestions
if
(
date
.
isBefore
(
dateLimit
))
{
cont
=
false
return
tooOld
+=
1
}
else
{
// we reset the counter
tooOld
=
0
}
handledFavorites
+=
1
results
.
progressCount
+=
1
...
...
Write
Preview
Supports
Markdown
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