Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion handlers/api/v1/Users.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ component extends="BaseAPIHandler" secured="StacheboxUser"{
function show( event, rc, prc ){

prc.response.setData(
getInstance( "User@stachebox" ).getOrFail( rc.id ).getMemento()
getInstance( "User@stachebox" ).getOrFail( rc.id ).getMemento( includes="avatar" )
);

}
Expand Down
2 changes: 1 addition & 1 deletion models/services/UserService.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ component accessors="true" {
"startRow" : searchBuilder.getFrom(),
"maxRows" : javacast( "int", arguments.searchCollection.maxrows )
},
"results" : result.getHits().map( function( user ){ var memento = user.getMemento(); memento[ "id" ] = user.getId(); return memento; } )
"results" : result.getHits().map( function( user ){ var memento = user.getMemento( includes="avatar" ); memento[ "id" ] = user.getId(); return memento; } )
};
}

Expand Down
10 changes: 7 additions & 3 deletions resources/assets/js/layouts/inc/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
>
<img
class="h-full w-full object-cover"
:src="user.avatar"
:src="userAvatar"
alt="Your avatar"
/>
</button>
Expand Down Expand Up @@ -98,8 +98,12 @@ export default {
...mapState({
user : ( state ) => state.authUser,
baseHref : ( state ) => state.globals.stachebox.baseHref,
internalSecurityEnabled : ( state ) => state.globals.stachebox.internalSecurity
})
internalSecurityEnabled : ( state ) => state.globals.stachebox.internalSecurity,
defaultAvatar : ( state ) => state.defaultAvatar
}),
userAvatar(){
return this.user?.avatar || this.defaultAvatar;
}
},
mounted(){
if( this.$route.params.search ){
Expand Down
6 changes: 5 additions & 1 deletion resources/assets/js/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ dayjs.extend( utc );
dayjs.extend( timezone );
dayjs.tz.setDefault( dayjs.tz.guess() );

// Default avatar as a simple gray silhouette SVG
const DEFAULT_AVATAR = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Ccircle cx='100' cy='100' r='100' fill='%23e5e7eb'/%3E%3Ccircle cx='100' cy='80' r='35' fill='%239ca3af'/%3E%3Cellipse cx='100' cy='170' rx='55' ry='45' fill='%239ca3af'/%3E%3C/svg%3E";

export default createStore({
state: {
authId: null,
authToken: null,
authUser : null,
navAggregations : null,
beatsEnabled : true,
globals : window ? window.globalData : {}
globals : window ? window.globalData : {},
defaultAvatar : DEFAULT_AVATAR
},
getters:{
hasPermission: ( state,getters ) => ( permission ) =>{
Expand Down
5 changes: 3 additions & 2 deletions resources/assets/js/views/UserDirectory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="flex-shrink-0 h-10 w-10">
<img class="h-10 w-10 rounded-full" :src="user.avatar" alt="">
<img class="h-10 w-10 rounded-full" :src="user.avatar || defaultAvatar" alt="">
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">
Expand Down Expand Up @@ -103,7 +103,8 @@ export default {
}),
...mapState({
authUser : state => state.authUser,
authToken : state => state.authToken
authToken : state => state.authToken,
defaultAvatar : state => state.defaultAvatar
}),
users(){
return this.usersData ? this.usersData.results : undefined;
Expand Down
Loading