devto-cli icon indicating copy to clipboard operation
devto-cli copied to clipboard

A mechanism for associating a post to a Dev.to Organization

Open pabloromeo opened this issue 3 years ago • 7 comments

It appears that by default posts get created as Personal. I was wondering if there was a setting to have it default to an Organization I'm part of. You can manually edit it in Dev.to later, and all seems well with the sync later on anyways, so it isn't a blocker at the moment.

Also, I tried to get it working when the repo was private, and local assets weren't accesible so it would fail. The only options are to either have the repo public or manually upload the content somewhere public correct?

pabloromeo avatar Jan 08 '22 20:01 pabloromeo

You can try adding organization_id: <number> in your article front matter. I saw that it was recently added to the dev.to API, but it wasn't back when I pushed last update. I'll probably fully support it when I can find some time to work on it, as retrieving it from existing article needs a bit more work, and involves rethinking the reconciliation process.

Also, I tried to get it working when the repo was private, and local assets weren't accessible so it would fail. The only options are to either have the repo public or manually upload the content somewhere public correct?

Yes, you're correct. It would be nice to allow uploading assets directly to the dev.to platform, but this feature isn't currently supported by their API.

sinedied avatar Jan 12 '22 14:01 sinedied

Nice! I'll give that organization_id a shot. Thanks! Very useful tool by the way 👍

pabloromeo avatar Jan 12 '22 15:01 pabloromeo

Forgot to mention, I did try including the organization_id in front_matter, it was just ignored. Now, that might actually be an interesting approach to linking articles to organizations. Meaning, if devto-cli looked for organization_id within front-matter, and if found, included the extra organization_id paramter during creation or updates, then I believe it would link those (after validating that the user is part of the org). For reconciliation there may not be a need to worry about it though, unless you want to link an article to another organization, right? Since I think you can still issue an update on an article linked to one organization, without including any organization_id and it wouldn't alter the association nor make the article a "personal" one.

pabloromeo avatar May 05 '22 03:05 pabloromeo

Thanks for the update! I'll have a look at the cause when I get the chance, I suspect that organization_id property is filtered out before sending the message to the API, so it might just be a matter of updating the models so that property is propery passed on to the API.

sinedied avatar May 05 '22 07:05 sinedied

I tried manually editing an article in dev.to by modifying the front-matter content and adding organization_id as a property, but it ignored it too and didn't link the article. I get the feeling dev.to only supports receiving an organization_id as an extra parameter to the call, and not inlined in front-mater, unfortunately :(

pabloromeo avatar May 09 '22 19:05 pabloromeo

Hi :), I was wondering if you'd been able to look into the new api endpoints that seem to support the organization_id as arguments, to be able to publish articules linked to organizations.

pabloromeo avatar Oct 26 '22 16:10 pabloromeo

Hey, sorry for the (long) delay. I haven't got the time to look into it yet, but if you want to give it a try I'll gladly accept a PR 🙂

sinedied avatar Jan 03 '23 14:01 sinedied