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

masto.accounts.fetchRelationships(ids) seems to only return an array with the last relationship #672

Closed
phocks opened this issue Nov 12, 2022 · 4 comments · Fixed by #673 or #789
Closed
Labels
bug Something isn't working released

Comments

@phocks
Copy link

phocks commented Nov 12, 2022

So, I'm calling fetchRelationships with

[
  '109259555060230219', '109329757207054444',
  '109304355674436958', '109329615534159193',
  '109326675628767011', '109306590577346022',
  '108287561462886075', '109255443077468514',
  '109328121692503192', '109326834740268749',
  '109327998738635484', '109295713154642996',
  '109327922897072426', '109327974894298553',
  '109292934182266874', '109296962232647106',
  '109326691704274743', '109275934773679884',
  '108652506407775491', '109295268736323099',
  '109327706844447482', '109327678179007056',
  '109327619139006243', '109326445573511711',
  '109295112661447359', '109323599069473607',
  '109300105697281432', '109248438353050826',
  '109327107727727607', '109327046266940707',
  '108284547935566579', '109325813210365485',
  '109314959039382671', '109309388768085838',
  '109304811705682151', '108294755501880801',
  '109308974797197153', '109315419065430612',
  '109294943838818967', '109295352397166919'
]

and only getting this back

[
  {
    id: '109301500125171531',
    following: true,
    showingReblogs: true,
    notifying: false,
    languages: null,
    followedBy: true,
    blocking: false,
    blockedBy: false,
    muting: true,
    mutingNotifications: false,
    requested: false,
    domainBlocking: false,
    endorsed: false,
    note: ''
  }
]

Is it working for everyone else? Or am I just doing something wrong?

Here's my code.

for await (const batch of masto.accounts.getFollowingIterable(id, {})) {
    const idsInBatch = batch.map((account) => account.id);
    console.log(idsInBatch);
    const rels = await masto.accounts.fetchRelationships([
      "109288805396558025",
      "109301500125171531",
    ]);
    console.log(rels);
  }
@neet neet added the bug Something isn't working label Nov 12, 2022
@neet neet closed this as completed in #673 Nov 12, 2022
@github-actions
Copy link

🎉 This issue has been resolved in version 4.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@phocks
Copy link
Author

phocks commented Nov 13, 2022

Awesome @neet thanks! ✨

@eramdam
Copy link

eramdam commented Jan 4, 2023

It seems like this issue came back up with 5.x. The following code fails with 5.x

import assert from "node:assert";
import { login } from "masto";

(async () => {
  const client = await login({
    url: "https://tenforward.social",
    accessToken: "",
  });

  const ids = ["id 1", "id 2"];

  const relationships = await client.v1.accounts.fetchRelationships(ids);

  assert.strictEqual(relationships.length, ids.length);
})();

@neet neet reopened this Jan 4, 2023
neet added a commit that referenced this issue Jan 4, 2023
@neet neet closed this as completed in #789 Jan 4, 2023
github-actions bot pushed a commit that referenced this issue Jan 5, 2023
## [5.1.1](v5.1.0...v5.1.1) (2023-01-05)

### Bug Fixes

* Change searchParams type to Record ([2ae64ed](2ae64ed)), closes [#672](#672)
@github-actions
Copy link

github-actions bot commented Jan 5, 2023

🎉 This issue has been resolved in version 5.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

This was referenced Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
3 participants