Skip to content

Commit b321b89

Browse files
authored
fix: Improve space description display in profile spaces list - MEED-8569 - Meeds-io/meeds#2849 (#1961)
This change will improve space description display in profile spaces list
1 parent ec68f60 commit b321b89

File tree

3 files changed

+96
-44
lines changed

3 files changed

+96
-44
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<!--
2+
This file is part of the Meeds project (https://meeds.io/).
3+
4+
Copyright (C) 2020 - 2025 Meeds Association contact@meeds.io
5+
6+
This program is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU Lesser General Public
8+
License as published by the Free Software Foundation; either
9+
version 3 of the License, or (at your option) any later version.
10+
This program is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Lesser General Public License for more details.
14+
You should have received a copy of the GNU Lesser General Public License
15+
along with this program; if not, write to the Free Software Foundation,
16+
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17+
-->
18+
<template>
19+
<v-list-item class="py-0 px-2">
20+
<v-list-item-avatar class="my-1 me-2" size="30">
21+
<v-img :src="avatarUrl" />
22+
</v-list-item-avatar>
23+
<v-list-item-content class="py-0">
24+
<v-list-item-title class="request-user-name darken-2" v-text="displayName" />
25+
<v-list-item-subtitle v-text="description" />
26+
</v-list-item-content>
27+
<v-list-item-action>
28+
<v-btn-toggle
29+
class="transparent"
30+
dark>
31+
<v-btn
32+
:loading="saving"
33+
text
34+
icon
35+
small
36+
min-width="auto"
37+
class="px-0 connexion-accept-btn"
38+
@click="replyInvitation(true)">
39+
<v-icon color="success" size="20">mdi-checkbox-marked-circle</v-icon>
40+
</v-btn>
41+
<v-btn
42+
:loading="saving"
43+
text
44+
icon
45+
small
46+
min-width="auto"
47+
class="px-0 connexion-refuse-btn"
48+
@click="replyInvitation(false)">
49+
<v-icon color="error" size="20">mdi-close-circle</v-icon>
50+
</v-btn>
51+
</v-btn-toggle>
52+
</v-list-item-action>
53+
</v-list-item>
54+
</template>
55+
56+
<script>
57+
export default {
58+
props: {
59+
space: {
60+
type: Object,
61+
default: () => null,
62+
},
63+
saving: {
64+
type: Boolean,
65+
default: () => false,
66+
},
67+
},
68+
computed: {
69+
avatarUrl() {
70+
return this.space?.avatarUrl;
71+
},
72+
displayName() {
73+
return this.space?.displayName;
74+
},
75+
description() {
76+
return this.$utils.htmlToText(this.space?.description);
77+
},
78+
},
79+
methods: {
80+
replyInvitation(accept) {
81+
this.$emit('replyInvitation', this.space, accept);
82+
}
83+
}
84+
};
85+
</script>

portlets/src/main/webapp/vue-app/profileStats/components/SpacesRequests.vue

Lines changed: 9 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -50,47 +50,12 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
5050
</v-flex>
5151
<v-flex
5252
xs12>
53-
<v-list>
54-
<v-list-item
55-
v-for="item in sort(spacesRequests)"
56-
:key="item.id"
57-
class="py-0 px-2">
58-
<v-list-item-avatar class="my-1 me-2" size="30">
59-
<v-img :src="item.avatarUrl" />
60-
</v-list-item-avatar>
61-
62-
<v-list-item-content class="py-0">
63-
<v-list-item-title class="request-user-name darken-2" v-text="item.displayName" />
64-
<v-list-item-subtitle v-sanitized-html="item.description" />
65-
</v-list-item-content>
66-
<v-list-item-action>
67-
<v-btn-toggle
68-
class="transparent"
69-
dark>
70-
<v-btn
71-
:loading="saving"
72-
text
73-
icon
74-
small
75-
min-width="auto"
76-
class="px-0 connexion-accept-btn"
77-
@click="replyInvitationToJoinSpace(item, 'approved')">
78-
<v-icon color="success" size="20">mdi-checkbox-marked-circle</v-icon>
79-
</v-btn>
80-
<v-btn
81-
:loading="saving"
82-
text
83-
icon
84-
small
85-
min-width="auto"
86-
class="px-0 connexion-refuse-btn"
87-
@click="replyInvitationToJoinSpace(item, 'ignored')">
88-
<v-icon color="error" size="20">mdi-close-circle</v-icon>
89-
</v-btn>
90-
</v-btn-toggle>
91-
</v-list-item-action>
92-
</v-list-item>
93-
</v-list>
53+
<space-request-item
54+
v-for="space in sort(spacesRequests)"
55+
:key="space.id"
56+
:space="space"
57+
:saving="saving"
58+
@replyInvitation="replyInvitationToJoinSpace" />
9459
</v-flex>
9560
<v-flex
9661
d-flex
@@ -145,17 +110,17 @@ export default {
145110
openSpaceRequests() {
146111
window.location.href = `${this.invitationSpaceUrl}`;
147112
},
148-
async replyInvitationToJoinSpace(item, reply) {
113+
async replyInvitationToJoinSpace(item, accept) {
149114
this.saving = true;
150115
try {
151-
if (reply === 'approved') {
116+
if (accept) {
152117
await this.$spaceService.accept(item.id);
153118
this.$emit('invitationReplied', {
154119
id: item.id,
155120
displayName: item.displayName,
156121
avatarUrl: item.avatarUrl,
157122
});
158-
} else if (reply === 'ignored') {
123+
} else {
159124
await this.$spaceService.deny(item.id);
160125
}
161126
this.getSpacesRequests();

portlets/src/main/webapp/vue-app/profileStats/initComponents.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ import PeopleListItem from './components/PeopleListItem.vue';
2525
import SpaceDrawer from './components/SpaceDrawer.vue';
2626
import SpaceDrawerItems from './components/SpaceDrawerItems.vue';
2727
import SuggestionsSpaceListItem from './components/SuggestionsSpaceListItem.vue';
28+
import SpaceRequestItem from './components/SpaceRequestItem.vue';
2829

2930
const components = {
3031
'profile-stats': ProfileStats,
3132
'connections-requests': ConnectionsRequests,
3233
'gamification-rank': GamificationRank,
3334
'spaces-requests': SpacesRequests,
35+
'space-request-item': SpaceRequestItem,
3436
'user-dashbord': UserDashbord,
3537
'connections-drawer': ConnectionsDrawer,
3638
'space-drawer': SpaceDrawer,

0 commit comments

Comments
 (0)