Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tweak(ext/cfx-ui): allow automated accounts for servers feeds #2987

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TheIndra55
Copy link
Contributor

Goal of this PR

While debugging an issue with a user on the forums, noticed that accounts marked as "Automated" in Mastodon fail to load in the servers feeds. This is because these accounts are returned as type Service in the ActivityPub response, while the code only checks for Person currently.

How is this PR achieving the goal

Allows ActivityPub users with both Person and Service type.

This PR applies to the following area(s)

CfxUI

Successfully tested on

Game builds: N/A

Platforms: Windows

Checklist

  • Code compiles and has been tested successfully.
  • Code explains itself well and/or is documented.
  • My commit message explains what the changes do and what they are for.
  • No extra compilation warnings are added by these changes.

Fixes issues

@github-actions github-actions bot added the triage Needs a preliminary assessment to determine the urgency and required action label Dec 7, 2024
@outsider31000
Copy link
Contributor

Hmm this could explain why mine doesn't show.

@dalekenium-cfx dalekenium-cfx added status:needs planning Hard issues that take time as there's no 'one' obvious way. and removed triage Needs a preliminary assessment to determine the urgency and required action labels Dec 9, 2024
@@ -171,7 +171,7 @@ export class ActiveActivityPubFeed {
},
});

if (!isObject<IActivityPubAccount>(account) || account.type !== 'Person') {
if (!isObject<IActivityPubAccount>(account) || !(account.type === 'Person' || account.type === 'Service')) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having one negation for the whole condition would make it more readable in my opinion:

if (!(isObject<IActivityPubAccount>(account) && (account.type === 'Person' || account.type === 'Service'))) {
    throw new Error(`Unknown or invalid account for pub ${this.id}`);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:needs planning Hard issues that take time as there's no 'one' obvious way.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants