Add option to disable Mattermost Threads (collapsed reply threads)

Prompts on fresh/new installs and writes MM_SERVICESETTINGS_COLLAPSEDTHREADS
into .env; update reruns read the existing value back instead of
re-prompting, since it may have been changed later via System Console.
Documents the setting and how to flip it later in the generated README.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GKXTDG1ivYASN9fvDZ9Rfv
This commit is contained in:
Claude
2026-08-17 03:01:46 +00:00
parent 9a6d4899a2
commit 093062488d
+29
View File
@@ -294,6 +294,7 @@ install_mattermost() {
if [ "$DRY_RUN" = true ]; then if [ "$DRY_RUN" = true ]; then
echo "[DRY-RUN] Would create $DIR with docker-compose.yml" echo "[DRY-RUN] Would create $DIR with docker-compose.yml"
echo "[DRY-RUN] Would prompt whether to disable the Threads feature (collapsed reply threads)"
echo "[DRY-RUN] Would write .env with DB and Mattermost secrets" echo "[DRY-RUN] Would write .env with DB and Mattermost secrets"
echo "[DRY-RUN] Would create data/ logs/ config/ plugins/ db/ subdirectories" echo "[DRY-RUN] Would create data/ logs/ config/ plugins/ db/ subdirectories"
echo "[DRY-RUN] Would run this instance's own dedicated coturn container for TURN, with a relay" echo "[DRY-RUN] Would run this instance's own dedicated coturn container for TURN, with a relay"
@@ -406,6 +407,23 @@ install_mattermost() {
prompt_text "Mattermost site URL [$SITE_URL]:" "$SITE_URL" CONFIGURED_SITEURL prompt_text "Mattermost site URL [$SITE_URL]:" "$SITE_URL" CONFIGURED_SITEURL
[[ -n "$CONFIGURED_SITEURL" ]] && SITE_URL="$CONFIGURED_SITEURL" [[ -n "$CONFIGURED_SITEURL" ]] && SITE_URL="$CONFIGURED_SITEURL"
# ── Threads (Collapsed Reply Threads) ───────────────────────────────────
# Only asked on a fresh/new install — an update run reads the existing
# choice back from .env instead of re-prompting, same reasoning as
# WEB_PORT/CALLS_UDP_PORT above: this is a live setting some installs
# will have deliberately changed post-install via System Console, and an
# update run silently reverting that on every rerun would be surprising.
local MM_COLLAPSED_THREADS_VAL="default_on"
if [ "$MODE" = "update" ] && [ -f "$DIR/.env" ]; then
local _existing_threads
_existing_threads="$(grep '^MM_SERVICESETTINGS_COLLAPSEDTHREADS=' "$DIR/.env" 2>/dev/null | cut -d= -f2-)"
[ -n "$_existing_threads" ] && MM_COLLAPSED_THREADS_VAL="$_existing_threads"
else
local _DISABLE_THREADS=""
prompt_yn "Disable the Threads feature (collapsed reply threads)? (y/n):" "n" _DISABLE_THREADS
[[ "$_DISABLE_THREADS" =~ ^[Yy]$ ]] && MM_COLLAPSED_THREADS_VAL="disabled"
fi
# Mirrors configure_caddy_for_service's own mode resolution (lib/common.sh): # Mirrors configure_caddy_for_service's own mode resolution (lib/common.sh):
# explicit CADDY_MODE from the site config wins, then a local ~/docker/caddy, # explicit CADDY_MODE from the site config wins, then a local ~/docker/caddy,
# then the legacy CADDY_REMOTE_HOST var. Only "local" joins caddy_net — a # then the legacy CADDY_REMOTE_HOST var. Only "local" joins caddy_net — a
@@ -586,6 +604,8 @@ MM_SERVICESETTINGS_LISTENADDRESS=:${WEB_PORT}
MM_SERVICESETTINGS_ENABLELOCALMODE=true MM_SERVICESETTINGS_ENABLELOCALMODE=true
MM_FILESETTINGS_DRIVERNAME=local MM_FILESETTINGS_DRIVERNAME=local
MM_PLUGINSETTINGS_ENABLE=true MM_PLUGINSETTINGS_ENABLE=true
# Threads (collapsed reply threads): default_on | default_off | always_on | disabled
MM_SERVICESETTINGS_COLLAPSEDTHREADS=$MM_COLLAPSED_THREADS_VAL
# ── TURN/STUN (Calls plugin) ───────────────────────────────── # ── TURN/STUN (Calls plugin) ─────────────────────────────────
$( [ "$USE_EMBEDDED_COTURN" = true ] \ $( [ "$USE_EMBEDDED_COTURN" = true ] \
@@ -712,6 +732,15 @@ user in multiple teams can still DM anyone across all of them, not just the
team currently open. If you need real isolation between groups rather than team currently open. If you need real isolation between groups rather than
a tidier picker, that means separate Mattermost instances, not this setting. a tidier picker, that means separate Mattermost instances, not this setting.
## Threads (collapsed reply threads)
$( [ "$MM_COLLAPSED_THREADS_VAL" = "disabled" ] \
&& echo "Disabled at install time — replies show inline in the channel instead of a separate Threads view." \
|| echo "Enabled (\`$MM_COLLAPSED_THREADS_VAL\`) — replies open in a separate Threads view/panel." )
Change later at **System Console → Site Configuration → Posts → Collapsed
Reply Threads**, or by editing \`MM_SERVICESETTINGS_COLLAPSEDTHREADS\` in
\`.env\` (\`disabled\` to turn Threads off, \`default_on\` for the normal
behavior) and running \`docker compose up -d\` to apply it.
## Voice/Video Calls (Calls plugin) ## Voice/Video Calls (Calls plugin)
Port ${CALLS_UDP_PORT}/udp must be open on your router/firewall. Port ${CALLS_UDP_PORT}/udp must be open on your router/firewall.