Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Hide UI elements through window postmessage #31184

Merged
merged 23 commits into from
Jan 8, 2024
Merged

Conversation

gabriellsh
Copy link
Member

@gabriellsh gabriellsh commented Dec 7, 2023

Proposed changes (including videos or screenshots)

Made possible to hide some UI elements through the window.postMessage event.

Initial supported UI elements are:
Composer Toolbar
Room Toolbar
Message Toolbar
User actions toolbar

Issue(s)

CE-46

Steps to test or reproduce

Further comments

Example call to hide all UI elements

window.postMessage({
    event: 'overrideUi',
    hideActions: {
        roomToolbox:[
			'channel-settings',
			'team-info',
			'user-info-group',
			'user-info',
			'thread',
			'calls',
			'canned-responses',
			'clean-history',
			'contact-chat-history',
			'contact-profile',
			'discussions',
			'export-messages',
			'keyboard-shortcut-list',
			'members-list',
			'mentions',
			'otr',
			'pinned-messages',
			'push-notifications',
			'rocket-search',
			'room-info',
			'starred-messages',
			'start-call',
			'team-channels',
			'uploaded-files-list',
			'voip-room-info',
		],
		messageToolbox: [
			'reaction-message',
			'quote-message',
			'reply-in-thread',
			'forward-message',
			'reply-directly',
			'follow-message',
			'pin-message',
			'star-message',
			'permalink',
			'copy',
			'edit-message',
			'delete-message',
		],
		composerToolbox: [
			'video-message',
			'audio-message',
			'file-upload',
			'create-discussion',
			'webdav-add',
			'share-location'
		],
		userToolbox: [
			'openDirectMessage',
			'changeOwner',
			'changeLeader',
			'changeModerator',
			'openModerationConsole',
			'ignoreUser',
			'muteUser',
			'reportUser',
			'removeUser',
		],
    }
})

Copy link

changeset-bot bot commented Dec 7, 2023

🦋 Changeset detected

Latest commit: 93ca176

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
Name Type
@rocket.chat/meteor Minor
@rocket.chat/ui-contexts Major
@rocket.chat/fuselage-ui-kit Major
@rocket.chat/gazzodown Major
@rocket.chat/ui-client Major
@rocket.chat/ui-video-conf Major
@rocket.chat/uikit-playground Patch
@rocket.chat/web-ui-registration Major
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/livechat Patch
@rocket.chat/core-typings Minor
@rocket.chat/rest-typings Minor
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/model-typings Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/api-client Patch
@rocket.chat/license Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/ddp-client Patch
@rocket.chat/models Patch
@rocket.chat/instance-status Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

codecov bot commented Dec 7, 2023

Codecov Report

Attention: 44 lines in your changes are missing coverage. Please review.

Comparison is base (2fa8055) 49.47% compared to head (93ca176) 49.55%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #31184      +/-   ##
===========================================
+ Coverage    49.47%   49.55%   +0.08%     
===========================================
  Files         3312     3314       +2     
  Lines        81379    81447      +68     
  Branches     16659    16663       +4     
===========================================
+ Hits         40260    40364     +104     
+ Misses       36416    36372      -44     
- Partials      4703     4711       +8     
Flag Coverage Δ
e2e 53.07% <70.66%> (+0.18%) ⬆️
e2e-api 40.70% <ø> (+0.03%) ⬆️
unit 76.67% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@gabriellsh gabriellsh marked this pull request as ready for review December 7, 2023 18:09
@gabriellsh gabriellsh requested a review from a team as a code owner December 7, 2023 18:09
…hideUi

* 'develop' of github.com:RocketChat/Rocket.Chat: (21 commits)
  chore: Rename useFileInput to useSingleFileInput (#31186)
  regression: FED-116 allow to invite rc users to fed channels (#30658)
  refactor: Remove `livechat.js` file (#31179)
  test: Fix Analytics test to use always same date (#31178)
  chore: notify messages on emails incoming and outgoing (#30925)
  chore: add msg stream to the federation v1 feature (#31105)
  chore: update editedBy when the user changes their username (following BE rules) (#31098)
  chore: add a manual msg stream update for autotranslate (#31094)
  chore: send streaming msg update on livechat decline call event (#31025)
  chore: Replace `IconButton` in favor of `Button` on `PageHeader` (#31171)
  refactor: Migrate `analytics.js` to service (#31051)
  feat: Add `push.info` endpoint to retrieve push gateway info (#30868)
  chore: Convert Importer classes to typescript (#29714)
  docs: fix lost image render in markdown (#31013)
  feat(uikit): Move `@rocket.chat/ui-kit` package to the main monorepo (#31138)
  i18n: Language update from LingoHub 🤖 on 2023-12-05Z (#31161)
  feat: Skip to main content shortcut and `useDocumentTitle` (#30680)
  chore: Replace `useForm` in favor of RHF on Omnichannel `AgentsEdit` (#30789)
  chore: ImageGallery tweaks (#31159)
  fix: New `custom-roles` license module isn't properly checked (#31153)
  ...
@scuciatto scuciatto added this to the 6.6 milestone Dec 12, 2023
…hideUi

* 'develop' of github.com:RocketChat/Rocket.Chat: (112 commits)
  chore: update yarn.lock
  chore: Replace `FramedIcon` in favor of fuselage component (#31356)
  chore: fix dep version
  Release 6.5.2
  fix: wrong value used for workspace registration
  ci: update release PR description with change log
  fix: inquiries being limited to 50 items (#31267)
  fix: close image gallery on backdrop click (#31344)
  fix: No error message when uploading a file that is not allowed (#31346)
  fix: Text area only shows the last line of the message for very long texts #31252 #31257 (#31262)
  chore: adding new streamer event for imported messages (#31063)
  chore: adapt read receipts feature to work without oplog on msgs (#30996)
  chore: remove Messages model dependency of Rooms model (#31272)
  chore: `Card` normalization (#31335)
  refactor: unify useStream and useSingleStream (#31326)
  chore: add new msg stream for reported msgs (#31087)
  Bump 6.5.2
  feat: Highlight words in thread messages (#31281)
  fix: Show only departments that are allowed on registration page on livechat widget (#31302)
  fix: Fallback forward department not working as expected on chat forwarding (#31296)
  ...
gabriellsh and others added 5 commits January 5, 2024 17:49
…hideUi

* 'develop' of github.com:RocketChat/Rocket.Chat:
  chore: add gitpod config file for quick setup (#30921)
  feat: Allow user to set timeout of outgoing webhook (#31222)
  feat: added modal confirmation before pinning message (#31348)
  fix: not being able to access or create rooms with join code (#31270)
  chore: services changes on lifecycle methods + throw if svc is not available (#31375)
  test: bump playwright (#31376)
  i18n: update translations (#29462)
  i18n: adds video call translations for Persian language (#30406)
  regression: `AppRow` bundleIn verification (#31373)
  feat: Add Desktop PDF viewer (#31279)
  fix: Attachments not collapsing when using incoming webhook (#31318)
  chore: add aria-label to Select Inputs at Engagement Dashboard (#31249)
  fix: engagement dashboard timezone selector (#31248)
@dionisio-bot dionisio-bot bot added stat: ready to merge PR tested and approved waiting for merge and removed stat: needs QA labels Jan 8, 2024
@dionisio-bot dionisio-bot bot added stat: ready to merge PR tested and approved waiting for merge and removed stat: ready to merge PR tested and approved waiting for merge labels Jan 8, 2024
@kodiakhq kodiakhq bot merged commit b2b0035 into develop Jan 8, 2024
44 checks passed
@kodiakhq kodiakhq bot deleted the new/hideUi branch January 8, 2024 18:25
@MHFDoge
Copy link

MHFDoge commented Feb 14, 2024

Small question, Is there a reason this was introduced strictly for users who embed via iframe, and not just made to work with the existing role-based permission system? I have personally run into several issues over multiple years with things on my workspace that could be quickly solved if a variation of this feature was made available to those who use the standard web interface provided by the server application itself.

@gabriellsh
Copy link
Member Author

@MHFDoge it's actually not exclusive to iframe, you can use it anywhere you can inject a custom script. This comes from common user requests that try to embed rocket.chat in another application, so it fits this need without being to complex. Coupling the UI to the role-based permission system is not something we want to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat: QA skipped stat: ready to merge PR tested and approved waiting for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants