IDによるユーザープロフィールページは?

パブリックユーザープロフィールにユーザーIDでアクセスするルートは存在しますか?

私は以下のURLを知っています:https://meta.discourse.org/u/{username}/summary
欲しいのは:https://meta.discourse.org/u/{user-id}/summary

目的:メインサイトのプロフィールからDiscourseサイトのプロフィールへリンクさせたいと考えています。問題は、当初SSOを使用していなかったため、2つのサイト間のユーザー名が完全に一致しておらず、ユーザーがログアウト・ログインするたびに更新されていることです。古いユーザーIDを「整理」しようと試みたところ、ユーザー名を更新するエンドポイントが存在しない(メールアドレスとアバターのみ更新可能)ことに気づきました。

ユーザー名が変更されるため、代わりにidを保存しましたが、IDを使って直接プロフィールへのURLを生成できないことに気づきました。追加のWebリクエストを行わずに済ませたいと考えています。そうでなければ、ユーザー名を取得するためにby-externalエンドポイントを一度呼び出す必要がありますが、リダイレクト機能があると理想的です。

If you’re trying let users get their own profile, yo can use /my/summary/

https://meta.discourse.org/my/summary

Thanks but no, I want any user viewing a profile on my main site, to be able to click a link on that page to take them to the corresponding profile on the discourse page.

It would be great if there were a PUT endpoint for username. The use case is sites like mine which transitioned to SSO, to get all the usernames synced. Then my plan A would have just worked.

My fallback plan I think is going to be to add another column to store discourse_username also in my DB along with discourse_id. This way, I can directly to their profile with username. The downside is that this username can change. So I need to daily scan all users to re-sync.

You can make a POST request to /admin/users/sync_sso for this. If you are using the Discourse API gem, you can use the gem’s sync_sso method for this. If you are not using the gem, see Sync DiscourseConnect user data with the sync_sso route for details about setting up the request.