Skip to content

Only display user bio for confirmed and active users

Drew Blessing requested to merge dblessing_unconfirmed_blocked_bio_metadata into master

What does this MR do and why?

Related to https://gitlab.com/gitlab-org/gitlab/-/issues/341325

User profile content should only be displayed for active (unblocked) users who are confirmed. We already ensure this is true for visible content on the profile page. However, we were still showing the user bio in page metadata. This change ensures the bio is not shown for blocked or unconfirmed users.

In the metadata examples below look at the various description content values. Before this fix, any value from the user bio was populated for these properties. For blocked or unconfirmed users the value falls back to the default site brand title, which is 'GitLab Community Edition' or 'GitLab Enterprise Edition' and for GitLab.com is 'GitLab.com'.

Metadata before

<meta content="object" property="og:type">
<meta content="GitLab" property="og:site_name">
<meta content="Blocked user" property="og:title">
<meta content="My personal bio" property="og:description">
<meta content="https://secure.gravatar.com/avatar/302f78a7f126058cb819fd6d7316ecd9?s=80&amp;d=identicon" property="og:image">
<meta content="64" property="og:image:width">
<meta content="64" property="og:image:height">
<meta content="https://gitlab.example.com:3443/Mary" property="og:url">
<meta content="summary" property="twitter:card">
<meta content="Blocked user" property="twitter:title">
<meta content="My personal bio" property="twitter:description">
<meta content="https://secure.gravatar.com/avatar/302f78a7f126058cb819fd6d7316ecd9?s=80&amp;d=identicon" property="twitter:image">

<title>Blocked user · GitLab</title>
<meta content="My personal bio" name="description">

Metadata after

<meta content="object" property="og:type">
<meta content="GitLab" property="og:site_name">
<meta content="Blocked user" property="og:title">
<meta content="GitLab Enterprise Edition" property="og:description">
<meta content="https://secure.gravatar.com/avatar/302f78a7f126058cb819fd6d7316ecd9?s=80&amp;d=identicon" property="og:image">
<meta content="64" property="og:image:width">
<meta content="64" property="og:image:height">
<meta content="https://gitlab.example.com:3443/Mary" property="og:url">
<meta content="summary" property="twitter:card">
<meta content="Blocked user" property="twitter:title">
<meta content="GitLab Enterprise Edition" property="twitter:description">
<meta content="https://secure.gravatar.com/avatar/302f78a7f126058cb819fd6d7316ecd9?s=80&amp;d=identicon" property="twitter:image">

<title>Blocked user · GitLab</title>
<meta content="GitLab Enterprise Edition" name="description">

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Drew Blessing

Merge request reports

Loading