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

enhance(frontend): Shareページでの投稿完了時にpostMessageを発火するように #12505

Merged
merged 7 commits into from
Nov 29, 2023

Conversation

kakkokari-gtyih
Copy link
Contributor

@kakkokari-gtyih kakkokari-gtyih commented Nov 29, 2023

What

shareページの投稿フォームで「ノート」をクリックして正常に投稿されると、postMessageが発火される

iframeや名前付きポップアップでシェアページを開いている場合は、親サイト側で以下のようなコードを実装するとイベントを受信してよしなに対応できる

const iframeEl = document.getElementById("misskey_share_iframe");

iframeEl.addEventListener("message", (event) => {
    if (event.origin !== INSTANCE_DOMAIN) return;

    if (event.data?.type === 'misskey:shareForm:shareComplete') {
        // 正常に投稿できたら行う動作
        // ※event.data には payload プロパティがあるが、これは将来のために予約されているもの
        //  このメソッドでは使用しない
    }
  },
  false,
);

Why

Fix #12504

Additional info (optional)

Checklist

  • Read the contribution guide
  • Test working in a local environment
  • (If needed) Add story of storybook
  • (If needed) Update CHANGELOG.md
  • (If possible) Add tests

@github-actions github-actions bot added the packages/frontend Client side specific issue/PR label Nov 29, 2023
Copy link

codecov bot commented Nov 29, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (ea1a2dc) 78.67% compared to head (8773b05) 78.64%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #12505      +/-   ##
===========================================
- Coverage    78.67%   78.64%   -0.03%     
===========================================
  Files          950      949       -1     
  Lines       103367   103240     -127     
  Branches      8328     8328              
===========================================
- Hits         81322    81195     -127     
  Misses       22045    22045              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@syuilo syuilo merged commit 37cff40 into misskey-dev:develop Nov 29, 2023
15 checks passed
@syuilo
Copy link
Member

syuilo commented Nov 29, 2023

👍

@kakkokari-gtyih kakkokari-gtyih deleted the feat-12504 branch December 8, 2023 06:34
camilla-ett pushed a commit to kaseiski/misskey that referenced this pull request Jan 2, 2024
…2505)

* enhance(frontend): Shareページでの投稿完了時にpostMessageを発火

* Update Changelog

* fix

* 名前の混同をさける

* 名前をわかりやすくする

* watchを使わずパフォーマンス改善
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages/frontend Client side specific issue/PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shareページでの投稿完了時にpostMessageを発火する
2 participants