cursor[bot] 9b4ab46cc2 [MM-70402] Fix Channel Settings showing unsaved changes on open for channels with untidy stored text (#38115)
* [MM-70402] Stop Channel Settings flagging untouched channels as edited

The Info tab seeds its form state from the raw channel record but diffs the
trimmed local value against the untrimmed stored value. Channel purpose and
header are persisted verbatim by the server, so any channel whose text has
surrounding whitespace (a header ending in a newline, for example) reports
unsaved changes as soon as the dialog opens, which then blocks tab switching
and closing the modal.

Compare both sides trimmed, matching what the form actually saves, and derive
the visible SaveChangesPanel and the parent's unsaved-changes flag from one
shared calculation so the two can no longer disagree.

Also read the channel name straight from props when validating on blur instead
of mirroring it into a ref that is only seeded by a passive effect, which could
report "Channel names must have at least 1 character." for a populated field.

Co-authored-by: mattermost-code <matty-code@mattermost.com>

* [MM-70402] Cover Channel Settings opening on untidy stored channel text

Co-authored-by: mattermost-code <matty-code@mattermost.com>

* [MM-70402] Strengthen coverage for Channel Settings opening state

Add a Playwright spec that opens Channel Settings on a channel whose stored
purpose and header carry surrounding whitespace and asserts the save panel is
absent and the modal closes on a single click, plus a companion spec proving a
real edit is still detected and saved. Both need purposeInput and
saveChangesPanel locators on the info settings page object.

On the unit side, validate the rendered channel name rather than a rejected
keystroke, cover the DM header-only branch, pin the whitespace-only edit as a
no-op, and assert the form settles clean once the patched channel arrives.

Co-authored-by: mattermost-code <matty-code@mattermost.com>

* [MM-70402] Cover Reset and untouched-header preservation on untidy channels

Reset used to re-seed the raw stored text and immediately recompute as dirty,
leaving the panel stuck open, and saving one field used to rewrite every other
field to its trimmed form. Pin both.

Co-authored-by: mattermost-code <matty-code@mattermost.com>

* [MM-70402] Tighten comments and assertions in the Channel Settings fix

Co-authored-by: mattermost-code <matty-code@mattermost.com>

* [MM-70402] Detect channel text changes on raw values, trim only on save

Compare the raw field values for change detection instead of trimming both
operands, so removing stored leading/trailing whitespace is a savable edit.
The form still opens cleanly on untidy stored text because each field is
seeded from the raw channel record, and the save payload is still trimmed.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: mattermost-code <matty-code@mattermost.com>
2026-08-24 18:31:50 +00:00

Mattermost logo

Mattermost is an open core, self-hosted collaboration platform that offers chat, workflow automation, voice calling, screen sharing, and AI integration. This repo is the primary source for core development on the Mattermost platform; it's written in Go and React, runs as a single Linux binary, and relies on PostgreSQL. A new compiled version is released under an MIT license every month on the 16th.

Deploy Mattermost on-premises, or try it for free in the cloud.

mattermost user interface

Learn more about the following use cases with Mattermost:

Other useful resources:

Table of contents

Install Mattermost

Other install guides:

Native mobile and desktop apps

In addition to the web interface, you can also download Mattermost clients for Android, iOS, Windows PC, macOS, and Linux.

Get Mattermost on Google Play Get Mattermost on the App Store Get Mattermost on Windows PC Get Mattermost on Mac OSX Get Mattermost on Linux

Get security bulletins

Receive notifications of critical security updates. The sophistication of online attackers is perpetually increasing. If you're deploying Mattermost it's highly recommended you subscribe to the Mattermost Security Bulletin mailing list for updates on critical security releases.

Subscribe here

Get involved

Learn more

License

See the LICENSE file for license rights and limitations.

Get the latest news

Contributing

Small Image

Please see CONTRIBUTING.md. Join the Mattermost Contributors server to join community discussions about contributions, development, and more.

S
Description
Mattermost is an open source platform for secure collaboration across the entire software development lifecycle..
Readme 2.3 GiB
Languages
TypeScript 48.2%
Go 41.4%
JavaScript 5.4%
SCSS 2.6%
HTML 2.1%
Other 0.2%