-
<%= render "shared/profile_card_content", actor: @actor, context: "sidebar" %>
diff --git a/app/views/articles/show.html.erb b/app/views/articles/show.html.erb
index 8d404a9dc..9bd05e4da 100644
--- a/app/views/articles/show.html.erb
+++ b/app/views/articles/show.html.erb
@@ -97,15 +97,51 @@
<% end %>
- <% if @organization %>
-
-
-
-
- <%= @organization.name %>
-
- <% end %>
-
+
+
+
+
+ <% if @organization %>
+
 %>)
+
+
+
+ <% else %>
+
 %>)
+ <% end %>
+
+
+
<%= @user.name %>
+ <% if @organization %>
+
for <%= @organization.name %>
+ <% end %>
+
+ <% if @article.published_timestamp.present? %>
+ Posted on
+ <%= local_date(@article.published_timestamp, show_year: @article.displayable_published_at.year != Time.current.year) %>
+ <% end %>
+ <% if @article.co_author_ids.present? %>
+ with <%= @article.co_author_name_and_path.html_safe %>
+ <% end %>
+
+ <% if should_show_updated_on?(@article) %>
+ • Updated on <%= local_date(@article.edited_at, show_year: @article.edited_at.year != Time.current.year) %>
+ <% end %>
+
+ <% if should_show_crossposted_on?(@article) %>
+ • Originally published at
+ <%= get_host_without_www(@article.canonical_url || @article.feed_source_url) %>
+ <% if @article.crossposted_at %>
+ on
+ <%= local_date(@article.originally_published_at || @article.published_at, show_year: (@article.originally_published_at || @article.published_at).year != Time.current.year) %>
+ <% end %>
+ <% end %>
+
+
+
+
+
+
<% if @article.search_optimized_title_preamble.present? && !user_signed_in? %>
<%= @article.search_optimized_title_preamble %>
<% end %>
@@ -113,57 +149,12 @@
<% cache("main-article-tags-#{@article.cached_tag_list}", expires_in: 30.hours) do %>
-
diff --git a/cypress/integration/seededFlows/articleFlows/previewProfile.spec.js b/cypress/integration/seededFlows/articleFlows/previewProfile.spec.js
deleted file mode 100644
index 67fa5aaa0..000000000
--- a/cypress/integration/seededFlows/articleFlows/previewProfile.spec.js
+++ /dev/null
@@ -1,314 +0,0 @@
-describe('Preview user profile from article page', () => {
- describe('mobile screens', () => {
- beforeEach(() => {
- cy.testSetup();
- cy.fixture('users/articleEditorV1User.json').as('user');
-
- cy.viewport('iphone-7');
-
- cy.get('@user').then((user) => {
- cy.loginAndVisit(user, '/').then(() => {
- cy.findAllByRole('link', { name: 'Test article' })
- .first()
- .click({ force: true });
-
- // Wait for page to load
- cy.findByRole('button', { name: 'Share post options' });
- });
- });
- });
-
- it('should not show a preview profile details button', () => {
- cy.findByRole('button', { name: 'Admin McAdmin profile details' })
- .as('previewCardTrigger')
- .should('not.exist');
-
- // Check the user profile link is shown instead (there are also some in the user details card at the bottom)
- cy.findAllByRole('link', { name: 'Admin McAdmin' }).should(
- 'have.length',
- 3,
- );
- });
- });
-
- describe("Preview profile on another user's article", () => {
- beforeEach(() => {
- cy.testSetup();
- cy.fixture('users/articleEditorV1User.json').as('user');
-
- cy.get('@user').then((user) => {
- cy.loginAndVisit(user, '/admin_mcadmin/test-article-slug');
-
- // Wait for the page to load
- cy.findByRole('button', { name: 'Share post options' });
- cy.get('[data-follow-clicks-initialized]');
- });
- });
-
- it('should show a toggleable preview card for author byline', () => {
- cy.findAllByRole('button', { name: 'Admin McAdmin profile details' })
- .first()
- .as('previewCardTrigger');
-
- // Initializes as unexpanded
- cy.get('@previewCardTrigger').should(
- 'have.attr',
- 'aria-expanded',
- 'false',
- );
-
- // Check the content opens and manages focus
- cy.get('@previewCardTrigger').click();
- cy.get('@previewCardTrigger').should(
- 'have.attr',
- 'aria-expanded',
- 'true',
- );
-
- cy.findAllByTestId('profile-preview-card')
- .first()
- .within(() => {
- cy.findByRole('link', {
- name: 'Admin McAdmin',
- }).should('have.focus');
-
- // Check all the expected user data sections are present
- cy.findByText('Admin user summary');
- cy.findByText('Software developer at Company');
- cy.findByText('Edinburgh');
- cy.findByText('University of Life');
-
- cy.findByRole('button', { name: 'Follow user: Admin McAdmin' }).as(
- 'followUserButton',
- );
-
- cy.get('@followUserButton').should(
- 'have.attr',
- 'aria-pressed',
- 'false',
- );
- cy.get('@followUserButton').click();
-
- cy.get('@followUserButton').should(
- 'have.attr',
- 'aria-pressed',
- 'true',
- );
- });
-
- // Check we can close the preview dropdown
- cy.get('@previewCardTrigger').click();
- cy.findAllByTestId('profile-preview-card')
- .first()
- .should('not.be.visible');
- cy.get('@previewCardTrigger').should(
- 'have.attr',
- 'aria-expanded',
- 'false',
- );
- });
-
- it('should show a preview card for comment name', () => {
- cy.findByTestId('comments-container').within(() => {
- cy.findByRole('button', { name: 'Admin McAdmin profile details' }).as(
- 'previewCardTrigger',
- );
-
- cy.get('[data-initialized]');
- cy.get('@previewCardTrigger').click();
-
- cy.findByTestId('profile-preview-card').within(() => {
- cy.findByRole('link', {
- name: 'Admin McAdmin',
- }).should('have.focus');
-
- // Check all the expected user data sections are present
- cy.findByText('Admin user summary');
- cy.findByText('Software developer at Company');
- cy.findByText('Edinburgh');
- cy.findByText('University of Life');
-
- cy.findByRole('button', {
- name: 'Follow user: Admin McAdmin',
- }).as('userFollowButton');
-
- cy.get('@userFollowButton').click();
- cy.get('@userFollowButton').should(
- 'have.attr',
- 'aria-pressed',
- 'true',
- );
- });
- });
- });
-
- it('should update any other matching follow buttons when follow CTA is clicked', () => {
- cy.get('[data-initialized]');
- // Click the follow button in the author byline preview
- cy.findAllByRole('button', { name: 'Admin McAdmin profile details' })
- .first()
- .as('bylinePreviewButton');
- cy.get('@bylinePreviewButton').click();
-
- cy.findAllByTestId('profile-preview-card')
- .first()
- .within(() => {
- cy.findByRole('button', {
- name: 'Follow user: Admin McAdmin',
- }).as('userFollowButton');
-
- cy.get('@userFollowButton').click();
- cy.get('@userFollowButton').should(
- 'have.attr',
- 'aria-pressed',
- 'true',
- );
- });
-
- // Close the preview card so the next preview button can be clicked
- cy.get('@bylinePreviewButton').click();
-
- // Check the follow button in the comment author preview card has updated
- cy.findAllByRole('button', { name: 'Admin McAdmin profile details' })
- .last()
- .click();
-
- cy.findAllByTestId('profile-preview-card')
- .last()
- .findByRole('button', { name: 'Follow user: Admin McAdmin' })
- .should('have.attr', 'aria-pressed', 'true');
- });
-
- it('should detach listeners on preview card close', () => {
- cy.findAllByRole('button', { name: 'Admin McAdmin profile details' })
- .first()
- .as('previewCardTrigger');
-
- // Make sure button has initialized
- cy.get('[data-initialized]').should('exist');
-
- // Open the preview
- cy.get('@previewCardTrigger').click();
- cy.get('@previewCardTrigger').should(
- 'have.attr',
- 'aria-expanded',
- 'true',
- );
-
- // Close by pressing Escape
- cy.get('body').type('{esc}');
- cy.get('@previewCardTrigger').should(
- 'have.attr',
- 'aria-expanded',
- 'false',
- );
- cy.get('@previewCardTrigger').should('have.focus');
-
- // Focus another item on the page
- cy.findByRole('button', { name: 'Share post options' }).focus();
-
- // Press Escape again and check the focus isn't reverted back to the dropdown trigger
- cy.get('body').type('{esc}');
- cy.get('@previewCardTrigger').should('not.have.focus');
-
- // Click on a non-interactive element and check the focus isn't reverted back to the dropdown trigger
- cy.findByRole('heading', { name: 'Test article' }).click();
- cy.get('@previewCardTrigger').should('not.have.focus');
- });
- });
-
- describe("Preview profile on user's own article", () => {
- beforeEach(() => {
- cy.testSetup();
- cy.fixture('users/articleEditorV1User.json').as('user');
-
- cy.get('@user').then((user) => {
- cy.loginUser(user).then(() => {
- cy.createArticle({
- title: 'Test Article',
- tags: ['beginner', 'ruby', 'go'],
- content: `This is a test article's contents.`,
- published: true,
- }).then((response) => {
- cy.visitAndWaitForUserSideEffects(response.body.current_state_path);
- });
- });
- });
- });
-
- it('should show a preview card with Edit profile CTA', () => {
- cy.findByRole('button', {
- name: 'Article Editor v1 User profile details',
- }).as('previewCardTrigger');
-
- // Initializes as unexpanded
- cy.get('@previewCardTrigger').should(
- 'have.attr',
- 'aria-expanded',
- 'false',
- );
-
- // Check the content opens and manages focus
- cy.get('@previewCardTrigger').click();
- cy.get('@previewCardTrigger').should(
- 'have.attr',
- 'aria-expanded',
- 'true',
- );
-
- cy.findByTestId('profile-preview-card').within(() => {
- cy.findByRole('link', {
- name: 'Article Editor v1 User',
- }).should('have.focus');
-
- // Check Follow option is replaced with Edit profile
- cy.findByRole('button', { name: 'Edit profile' }).click();
- });
-
- // Check Edit profile directs to correct page
- cy.url().should('contain', '/settings');
- cy.findByRole('heading', {
- name: 'Settings for @article_editor_v1_user',
- });
- });
- });
-
- describe('Preview author profile on an organization article', () => {
- beforeEach(() => {
- cy.testSetup();
- cy.fixture('users/articleEditorV1User.json').as('user');
-
- cy.get('@user').then((user) => {
- cy.loginUser(user).then(() => {
- cy.visit('/');
- cy.findAllByRole('link', { name: 'Organization test article' })
- .first()
- .click({ force: true });
- // Make sure we have arrived on the article page
- cy.findByRole('button', { name: 'Share post options' });
- });
- });
- });
-
- it('Should show author details in the preview card', () => {
- cy.findByRole('button', { name: 'Admin McAdmin profile details' }).as(
- 'profileDetailsButton',
- );
- // Make sure the button is initialized before interacting
- cy.get('[data-initialized]');
- cy.get('@profileDetailsButton').click();
- cy.findByTestId('profile-preview-card').within(() => {
- // Check user fields are present
- cy.findByRole('link', {
- name: 'Admin McAdmin',
- }).should('have.focus');
-
- cy.findByRole('button', { name: 'Follow user: Admin McAdmin' });
- cy.findByText('Admin user summary');
- cy.findByText('Software developer at Company');
- cy.findByText('Edinburgh');
- cy.findByText('University of Life');
- });
- });
- });
-});
diff --git a/cypress/integration/seededFlows/publishingFlows/postOptions.spec.js b/cypress/integration/seededFlows/publishingFlows/postOptions.spec.js
index e4127b8a7..07fa44d7b 100644
--- a/cypress/integration/seededFlows/publishingFlows/postOptions.spec.js
+++ b/cypress/integration/seededFlows/publishingFlows/postOptions.spec.js
@@ -69,7 +69,7 @@ describe('V2 Editor Post options', () => {
});
// Verify that the canonical URL is used
- cy.findByText('Originally published at').should('exist');
+ cy.findByText(/Originally published at/).should('exist');
cy.findByRole('link', { name: 'exampleurl.com' });
});
diff --git a/spec/requests/stories_show_spec.rb b/spec/requests/stories_show_spec.rb
index bfb42d069..5b5ac9577 100644
--- a/spec/requests/stories_show_spec.rb
+++ b/spec/requests/stories_show_spec.rb
@@ -134,7 +134,7 @@ RSpec.describe "StoriesShow", type: :request do
user2 = create(:user)
article.update(co_author_ids: [user2.id])
get article.path
- expect(response.body).to include "with "
+ expect(response.body).to include %(with )
end
it "renders articles of long length without breaking" do
diff --git a/spec/system/user_uses_the_editor_spec.rb b/spec/system/user_uses_the_editor_spec.rb
index ec9cbc1a7..aa6362959 100644
--- a/spec/system/user_uses_the_editor_spec.rb
+++ b/spec/system/user_uses_the_editor_spec.rb
@@ -105,8 +105,7 @@ RSpec.describe "Using the editor", type: :system do
expect(page).to have_xpath("//div[@class='crayons-article__header__meta']//h1")
expect(page).to have_text("Hello")
- expect(page).not_to have_text("")
- expect(page).to have_link("#what", href: "/t/what")
+ expect(page).to have_link("what", href: "/t/what")
end
end
end