Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions hub/procedures/channel/channel_get_message.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
DELIMITER $

-- =========================================================
-- channel_get_message
--
-- One workspace or folder chat message by id, for the mobile push worker to
-- quote in a banner at delivery time. Mirrors `p2p_get_message` in the
-- drumate schema: the push queue carries only identifiers, so the text is
-- read here, once, when the notification is composed. A trashed message is
-- not returned, so a deleted message is never quoted after the fact.
-- =========================================================
DROP PROCEDURE IF EXISTS `channel_get_message`$
CREATE PROCEDURE `channel_get_message`(
IN _message_id VARCHAR(16) CHARACTER SET ascii
)
BEGIN
SELECT message_id, author_id, message, thread_id, attachment
FROM channel
WHERE message_id = _message_id AND status != 'trashed';
END $

DELIMITER ;
1 change: 1 addition & 0 deletions patches/manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -305,3 +305,4 @@
patches/funnel_backfill.sql
yellow_page/tables/feature_usage.sql
yellow_page/procedures/analytics/feature_mark.sql
hub/procedures/channel/channel_get_message.sql

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Deploy the lookup to existing organization workspaces

When this manifest is applied, the hub/ prefix makes bin/patch-from-manifest select the hub target, while bin/patch.js::select_schemas restricts that target to entities whose type is exactly hub. Existing organization workspaces are pooled hub databases that organisation_create retypes to organization, so they still contain workspace channels but never receive channel_get_message; the push worker's lookup will therefore fail with a missing procedure for messages from those workspaces. Deploy this routine to both hub and organization schemas, as the common target already does for shared routines.

Useful? React with 👍 / 👎.