Micro.blog

donnydavis
donnydavis

@pratik @crossingthethreshold @maique Hey guys. Sorry for the delay on this, this week didn’t go quite how I’d hoped. I just pushed an update to the Drafts action. This should resolve the issues with updating and I’m hoping that it also fixes the issue with the categories not showing. 🤞🏼

I’m stilll thinking about some tweaks to the tag setup, but figured I would get this update pushed out first to help y’all out. Let me know how this works out for y’all. 🙂

pratik
pratik

@donnydavis @crossingthethreshold @maique Woo hoo! Yup! Categories now showing up, and updating posts working. Thanks a lot! I really appreciate it.

maique
maique

@donnydavis Everything working fine, thank you for the update.

crossingthethreshold
crossingthethreshold

@donnydavis It appears that I was not as lucky as @pratik & @maique. I got the following error after installing the new version,

Script Error: TypeError: undefined is not an object (evaluating 'mbClient.categories.length') Line number: 32, Column 25

donnydavis
donnydavis

@crossingthethreshold are you seeing this when creating a new post or updating? Do you still have the same number of categories as before?

crossingthethreshold
crossingthethreshold

@donnydavis When creating a new post. I have the same number of categories as before - 33 🤦🏻‍♂️. I only use about 2% of them now, but don't want to delete categories that I don't use as I believe that I'll delete the corresponding posts...and it would take time.

donnydavis
donnydavis

@crossingthethreshold that line of code that is referenced, is just checking how many categories that you have to determine if it shows the category selection. So it looks like something is silently failing before and it’s not populating the categories array correctly. 🤔

When you open the actions sidebar, there is an icon at the top that is an arrow. This is the action log. Can you open that and look at the most recent failure? It’ll have a list of messages there. I’m curious if the logging captured anything useful.

crossingthethreshold
crossingthethreshold

@donnydavis I just had a look at the log. Not much more there, though maybe something that will help you with the debug?

Script step completed.
Script step completed.
Script step completed.
Script Error: TypeError: undefined is not an object (evaluating 'mbClient.categories.length')
Line number: 32, Column 25

donnydavis
donnydavis

@crossingthethreshold cool, thanks. I’ll have a look as soon as I’m back home and see if I can figure this out.

crossingthethreshold
crossingthethreshold

@donnydavis Thank you. No rush at all. I don’t know if it matters, but I ran it on the Mac version of Drafts.

donnydavis
donnydavis

@crossingthethreshold that’s good to know. I never think about that. My Mac is outdated and stuck on Monterey, so I don’t use it that often. Which OS version are you running? That shouldn’t matter, but you never know.

crossingthethreshold
crossingthethreshold

@donnydavis I’m on the current version. All up to date - apps and OS.

I just tried your action on iOS and got the same error.

pratik
pratik

@crossingthethreshold Can you share the list of your categories?

crossingthethreshold
crossingthethreshold

@pratik Here within the micro.blog timeline? Why would you want to see them? I myself don't use most of them now, they are a left over from my earlier blogging days.

odd
odd

@crossingthethreshold Could it be a category name with more than 25 characters?

crossingthethreshold
crossingthethreshold

@odd It could be…except none are longer than 25 characters 😉

pratik
pratik

@crossingthethreshold @odd It's failing at this line in the fourth script:

`

if (mbClient.categories.length > 0) { prompt.addSelect("categories", "Categories", mbClient.categories, mbClient.post.categories, true);

`

Perhaps an errant category is causing an issue? A blank one since it checks if the length is greater than zero? Just spitballing here.

crossingthethreshold
crossingthethreshold

@pratik I just took a look at the categories. Two are made up of two words (and so have a space between those words), and one has a hyphen.
@donnydavis @odd

crossingthethreshold
crossingthethreshold

@pratik BTW, thank you for exploring this issue that I am having with the action.

crossingthethreshold
crossingthethreshold

@donnydavis I don't know if this is of any help? I have been using this action to post to Micro.blog for many years. It lists the categories in a blog before posting.

pratik
pratik

@crossingthethreshold I have a couple with a space too. Change the one with the hyphen and check again.

crossingthethreshold
crossingthethreshold

@pratik Is it possible to do a search & replace on a whole MB website? Perhaps with MarsEdit?
@miraz @danielpunkass

pratik
pratik

@crossingthethreshold I meant, go to the Categories page and change it there.

crossingthethreshold
crossingthethreshold

@pratik I just wondered if I changed the “spelling” of the category on the Categories page, does it change the spelling across the website? And if not, do I end up with inaccessible (or something) categories?

Miraz
Miraz

@crossingthethreshold @danielpunkass I'm not sure of your exact question here but I think not. You seem to be wanting to change the category of a number of posts. Mars Edit would make it easy to find all posts in Category A and then you could open each post, change the Category to B and publish the change.

crossingthethreshold
crossingthethreshold

@Miraz You've read my requirements spot on and your suggestion makes sense. Thank you. I contacted you as I see you as the MB MarsEdit expert 😉...aside from @danielpunkass of course.

Miraz
Miraz

@crossingthethreshold 😆

devilgate
devilgate

@Miraz Am I missing something in MarsEdit? How would you find all the posts in a category? I see you can order them by category, but that's not the same.

Miraz
Miraz

@devilgate Well… that's what I was thinking of. In my case I very very rarely assign more than one category to a post. I guess if you routinely did that things could get more complicated. At this point it may be a question better answered by @danielpunkass

crossingthethreshold
crossingthethreshold

@pratik Well I finally got around to your suggestion. I had not too many posts with the hyphened category and so added to new category without the hyphen and assigned them to the relevant posts. I then tried the Draft action for a new post, but got the same error.
@donnydavis

pratik
pratik

@crossingthethreshold I don't think it matters if you are using it for a new post or not. I think the error pops up when it pulls up the list of categories you have.

crossingthethreshold
crossingthethreshold

@pratik I don’t know enough about scripting (read: haven’t sat down to try to understand what is going on here), but this action has never had a problem with my category list.

pratik
pratik

@crossingthethreshold me neither. I'm shooting in the dark and trying to make sense.

@donnydavis has this code about categories in his action which I assume is giving you problems.

if (mbClient.categories.length > 0) { prompt.addSelect("categories", "Categories", mbClient.categories, mbClient.post.categories, true); }

The action you linked above has this code:

if (categories.length > 0) { p.addSelect("categories", "Categories", categories, [], true); }

Back up the original action and swap out the relevant bits with the code that works and see if it fixes things. Otherwise just wait for smarter minds than me to chime in.

donnydavis
donnydavis

@crossingthethreshold Hey David. How did you create the categories with the hyphens? I think that might be a key. If I try to add a category with a hyphen on the web it automatically strips out the hyphen and doesn’t allow it. 🤔

crossingthethreshold
crossingthethreshold

@donnydavis From my memory I created it using the Micro.blog backend. It might have been imported in from a previous blog of mine? I’m really not sure.

Either way, that one category no longer exists. I removed it, replacing it with a category with no hyphen. Despite removing it, I am still getting the same error with the action.

donnydavis
donnydavis

@crossingthethreshold I just pushed an update. Wanna try and see how that works? It’s based on the comment that @pratik made. 🤞🏼

crossingthethreshold
crossingthethreshold

@donnydavis Thank you for following this up. Give me a little while and I will get to it. It’s Thursday evening here, and I’m with family.
@pratik

donnydavis
donnydavis

@crossingthethreshold no worries. It’s 20:00 here as well. I just got my daughter down to sleep, so I completely understand. 🙂

crossingthethreshold
crossingthethreshold

@donnydavis Well I have partial good news on your Draft action. I can now post using the action, but the list of categories is not displaying.

donnydavis
donnydavis

@crossingthethreshold that’s what I was afraid of. Based on the error, for some reason it isn’t loading the categories correctly. It feels like something with the data is getting corrupted in the response or it is always returning no categories. 🤔 If you’re ok with it, then I can see about logging the response to see what the data actually looks like and maybe that helps to see what is happening with the categories.

crossingthethreshold
crossingthethreshold

@donnydavis I’m happy with that if it helps with the debugging. Is there anything that I need to do from my end?

donnydavis
donnydavis

@crossingthethreshold I created a copy of the draft action and included the logging step. It just prints out the response data from the request to retrieve the categories. This will be in the same place as the other loggings that you checked on for me the other day. Using that arrow icon in the top of the actions sidebar.

Here’s a link to the action, it’s not publicly available in the directory. This way we can use it for testing without breaking anything on the main action. Once we get everything sorted, I’ll copy over the changes. 🙂

directory.getdrafts.com/a/2NQ

crossingthethreshold
crossingthethreshold

@donnydavis Thank you. I’ve installed it and will let you know the results once I have used it to make a post.

JohnPhilpin
JohnPhilpin

@donnydavis just spotted this … and replies look positive … thankyou

crossingthethreshold
crossingthethreshold

@donnydavis So I’ve just used the test action to post to my blog. This is the report,

Script step completed. Script step completed. Script step completed. HTTP.request Failed: 202, Unknown error Script step completed. Tags "blog" assigned. Draft archived

Please let me know if there is any more information that you need.

donnydavis
donnydavis

@crossingthethreshold very interesting. Wasn’t expecting a 202 status code, but that would explain it. I’m not treating that as an error in my code. I’m gonna open up a post on the micro.blog support forums and see if they can tell what is triggering that error in the request.

crossingthethreshold
crossingthethreshold

@donnydavis OK, sounds good. What is a 202 status code?

donnydavis
donnydavis

@crossingthethreshold I’ve never dealt with it specifically, but looks like it’s related to the request itself succeeding, but the actual processing of the data was not finished. I guess it’s dealing with batch behaviors.

I tagged you in the forum post as well.

crossingthethreshold
crossingthethreshold

@donnydavis Thank you.