Skip to content

Commit

Permalink
update profiles when contact exists but name is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
nanu-c committed Jun 13, 2023
1 parent bf2a7a6 commit 25729f2
Show file tree
Hide file tree
Showing 8 changed files with 445 additions and 359 deletions.
4 changes: 2 additions & 2 deletions axolotl-web/src/components/LegacyHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</button>
<div v-if="currentChat !== null && currentChat" class="row w-100">
<div class="col-2 badge-container">
<div v-if="!currentChat?.is_group" class="badge-name" @click="openProfileForRecipient(currentChat.DirectMessageRecipientID)">
<div v-if="!currentChat?.is_group" class="badge-name" @click="openProfileForRecipient(currentChat.id.Contact)">
<img
class="avatar-img"
:src="'http://localhost:9080/avatars?session=' + currentChat.ID"
Expand Down Expand Up @@ -531,7 +531,7 @@ export default {
},
openProfileForRecipient(recipient) {
if (recipient !== -1) {
this.$updaterouter.push("/profile/" + recipient);
this.$router.push("/profile/" + recipient);
}
},
},
Expand Down
13 changes: 6 additions & 7 deletions axolotl-web/src/components/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
<div v-if="!is_outgoing &&
isGroup
" class="avatar">
<div class="badge-name" @click="openProfileForRecipient(id)">
<div v-if="id !== -1">
<img class="avatar-img" :src="'http://localhost:9080/avatars?recipient=' + id" @error="onImageError($event)" />
<div class="badge-name" @click="openProfileForRecipient(message.sender)">
<div v-if="message.sender !== -1">
<img class="avatar-img" :src="'http://localhost:9080/avatars?recipient=' + message.sender" @error="onImageError($event)" />
</div>
<div v-if="name && name !== ''">
{{ name && name[0] }}
Expand All @@ -54,7 +54,7 @@
</blockquote>
<div v-if="message.attachments.length > 0" class="attachment">
<div :class="`gallery-${message.attachments.length>3?'big':'small'}`">
<div v-for=" m in message.attachments" :key="m.File" v-masonry-tile class="item">
<div v-for=" m in message.attachments" :key="m.File" class="item">
<div v-if="m.ctype === 'image'" class="attachment-img">
<img :src="'http://localhost:9080/attachments/' + m.filename" alt="image"
@click="$emit('show-fullscreen-img', m.filename)" />
Expand Down Expand Up @@ -354,16 +354,15 @@ export default {
<style lang="scss" scoped>
.gallery-big {
display: flex;
flex-flow: column wrap;
flex-flow: wrap;
align-content: space-between;
height: 665px;
max-width: 1000px;
margin: auto;
.item {
box-sizing: border-box;
width: 32%;
margin-bottom: 2%;
padding: 5px;
}
.item:nth-child(3n+1) {
Expand Down
48 changes: 25 additions & 23 deletions axolotl-web/src/pages/Profile.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
<template>
<component :is="$route.meta.layout || 'div'">
<template #header>
<div v-if="profile.Recipient" class="profile-header">
<span>{{ name }}</span>
<div v-if="profile?.name" class="profile-header">
<span>{{ profile?.name }}</span>
</div>
</template>
<template #menu>
<div class="ms-2">
<div v-translate @click="editContact()">Edit Contact</div>
</div>
</template>
<div v-if="profile.Recipient" class="profile">
<div v-if="!profile?.name">
Couldn't find profile for {{ profileId }}
</div>

<div v-if="profile?.name" class="profile">
<div class="profile-image">
<img
v-if="hasProfileImage"
Expand All @@ -21,28 +25,30 @@
/>
<div v-else class="profile-name">
<span>{{
name[0]
profile?.name[0]
}}</span>
</div>
</div>
<div class="infos">
<div v-if="profile.Recipient.E164" class="number">
{{ profile.Recipient.E164 }}

<div v-if="profile?.phone_number" class="number">
<a href="tel:{{ `+${profile?.phone_number.code.value}${profile?.phone_number.national.value}` }}">
{{ `+${profile?.phone_number.code.value}${profile?.phone_number.national.value}` }}</a>
</div>
<div v-if="profile.Recipient.Username != ''" class="username">
{{ profile.Recipient.Username }}
<div v-if="profile?.username != ''" class="username">
{{ profile?.username }}
</div>
<div v-if="profile.Recipient.UUID != ''" class="uuid">
{{ profile.Recipient.UUID }}
<div v-if="profile?.uuid != ''" class="uuid">
{{ profile?.uuid}}
</div>
<div v-if="profile.Recipient.About != ''" class="about">
{{ profile.Recipient.About }}
<div v-if="profile?.about != ''" class="about">
{{ profile?.about }}
</div>
<div v-if="profile.Recipient.AboutEmoji != ''" class="about-emoji">
{{ profile.Recipient.AboutEmoji }}
<div v-if="profile?.aboutEmoji != ''" class="about-emoji">
{{ profile?.aboutEmoji }}
</div>
<div class="btn btn-primary create-chat mt-4" @click="createChat()">
<div v-translate>Create private chat with {{ name }}</div>
<div v-translate>Create private chat with {{ profile?.name }}</div>
</div>
</div>
</div>
Expand All @@ -54,9 +60,9 @@ export default {
name: "ProfilePage",
props: {
profileId:{
type: Number,
type: String,
required: true,
default: -1
default: ""
},
},
data: () => ({
Expand All @@ -66,11 +72,7 @@ export default {
profile() {
return this.$store.state.profile;
},
name(){
return this.profile.Recipient.ProfileGivenName !== ""
? this.profile.Recipient.ProfileGivenName
: this.profile.Recipient.Username?this.profile.Recipient.Username:"Unknow user"
}
},
mounted() {
this.$store.dispatch("getProfile", this.profileId);
Expand All @@ -86,7 +88,7 @@ export default {
},
createChat() {
this.$store.dispatch("createChatForRecipient", {
id: this.profile.Recipient.Id,
id: this.profile.uuid,
});
},
},
Expand Down
2 changes: 1 addition & 1 deletion axolotl-web/src/router/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const router = new createRouter({
hasBackButton: true,
},
props: route => ({
profileId: Number(route.params.id),
profileId: route.params.id,
}),
component: () => import("@/pages/Profile.vue")
},
Expand Down
Loading

0 comments on commit 25729f2

Please sign in to comment.