Why lock all threads?

just because Discourse offers you to lock all threads does not mean that you have to do that. Just a reminder, in case you were not aware of it. Some software presets/defaults are actually very bad, poor and feckless, as some have noticed by now.

Locking essentially everything is super counter-productive, if one may say so. But some people like doing it for some ulterior motive.

I don’t really know why this is set, or if it was done intentionally or not, if there was any decision behind it it was certainly made a very long time ago.

I would be happy to experiment with not locking but I can’t find the setting inside Discourse’s vast array of settings, do you happen to know where it is?

I think the only thing to watch out for is for lesser experienced users creating their posts as unrelated replies to ancient threads, whereas if they would have been forced to open a new thread that would have resulted in improved organisation of information.

I looked at our (internal) task tracker and it was I who requested this change, and yes, that was the reason.

A few months later I increased this to 4 weeks because it became clear that 7 days’ inactivity was too quick.

It’s not in the main vast array of settings! It’s buried in the moderate array of per-category settings. There is no way to change it for all categories without using the Discourse API. Here is a script:

#!/usr/bin/env python3
import os
import requests
import time

BASE = 'https://community.endlessos.com/'
HOURS_PER_DAY = 24
DAYS_PER_WEEK = 7
UPDATE = {
    'auto_close_hours': 4 * DAYS_PER_WEEK * HOURS_PER_DAY,
    'auto_close_based_on_last_post': True,
}


def update_categories(session, params=None, depth=0):
    response = session.get(BASE + 'categories', params=params or {})
    response.raise_for_status()
    children = response.json()['category_list']['categories']

    time.sleep(1)

    for child in children:
        update_category(session, child, depth)


def update_category(session, category, depth=0):
    print('  ' * depth, '-', category['id'], category['name'])

    category.update(UPDATE)
    response = session.put(
        '{}categories/{}'.format(BASE, category['id']),
        params=category,
    )
    response.raise_for_status()

    time.sleep(1)

    update_categories(
        session,
        params={'parent_category_id': category['id']},
        depth=depth + 1,
    )


def main():
    username = os.environ['DISCOURSE_API_USERNAME']
    key = os.environ['DISCOURSE_API_KEY']
    s = requests.session()
    s.headers.update({'Accept': 'application/json'})
    s.params.update({'api_key': key, 'api_username': username})

    print("Updating every category on", BASE, "with", UPDATE)

    update_categories(s)


if __name__ == '__main__':
    main()

So we’d need to adjust that to either increase the limit, or find out what the flag is to disable the feature entirely, if any. (Set auto_close_hours to 0?)

There is an option in the “Solved” plugin we have in the instance to auto-close some time after a thread is marked as solved. Perhaps that would be preferable?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.