Skip to content

feat: Notes & Albums support - #225

Merged
highesttt merged 2 commits into
mainfrom
highest/plat-38153
Jul 27, 2026
Merged

feat: Notes & Albums support#225
highesttt merged 2 commits into
mainfrom
highest/plat-38153

Conversation

@highesttt

Copy link
Copy Markdown
Collaborator

No description provided.

@linear-code

linear-code Bot commented Jul 27, 2026

Copy link
Copy Markdown

PLAT-38153

@indent-zero

indent-zero Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor
PR Summary

Adds support for bridging LINE "post notifications" (Notes & Albums) into Matrix as notice events, so users no longer see LINE's silent-drop for native contentType=16 or the misleading "Your version of LINE doesn't support this type of message." fallback for shared posts.

  • Adds ContentPostNotification = 16 to the ContentType enum in pkg/connector/consts.go.
  • Introduces isPostNotification and extends isBridgeableContentType so both native (contentType=16) and shared (ORGCONTP=POSTNOTIFICATION) post notifications are let through in pkg/connector/handle_message.go.
  • Dispatches recognized post notifications to a new handlers.ConvertPostNotification before the ORGCONTP/CALL and text fallback paths.
  • Adds pkg/connector/handlers/post_notification.go, which renders a Matrix MsgNotice body driven by serviceType (GB note / AB album / default), plus optional text preview and postEndUrl deep link.
  • Adds unit tests for classification, convertLineMessage dispatch (ensuring the LINE fallback text is not leaked), and per-serviceType rendering in ConvertPostNotification.

Issues

1 potential issue found:

  • Nit: The msg == nil guard inside isPostNotification is unreachable from production callers — isBridgeableContentType already nil-checks and convertLineMessage passes &data. Only the "nil message" test entry exercises it, so the guard can be dropped for simplicity. → Autofix
2 issues already resolved
  • Nit: ConvertPostNotification only sets Body, so the embedded Open in LINE: <postEndUrl> will render as plain text in Matrix clients that don't auto-linkify. Adding a matching FormattedBody with an <a href="..."> (mirroring how other handlers emit rich content) keeps the deep link clickable. (fixed by commit 30bb1bb)
  • Latent: The decrypt-failure early exit in convertLineMessage fires before the new isPostNotification dispatch, so a shared post (contentType=0 + ORGCONTP=POSTNOTIFICATION) whose encrypted body fails to decrypt returns the generic "Unable to decrypt" notice instead of the unencrypted metadata preview. Trigger is narrow (shared post delivered via E2EE with a decrypt miss), but moving the isPostNotification(&data) check above the decrypt-failure branch preserves the preview. (fixed by commit 30bb1bb)

CI Checks

All CI checks passed for commit 30bb1bb.


⚡ Autofix All Issues

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 137ea808-a445-4be1-9092-049332d2eefc

📥 Commits

Reviewing files that changed from the base of the PR and between bcfbc2a and 30bb1bb.

📒 Files selected for processing (4)
  • pkg/connector/handle_message.go
  • pkg/connector/handle_message_test.go
  • pkg/connector/handlers/post_notification.go
  • pkg/connector/handlers/post_notification_test.go
🚧 Files skipped from review as they are similar to previous changes (4)
  • pkg/connector/handlers/post_notification_test.go
  • pkg/connector/handlers/post_notification.go
  • pkg/connector/handle_message.go
  • pkg/connector/handle_message_test.go
📜 Recent review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: build-docker
  • GitHub Check: Lint with 1.25
  • GitHub Check: Lint with 1.25
  • GitHub Check: build-docker

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added support for LINE post and album notifications.
    • Displays notification previews, album updates, and links to open full details in LINE.
    • Supports shared post notifications embedded in text messages.
  • Bug Fixes
    • Prevented supported post notifications from being shown as unsupported message types.
    • Improved handling when notification details or preview text are unavailable.

Walkthrough

LINE post notifications, including shared notifications embedded in text metadata, are now classified as bridgeable and converted through a dedicated Matrix notice handler. The conversion formats previews, album names, and LINE links, with tests covering classification, dispatch, and output structure.

Changes

Post notification conversion

Layer / File(s) Summary
Post notification notice converter
pkg/connector/handlers/post_notification.go, pkg/connector/handlers/post_notification_test.go
Adds ConvertPostNotification, which creates Matrix notice messages from post and album metadata, with preview and URL fallback handling.
Post notification classification and dispatch
pkg/connector/handle_message.go, pkg/connector/handle_message_test.go, pkg/connector/consts.go
Recognizes native and metadata-wrapped post notifications, routes them before ordinary content handling, and tests the resulting classification and conversion path.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant LINE as LINE message
  participant Client as LineClient
  participant Handler as Handler
  participant Matrix as Matrix notice

  LINE->>Client: provide post notification
  Client->>Client: classify content type and metadata
  Client->>Handler: call ConvertPostNotification
  Handler->>Matrix: construct MsgNotice with preview and link
  Matrix-->>Client: return ConvertedMessage
Loading

Possibly related PRs

  • beeper/line#218: Both changes modify convertLineMessage dispatch logic in pkg/connector/handle_message.go.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided, so there is no meaningful summary to evaluate. Add a brief description of the main behavior changes and any important implementation details.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change set: support for LINE notes and albums via post-notification handling.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch highest/plat-38153

Comment @coderabbitai help to get the list of available commands.

Comment thread pkg/connector/handle_message.go Outdated
Comment thread pkg/connector/handlers/post_notification.go Outdated
func isPostNotification(msg *line.Message) bool {
if msg == nil {
return false
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Redundant nil guard.

isPostNotification is only called from (1) isBridgeableContentType, which already returns early on msg == nil, and (2) convertLineMessage, which always passes &data (never nil). The guard is only exercised by the "nil message" table entry in handle_message_test.go. Safe to remove for symmetry with queueIncomingMessage's existing invariants, or keep as defensive — either way, minor.

@highesttt highesttt changed the title feat: Notes & Albumbs support feat: Notes & Albums support Jul 27, 2026
@highesttt
highesttt merged commit 46b92d1 into main Jul 27, 2026
10 checks passed
@highesttt
highesttt deleted the highest/plat-38153 branch July 27, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant