Skip to content

BPO "GH-5195" MouseOver ToolTip text References "GH-15194" #129

Closed

Description

@sweeneyde

At https://bugs.python.org/msg397968, I had typed GH-5194, which correctly links to python/cpython#5194.

However, the appearance of that link is suspect for two reasons:

  1. When I mouse over, the tooltip text reads GitHub PR 5194: [open] bpo-21161: pdb: default: handle list comprehensions, as if to link to bpo-21161: pdb: default: handle list comprehensions cpython#15194. Note the difference of a leading 1: 15194 instead of 5194.
  2. There is no strikethrough on that link, even though that pull request is merged.

This is not a major issue, but it's just a little confusing that the link is correct when the CSS implies otherwise.

Activity

  1. sweeneyde commented on Sep 26, 2021

    @sweeneyde
    MemberAuthor

    Relevant code is here.

        def _linkify_pull_request(self, match):
            """Turn a pullrequest (e.g. 'PR 123') to an HTML link"""
            template = ('<a href="%(base_url)s%(pr_no)s" %(cls)s'
                        'title="GitHub PR %(pr_no)s%(info)s">%(text)s</a>')
            pr_no = match.group('pr_no')
            text = match.group('text')
            # find title and status
            cl = self._db.pull_request
            # find all the pull_request that refer to GitHub PR pr_no,
            # with the most recently updated first
            pr_ids = cl.filter(None, dict(number=pr_no), sort=[('-', 'activity')])
            title = status = info = cls = ''
            for pr_id in pr_ids:
                if not title:
                    title = cl.get(pr_id, 'title', '')
                if not status:
                    status = cl.get(pr_id, 'status', '')
                if title and status:
                    # once we get both, escape and add to info
                    status = cgi.escape(status).replace('"', "'")
                    title = cgi.escape(title).replace('"', "'")
                    info = ': [%s] %s' % (status, title)
                    break
            if status:
                cls = 'class="%s" ' % ('open' if status == 'open' else 'closed')
            base_url = 'https://github.com/python/cpython/pull/'
            return template % dict(base_url=base_url, pr_no=pr_no, cls=cls,
                                   info=info, text=text)

    In my case, this must have returned

    <a href="https://github.com/python/cpython/pull/5194" class="open" title="GitHub PR 5194: [open] bpo-21161: pdb: default: handle list comprehensions">GH-5194</a>

    There is nothing identifiably wrong with that HTML snippet, it's just that the wrong PR metadata was pulled.
    I think there could be a rule to prioritize exact matches of number=pr_no rather than treating all substring-matches as equally valid.

    This isn't a huge problem as it only occurs when referencing pull requests old enough to be four digits long.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions