mirror of
https://github.com/cypht-org/cypht.git
synced 2026-04-25 04:56:03 +03:00
[PR #1498] feat(frontend/backend): add emoji reaction support for email messages #1561
Labels
No labels
2fa
I18N
PGP
Security
Security
account
advanced_search
advanced_search
announcement
api_login
authentication
awaiting feedback
blocker
bug
bug
bug
calendar
config
contacts
core
core
devops
docker
docs
duplicate
dynamic_login
enhancement
epic
feature
feeds
framework
github
github
gmail_contacts
good first issue
help wanted
history
history
imap
imap_folders
inline_message
installation
keyboard_shortcuts
keyboard_shortcuts
ldap_contacts
mobile
need-ssh-access
new module set
nux
pop3
profiles
pull-request
question
refactor
release
research
saved_searches
smtp
strategic
tags
tests
themes
website
wordpress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/cypht#1561
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cypht-org/cypht/pull/1498
Author: @Revisto
Created: 5/1/2025
Status: 🔄 Open
Base:
master← Head:feature/emoji-reactions📝 Commits (5)
d461392feat(frontend/backend): add emoji reaction support for email messages73e9720fix(imap): remove unnecessary error logging in Hm_IMAP class6a1795ffeat(smtp): implement send_smtp_message function and refactor email sending logic to avoid repeated code8f86948Merge remote-tracking branch 'origin/master' into feature/emoji-reactions0b7149cMerge remote-tracking branch 'origin/master' into feature/emoji-reactions📊 Changes
18 files changed (+1189 additions, -45 deletions)
View changed files
📝
lib/js_libs.php(+1 -0)📝
modules/core/handler_modules.php(+1 -1)📝
modules/core/hm-mailbox.php(+22 -0)📝
modules/core/output_modules.php(+16 -0)📝
modules/imap/handler_modules.php(+273 -0)📝
modules/imap/hm-imap.php(+181 -11)📝
modules/imap/setup.php(+23 -10)📝
modules/imap/site.css(+32 -0)📝
modules/imap/site.js(+162 -0)📝
modules/smtp/functions.php(+27 -0)📝
modules/smtp/hm-mime-message.php(+102 -0)📝
modules/smtp/modules.php(+250 -21)📝
modules/smtp/setup.php(+11 -1)📝
modules/smtp/site.js(+55 -0)➕
modules/themes/assets/reactions-dark.css(+15 -0)📝
modules/themes/modules.php(+15 -1)📝
modules/themes/setup.php(+1 -0)➕
third_party/emoji-mart/browser.js(+2 -0)📄 Description
This PR adds emoji reactions to email messages, similar to how modern messaging apps work, but for emails. Users can now react with emojis to emails they receive, and see reactions from others.
Features
Implementation Details
Frontend
Backend
text/vnd.google.email-reaction+jsonMIME partsTechnical Approach
The implementation follows the Gmail Email Reactions Format specification, which provides a standardized way to handle emoji reactions to email messages. These reactions are implemented as specialized MIME-formatted emails with the following key characteristics:
Message Format
MIME Structure: Each reaction is a multipart MIME message with three content parts:
text/plainpart containing fallback text for clients without reaction supporttext/vnd.google.email-reaction+jsonpart containing the structured reaction datatext/htmlpart with HTML-formatted fallback contentSpecial Content Type: The reaction data is stored in a dedicated MIME part with content type
text/vnd.google.email-reaction+jsonJSON Format: The reaction part contains JSON with two required fields:
Message References: Each reaction includes an
In-Reply-Toheader referencing the Message-ID of the original email.Limitations
The implementation enforces several recommended limits:
Screenshots
Basic Interface with Add Reaction Button
An email message with the "Add reaction" button visible at the bottom.
Emoji Picker Interface
The emoji picker overlay provides a searchable interface with categories and recent emojis.
Multiple Reactions in Dark Mode
Dark mode view showing multiple emoji reactions applied to a message, with counts indicating how many users reacted with each emoji.
Reaction Tooltips for User Information
Hovering over a reaction displays a tooltip showing the names/emails of users who reacted with that emoji.
Emoji Picker in Dark Mode
The emoji picker automatically adapts to dark mode when a dark theme is active.
Localization Support
Demonstration of localization support: the emoji picker displays in French when the user's locale is set to French.
File Changes
Third-Party Integration
third_party/emoji-mart/browser.js: Added emoji-mart browser library for emoji selection UIlib/js_libs.php: Added emoji-mart to JS_LIBS definition for proper loadingCore System Extensions
modules/core/handler_modules.php: Modified Content Security Policy to allow connections tocdn.jsdelivr.netfor emoji-mart resourcesmodules/core/hm-mailbox.php: Addedget_message_parts_content()andget_message_structures()methods to support batch operationsIMAP Protocol Extensions
modules/imap/handler_modules.php: ImplementedHm_Handler_imap_message_reactionsto search for reaction messages by:text/vnd.google.email-reaction+jsonmodules/imap/hm-imap.php: Added optimized batch operations:get_message_structures(): Fetches message structures in a single requestget_message_parts_content(): Retrieves multiple message parts in a single requestdecode_message_part_content(): Centralizes decoding logic for both single and batch operationsmodules/imap/setup.php: Addedajax_imap_message_reactionsendpoint and registeredreactionsoutputSMTP Integration
modules/smtp/hm-mime-message.php: CreatedHm_Reaction_MIME_Msgclass for formatting reaction emailsmodules/smtp/modules.php: ImplementedHm_Handler_send_message_reactionto:modules/smtp/setup.php: Addedajax_send_message_reactionendpoint and registered reaction parametersFrontend Components
modules/imap/site.js: Implemented UI handling for message reactions:modules/imap/site.css: Added styling for message reaction componentsmodules/smtp/site.js: Implemented reaction sending with duplicate prevention and limits (max 20)Theming Support
modules/themes/assets/reactions-dark.css: Added dark theme styling for reaction UImodules/themes/modules.php: Added logic to determine which themes are dark and pass theme mode informationmodules/themes/setup.php: Registered theme mode module to all pagesmodules/core/output_modules.php: AddedHm_Output_theme_modeto expose theme mode (dark/light) to front-end for emoji-martDiscussion Points
Reaction Visibility: Should reaction messages be filtered out as separate emails? In the April 2025 Cypht meeting, we decided to show them as both visual reactions and separate email messages to ensure transparency. Are there better approaches we should consider?
Search Performance: Currently, finding reactions requires searching through all folders, which can be time-consuming for accounts with many folders. Does anyone have ideas for optimizing this?
Restriction to only Gmail? As discussed in the 2025 April Cypht meeting, we decided anyone can react to emails from everyone, since the reactions are shown as separate understandable emails so if the user's client doesn't support reactions, they still can get the meaning.
Issues
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.