Update algorithm for history visible banner. (#31577)

* feat: Update algorithm for history visible banner.

- The banner now only shows for rooms with `shared` or `worldReadable`
  history visibility.
- The banner does not show in rooms in which the current user cannot
  send messages.

* tests: Add `getHistoryVisibility` to stub room.

* docs: Add description to `visible` condition check.

* docs: Fix spelling.

Co-authored-by: Florian Duros <florian.duros@ormaz.fr>

* chore: Remove `jest-sonar.xml`.

---------

Co-authored-by: Florian Duros <florian.duros@ormaz.fr>
This commit is contained in:
Skye Elliot
2025-12-19 15:41:09 +00:00
committed by GitHub
co-authored by Florian Duros
parent aa84b2e07c
commit ce9c66ba4c
5 changed files with 91 additions and 17 deletions
@@ -16,6 +16,9 @@ export const HistoryVisibleBanner: React.FC<{
/** The room instance associated with this banner view model. */
room: Room;
/** Whether the current user can send messages in the room. */
canSendMessages: boolean;
/**
* If not null, specifies the ID of the thread currently being viewed in the thread timeline side view,
* where the banner view is displayed as a child of the message composer.
@@ -675,7 +675,11 @@ export class MessageComposer extends React.Component<IProps, IState> {
return (
<div className={classes} ref={this.ref} role="region" aria-label={_t("a11y|message_composer")}>
<HistoryVisibleBanner room={this.props.room} threadId={threadId ?? null} />
<HistoryVisibleBanner
room={this.props.room}
canSendMessages={canSendMessages}
threadId={threadId ?? null}
/>
<div className="mx_MessageComposer_wrapper">
<UserIdentityWarning room={this.props.room} key={this.props.room.roomId} />
<ReplyPreview