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. 🙂

|
Embed
pratik
pratik

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

|
Embed
maique
maique

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

|
Embed
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

|
Embed
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?

|
Embed
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.

|
Embed
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.

|
Embed
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

|
Embed
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.

|
Embed
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.

|
Embed
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.

|
Embed
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.

|
Embed
pratik
pratik

@crossingthethreshold Can you share the list of your categories?

|
Embed
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.

|
Embed
odd
odd

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

|
Embed
crossingthethreshold
crossingthethreshold

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

|
Embed
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.

|
Embed
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

|
Embed
crossingthethreshold
crossingthethreshold

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

|
Embed
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.

|
Embed
pratik
pratik

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

|
Embed
crossingthethreshold
crossingthethreshold

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

|
Embed
pratik
pratik

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

|
Embed
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?

|
Embed
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.

|
Embed
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.

|
Embed
Miraz
Miraz

@crossingthethreshold 😆

|
Embed
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.

|
Embed
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

|
Embed
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

|
Embed
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.

|
Embed
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.

|
Embed
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.

|
Embed
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. 🤔

|
Embed
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.

|
Embed
donnydavis
donnydavis

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

|
Embed
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

|
Embed
donnydavis
donnydavis

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

|
Embed
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.

|
Embed
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.

|
Embed
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?

|
Embed
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

|
Embed
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.

|
Embed
JohnPhilpin
JohnPhilpin

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

|
Embed
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.

|
Embed
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.

|
Embed
crossingthethreshold
crossingthethreshold

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

|
Embed
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.

|
Embed
crossingthethreshold
crossingthethreshold

@donnydavis Thank you.

|
Embed
crossingthethreshold
crossingthethreshold

@donnydavis I might have an early Christmas present for you....An update on your Drafts action. I decided to return to it this morning and went back through my category list. I found another one made up of two words. With some editing I replaced it with a one word category. So now all my category are one word. I then used the test version of your Draft action to make a post to Micro.blog and my blog.....and it worked!

|
Embed
pratik
pratik

@crossingthethreshold Awesome. Not to make things confusing but I do have a couple of categories with two words in them and it had worked for me. Anyway, I’m glad everything is now working for you

|
Embed
crossingthethreshold
crossingthethreshold

@pratik 🤦🏼‍♂️Hahaha. And here is me thinking that I had got to the bottom of it. As you say though, it’s working now.

|
Embed
donnydavis
donnydavis

@crossingthethreshold that is so awesome to hear. I’m glad that it’s finally working again. 😃 Was it just on that test version that it’s working or does it work on the regular version as well? Just curious before I see if there is anything that I can combine between the two to keep it working.

|
Embed
crossingthethreshold
crossingthethreshold

@donnydavis I haven’t tested the regular version yet. I’ve been bathing in the goodness of the test version 😁. I shall do so and get back to you.

|
Embed
crossingthethreshold
crossingthethreshold

@donnydavis I have just used the regular version of your action to make a new post, and it worked just fine. So both the test & regular versions have worked.

|
Embed
donnydavis
donnydavis

@crossingthethreshold that is so good to hear. 😃🎉 Please let me know if you see any other weird behavior or issues.

|
Embed
crossingthethreshold
crossingthethreshold

@donnydavis Will do!

|
Embed
jemostrom
jemostrom

@donnydavis I'm playing around drafts and different actions, tried your micro.blog action and see something that looks wrong. I have three sites and they are all listed when I run the action but the categories are always from the same site (the last one that is listed). Am I missing something or is it a known problem?

|
Embed