Finish implementing ignoring users that were already suggested.

The ability to remember users that were suggested was there, but it was missing the part about skipping those users.
main
Jesus P Rey (Chuso) 2023-08-30 13:44:16 +02:00
parent 3fcfdb95d5
commit 87d1b74cba
No known key found for this signature in database
GPG Key ID: 0E663E0721D67C24
1 changed files with 8 additions and 0 deletions

View File

@ -63,6 +63,9 @@ parser = ArgumentParser(
epilog="https://git.chuso.net/chuso/mastoroulette")
parser.add_argument("-u", "--update-cache",
action="store_true", help="Update the cache")
parser.add_argument("-i", "--ignore-repeats",
action="store_true",
help="Allows suggesting users that were already suggested in the past")
args = parser.parse_args()
# A forced update was not requested
@ -98,6 +101,11 @@ for f in followers:
# We use the `uri` field to compare users because that field is assumed to be unique
if [u for u in followings if u["uri"] == f["uri"]]:
continue
# For users that were already suggested, we check the id which is assumed
# to be immutable (but instance-specific) as opposed to uri that can change
# if the user migrated to a differnt instance
if not args.ignore_repeats and f["id"] not in suggested:
continue
print(f["url"])