From a81ec214f124d01b1e03f607c243abca57dc1635 Mon Sep 17 00:00:00 2001
From: sebastian2357 <80636200+sebastian2357@users.noreply.github.com>
Date: Wed, 2 Jul 2025 14:20:21 +0200
Subject: [PATCH] fix(webapp): added option for slug (#8659)
---
.../Post.Comment/I_should_see_my_comment.js | 4 +-
.../components/UserTeaser/UserTeaser.spec.js | 2 +
.../components/UserTeaser/UserTeaser.story.js | 14 +-
webapp/components/UserTeaser/UserTeaser.vue | 2 +
.../UserTeaser/UserTeaserNonAnonymous.vue | 3 +-
.../FiledReportsTable.spec.js | 2 +-
.../features/ReportRow/ReportRow.spec.js | 8 +-
.../SearchableInput/SearchableInput.spec.js | 4 +-
.../_id/__snapshots__/_slug.spec.js.snap | 192 +++---------------
9 files changed, 55 insertions(+), 176 deletions(-)
diff --git a/cypress/support/step_definitions/Post.Comment/I_should_see_my_comment.js b/cypress/support/step_definitions/Post.Comment/I_should_see_my_comment.js
index 332379dcc..194b45165 100644
--- a/cypress/support/step_definitions/Post.Comment/I_should_see_my_comment.js
+++ b/cypress/support/step_definitions/Post.Comment/I_should_see_my_comment.js
@@ -3,8 +3,8 @@ import { defineStep } from '@badeball/cypress-cucumber-preprocessor'
defineStep('I should see my comment', () => {
cy.get('article.comment-card p')
.should('contain', 'Ocelot.social rocks')
- .get('.user-teaser span.slug')
- .should('contain', '@peter-pan') // specific enough
+ .get('.user-teaser span.name')
+ .should('contain', 'Peter Pan') // specific enough
.get('.profile-avatar img')
.should('have.attr', 'src')
.and('contain', 'https://') // some url
diff --git a/webapp/components/UserTeaser/UserTeaser.spec.js b/webapp/components/UserTeaser/UserTeaser.spec.js
index 0c2adab8a..2926e31da 100644
--- a/webapp/components/UserTeaser/UserTeaser.spec.js
+++ b/webapp/components/UserTeaser/UserTeaser.spec.js
@@ -56,6 +56,7 @@ describe('UserTeaser', () => {
withLinkToProfile = true,
onTouchScreen = false,
withAvatar = true,
+ showSlug = true,
user = userTilda,
withPopoverEnabled = true,
}) => {
@@ -76,6 +77,7 @@ describe('UserTeaser', () => {
user,
linkToProfile: withLinkToProfile,
showAvatar: withAvatar,
+ showSlug: showSlug,
showPopover: withPopoverEnabled,
},
stubs: {
diff --git a/webapp/components/UserTeaser/UserTeaser.story.js b/webapp/components/UserTeaser/UserTeaser.story.js
index 1295bf2db..8708978f0 100644
--- a/webapp/components/UserTeaser/UserTeaser.story.js
+++ b/webapp/components/UserTeaser/UserTeaser.story.js
@@ -101,7 +101,7 @@ storiesOf('UserTeaser', module)
data: () => ({
user,
}),
- template: '',
+ template: '',
}))
.add('with date', () => ({
components: { UserTeaser },
@@ -109,7 +109,7 @@ storiesOf('UserTeaser', module)
data: () => ({
user,
}),
- template: '',
+ template: '',
}))
.add('has edited something', () => ({
components: { UserTeaser },
@@ -118,7 +118,7 @@ storiesOf('UserTeaser', module)
user,
}),
template: `
-
+
- HEY! I'm edited
@@ -131,7 +131,7 @@ storiesOf('UserTeaser', module)
data: () => ({
user: null,
}),
- template: '',
+ template: '',
}))
.add('with group and date', () => ({
components: { UserTeaser },
@@ -140,7 +140,8 @@ storiesOf('UserTeaser', module)
user,
group,
}),
- template: '',
+ template:
+ '',
}))
.add('with group and date – wide', () => ({
components: { UserTeaser },
@@ -149,5 +150,6 @@ storiesOf('UserTeaser', module)
user,
group,
}),
- template: '',
+ template:
+ '',
}))
diff --git a/webapp/components/UserTeaser/UserTeaser.vue b/webapp/components/UserTeaser/UserTeaser.vue
index 361dd602a..766805ede 100644
--- a/webapp/components/UserTeaser/UserTeaser.vue
+++ b/webapp/components/UserTeaser/UserTeaser.vue
@@ -13,6 +13,7 @@
:group="group"
:wide="wide"
:show-avatar="showAvatar"
+ :show-slug="showSlug"
:date-time="dateTime"
:show-popover="showPopover"
:injected-text="injectedText"
@@ -42,6 +43,7 @@ export default {
group: { type: Object, default: null },
wide: { type: Boolean, default: false },
showAvatar: { type: Boolean, default: true },
+ showSlug: { type: Boolean, default: false },
dateTime: { type: [Date, String], default: null },
showPopover: { type: Boolean, default: true },
injectedText: { type: String, default: null },
diff --git a/webapp/components/UserTeaser/UserTeaserNonAnonymous.vue b/webapp/components/UserTeaser/UserTeaserNonAnonymous.vue
index ec820a908..f13594e3b 100644
--- a/webapp/components/UserTeaser/UserTeaserNonAnonymous.vue
+++ b/webapp/components/UserTeaser/UserTeaserNonAnonymous.vue
@@ -23,7 +23,7 @@
@open-menu="loadPopover(openMenu)"
@close-menu="closeMenu(false)"
>
- {{ userSlug }}
+ {{ userSlug }}
{{ userName }}
@@ -83,6 +83,7 @@ export default {
group: { type: Object, default: null },
wide: { type: Boolean, default: false },
showAvatar: { type: Boolean, default: true },
+ showSlug: { type: Boolean, default: false },
dateTime: { type: [Date, String], default: null },
showPopover: { type: Boolean, default: true },
injectedText: { type: String, default: null },
diff --git a/webapp/components/features/FiledReportsTable/FiledReportsTable.spec.js b/webapp/components/features/FiledReportsTable/FiledReportsTable.spec.js
index 7a99e85aa..3f43fc532 100644
--- a/webapp/components/features/FiledReportsTable/FiledReportsTable.spec.js
+++ b/webapp/components/features/FiledReportsTable/FiledReportsTable.spec.js
@@ -62,7 +62,7 @@ describe('FiledReportsTable.vue', () => {
describe('FiledReport', () => {
it('renders the reporting user', () => {
const userSlug = wrapper.find('[data-test="filing-user"]')
- expect(userSlug.text()).toContain('@community-moderator')
+ expect(userSlug.text()).toContain('Community moderator')
})
it('renders the reported date', () => {
diff --git a/webapp/components/features/ReportRow/ReportRow.spec.js b/webapp/components/features/ReportRow/ReportRow.spec.js
index a1b405edc..e763d6ebd 100644
--- a/webapp/components/features/ReportRow/ReportRow.spec.js
+++ b/webapp/components/features/ReportRow/ReportRow.spec.js
@@ -109,7 +109,7 @@ describe('ReportRow', () => {
it('renders the moderator who reviewed the resource', () => {
const username = wrapper.find('[data-test="report-reviewer"]')
- expect(username.text()).toContain('@moderator')
+ expect(username.text()).toContain('Moderator')
})
})
})
@@ -132,7 +132,7 @@ describe('ReportRow', () => {
it('renders the author', () => {
const userSlug = wrapper.find('[data-test="report-author"]')
- expect(userSlug.text()).toContain('@louie')
+ expect(userSlug.text()).toContain('Louie')
})
})
@@ -154,7 +154,7 @@ describe('ReportRow', () => {
it('renders the author', () => {
const username = wrapper.find('[data-test="report-author"]')
- expect(username.text()).toContain('@dagobert')
+ expect(username.text()).toContain('Dagobert')
})
})
@@ -171,7 +171,7 @@ describe('ReportRow', () => {
it('renders a link to the user profile', () => {
const userLink = wrapper.find('[data-test="report-content"]')
- expect(userLink.text()).toContain('@abusive-user')
+ expect(userLink.text()).toContain('Abusive user')
})
})
})
diff --git a/webapp/components/generic/SearchableInput/SearchableInput.spec.js b/webapp/components/generic/SearchableInput/SearchableInput.spec.js
index c5fc4b072..2f780efd1 100644
--- a/webapp/components/generic/SearchableInput/SearchableInput.spec.js
+++ b/webapp/components/generic/SearchableInput/SearchableInput.spec.js
@@ -87,8 +87,8 @@ describe('SearchableInput.vue', () => {
it("pushes to user's profile", async () => {
select.element.value = 'Bob'
select.trigger('input')
- const users = wrapper.findAll('.slug')
- const bob = users.filter((item) => item.text().match(/@bob-der-baumeister/))
+ const users = wrapper.findAll('.name')
+ const bob = users.filter((item) => item.text().match(/Bob der Baumeister/))
bob.trigger('click')
await Vue.nextTick()
expect(mocks.$router.push).toHaveBeenCalledWith({
diff --git a/webapp/pages/groups/_id/__snapshots__/_slug.spec.js.snap b/webapp/pages/groups/_id/__snapshots__/_slug.spec.js.snap
index 650fc72ab..92ed330ba 100644
--- a/webapp/pages/groups/_id/__snapshots__/_slug.spec.js.snap
+++ b/webapp/pages/groups/_id/__snapshots__/_slug.spec.js.snap
@@ -561,11 +561,7 @@ exports[`GroupProfileSlug given a puplic group – "yoga-practice" given a close
-
- @peter-lustig
-
+
-
- @jenny-rostock
-
+
-
- @bob-der-baumeister
-
+
-
- @huey
-
+
-
- @peter-lustig
-
+
-
- @jenny-rostock
-
+
-
- @bob-der-baumeister
-
+
-
- @huey
-
+
-
- @peter-lustig
-
+
-
- @jenny-rostock
-
+
-
- @bob-der-baumeister
-
+
-
- @huey
-
+
-
- @peter-lustig
-
+
-
- @jenny-rostock
-
+
-
- @bob-der-baumeister
-
+
-
- @huey
-
+
-
- @peter-lustig
-
+
-
- @jenny-rostock
-
+
-
- @bob-der-baumeister
-
+
-
- @huey
-
+
-
- @peter-lustig
-
+
-
- @jenny-rostock
-
+
-
- @bob-der-baumeister
-
+
-
- @huey
-
+
-
- @peter-lustig
-
+
-
- @jenny-rostock
-
+
-
- @bob-der-baumeister
-
+
-
- @huey
-
+
-
- @peter-lustig
-
+
-
- @jenny-rostock
-
+
-
- @bob-der-baumeister
-
+
-
- @huey
-
+