フォロー通知を実装しました#104
Merged
Merged
Conversation
Member
|
todo: notification timelineだけでなく、通常messageの表示箇所でもfollowAckを表示できるようにする |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resolve #96
フォロー通知を実装しました
背景
フォロー通知が今まで無かったのは、association のつけ先(entity / profile / ack)が定まっていなかったため。ととがんまさんの判断で ack ドキュメントの
ccfs://を対象につける 方針に決定したので、それを実装しました。仕組み
client.Acknowledge(to)が従来どおり ack ドキュメントを commit し、戻り値のSignedDocument.ccfsを取得するccfsをassociateにしたkind: 'association'のフォロー association を作成distributesに自分の activity-timeline と相手の notify-timeline を指定して commit(fav / reaction と同じ通知経路)NotificationTimelineがこの association を拾い、「○○さんがあなたをフォローしました」として表示するack 本体と通知用 association を分離しているのは、ack を social graph のプリミティブとして純粋に保ちつつ、通知配信は fav / reaction と同じ「association → distributes」の仕組みに乗せるため。
変更点
worldlib
schemas.ts:followAssociation: 'https://schema.concrnt.world/a/follow.json'を追加schemas/followAssociation.ts: 新規。FollowAssociationSchema型(likeAssociation に倣いprofileOverride?のみ)schemas/index.ts: 上記を re-exportclient.ts:Acknowledgeに、ack commit 後のフォロー association 生成・配信処理を追加。通知の commit 失敗はフォロー自体に影響させない(ack は成立済みなので catch してログのみ)app/src, web/src(両方に同じ変更)
components/NotificationTimeline.tsx:Schemas.followAssociationを schema 分岐に追加。集約せず 1 件ずつ表示するため$followサフィックスでキー化FollowNotificationコンポーネントを追加(人追加アイコン + フォロワーのアバター + 文言、タップで相手のプロフィールへ)useStack().push(<ProfileView />)、web はnavigate('/profile/:ccid')と、導線のみ差分設計判断(レビュー観点)
a/follow.json: 既存 association(a/*.json)に揃えました。ack 本体はschema.concrnt.net/acknowledge.jsonで名前空間が別なので衝突しません。main固定: フォローは entity 単位だが notify-timeline は profile 単位。fav の|| 'main'フォールバックに合わせました。動作確認