# Follow a user

A **Profile** page identifies a user and lists that user's articles. Use it to review basic
information and change whether you follow them.

## Follow another user

The follow task belongs on the **Profile** page, alongside the user's basic information and
article lists.

| If you need to… | Go to |
|---|---|
| Open an existing user's profile | [View a profile](doc:view-a-profile) |
| Read the user's posts or favorites | [View My Posts and Favorited Posts](doc:view-my-posts-and-favorited-posts) |
| Follow or unfollow the user | Before you start, then [Follow or unfollow the user](#follow-or-unfollow-the-user) |
| Change your own profile settings | [Update settings](doc:update-settings) |
| Sign in before changing the relationship | [Sign in](doc:sign-in) |

## Before you start

**Prerequisites**

- Know the username for the profile you want to open.
- Open a profile that has loaded before selecting **Follow <username>** or **Unfollow <username>**.
- Sign in before following or unfollowing a user.

Open the user's **Profile** page using their username. If you select **Follow <username>** or
**Unfollow <username>** while you are not signed in, the application takes you to [Sign in](doc:sign-in)
instead of calling the follow or unfollow operation.

## Find and open the profile

Use this task to open an existing user's profile. The profile route accepts the username as its
parameter; creating a user is a separate task.

**Steps**

1. Open the Profile route for the user whose username you want to view.

**Result:** The user's profile page opens when the profile data is available.

## Read the profile header

The profile header is the area that identifies the user before you change the following
relationship.

| Information | What appears on the page |
|---|---|
| Profile image | The user's image, with a default image applied when needed |
| Username | The user's username |
| Bio | The user's biography, or an empty area when no biography is available |

The article area provides two destinations:

| If you need to… | Select |
|---|---|
| Read articles created by the user | **My Posts** |
| Read articles the user has favorited | **Favorited Posts** |

For another user's profile, **Follow <username>** or **Unfollow <username>** appears in the
header. For your own profile, **Edit Profile Settings** appears instead and opens [Update settings](doc:update-settings).

## Follow or unfollow the user

Use this procedure when the profile header shows **Follow <username>** or
**Unfollow <username>** for another user.

**Prerequisites**

- The user's profile is open and its profile information is visible.
- You are signed in.

**Steps**

1. Select the control that matches the relationship you want:

   | If the control says… | Select it to… |
   |---|---|
   | **Follow <username>** | Follow the displayed user |
   | **Unfollow <username>** | Stop following the displayed user |

**Result:** The profile page receives the profile returned by the selected follow or unfollow
operation.

## Handle the profile and authentication branches

The available action depends on whose profile you opened and whether you already follow that
user.

| What you see | What to do | Outcome |
|---|---|---|
| **Follow <username>** | Select the button | The follow operation is used for the displayed user |
| **Unfollow <username>** | Select the button | The unfollow operation is used for the displayed user |
| **Edit Profile Settings** | Select the link | [Update settings](doc:update-settings) opens for your own profile |
| **Follow <username>** or **Unfollow <username>** while you are not signed in | Select the button | [Sign in](doc:sign-in) opens and the follow or unfollow operation is skipped |

**Steps**

1. Select the button in the row that matches what you see in the profile header.

**Result:** The selected **Follow <username>** or **Unfollow <username>** action runs,
**Edit Profile Settings** opens settings, or [Sign in](doc:sign-in) opens sign-in.

## When the profile cannot load

The page lists a profile-load fallback when the profile request fails. A server-provided profile
error can also appear in the page's error list.

| What you see | What it means | What to do |
|---|---|---|
| `Failed to load profile` | The profile request returned without a usable profile error list | Read the displayed message |
| ``Each value in `error.errors` `` | The profile request returned a server-provided profile error | Read the displayed message |
| No follow or unfollow success message | The page does not display a success message for that relationship operation | Check the profile header for the returned profile state |
| No follow or unfollow error message | The page does not display a relationship-specific error message | Check the profile header for the returned profile state |

After either relationship request, the page clears the submitting state on success or error. On
success, it uses the returned profile; it does not display a follow or unfollow error message.

## Know what happens next

After a successful relationship operation, the profile page receives the returned profile and
updates its profile value. The next destination depends on the branch you took.

| After this branch… | Continue at… |
|---|---|
| You opened your own profile | [Update settings](doc:update-settings) through **Edit Profile Settings** |
| You are not signed in when you select **Follow <username>** or **Unfollow <username>** | [Sign in](doc:sign-in) |
| You followed or unfollowed another user | [View a profile](doc:view-a-profile) or return to the profile's article list |

**Prerequisites**

- The relationship operation has returned the profile page to its normal state.

**Steps**

1. Select the next destination in the row that matches the branch you took.

**Result:** The destination named in the selected row opens, or the profile's article list is
available again.
