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

get_profile_linkをモデルにつけるか検討する #112

Open
yupix opened this issue Dec 5, 2023 — with Huly for GitHub · 0 comments
Open

get_profile_linkをモデルにつけるか検討する #112

yupix opened this issue Dec 5, 2023 — with Huly for GitHub · 0 comments
Assignees
Labels
kind/Feature✨ This adds/improves/enhances a feature

Comments

Copy link
Owner

yupix commented Dec 5, 2023

Summary

あんまりMisskeyに無い属性をモデルに追加したくないけど利便性を考えるとあってもいい気がする

    def get_profile_link(
        self,
        external: bool = True,
        protocol: Literal["http", "https"] = "https",
    ): 
        if not self._user:
            return None
        host = (
            f"{protocol}://{self._user.host}"
            if external and self._user.host
            else self._session._url
        )
        path = (
            f"/@{self._user.username}" if external else f"/{self._user.api.action.get_mention()}"
        )
        return host + path
@yupix yupix added the kind/Feature✨ This adds/improves/enhances a feature label Dec 5, 2023
@yupix yupix self-assigned this Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/Feature✨ This adds/improves/enhances a feature
Projects
None yet
Development

No branches or pull requests

2 participants
@yupix and others