Browse Source

fixed personals histories

master
nicolas-arnaud 2 years ago
parent
commit
0da5988b7d
  1. 1
      back/volume/src/chat/entity/channel.entity.ts
  2. 11
      front/volume/src/App.svelte
  3. 2
      front/volume/src/components/Profile.svelte

1
back/volume/src/chat/entity/channel.entity.ts

@ -30,6 +30,7 @@ export default class Channel {
@BeforeInsert() @BeforeInsert()
async hashPassword () { async hashPassword () {
if (this.password === '') return
this.password = await bcrypt.hash( this.password = await bcrypt.hash(
this.password, this.password,
Number(process.env.HASH_SALT) Number(process.env.HASH_SALT)

11
front/volume/src/App.svelte

@ -61,7 +61,7 @@
setAppState(APPSTATE.PROFILE); setAppState(APPSTATE.PROFILE);
} }
let profileUsername: string; let profileUsername: string = "";
async function openIdProfile(event: CustomEvent<string>) { async function openIdProfile(event: CustomEvent<string>) {
profileUsername = event.detail; profileUsername = event.detail;
setAppState(APPSTATE.PROFILE_ID); setAppState(APPSTATE.PROFILE_ID);
@ -71,10 +71,6 @@
setAppState(APPSTATE.HISTORY); setAppState(APPSTATE.HISTORY);
} }
async function openIdHistory() {
setAppState(APPSTATE.HISTORY_ID);
}
async function clickFriends() { async function clickFriends() {
setAppState(APPSTATE.FRIENDS); setAppState(APPSTATE.FRIENDS);
} }
@ -86,7 +82,6 @@
function clickChannels() { function clickChannels() {
setAppState(APPSTATE.CHANNELS); setAppState(APPSTATE.CHANNELS);
} }
let channels: Array<ChannelsType> = [];
let selectedChannel: ChannelsType; let selectedChannel: ChannelsType;
const handleSelectChannel = (channel: ChannelsType) => { const handleSelectChannel = (channel: ChannelsType) => {
selectedChannel = channel; selectedChannel = channel;
@ -177,7 +172,7 @@
{/if} {/if}
{#if appState === APPSTATE.PROFILE} {#if appState === APPSTATE.PROFILE}
<div on:click={resetAppState} on:keydown={resetAppState}> <div on:click={resetAppState} on:keydown={resetAppState}>
<Profile on:view-history={openIdHistory} /> <Profile on:view-history={() => setAppState(APPSTATE.HISTORY_ID)} />
</div> </div>
{/if} {/if}
{#if appState === APPSTATE.PROFILE_ID} {#if appState === APPSTATE.PROFILE_ID}
@ -187,7 +182,7 @@
on:keydown={() => on:keydown={() =>
setAppState(APPSTATE.CHANNELS + "#" + selectedChannel.name)} setAppState(APPSTATE.CHANNELS + "#" + selectedChannel.name)}
> >
<Profile username={profileUsername} on:view-history={openIdHistory} /> <Profile username={profileUsername} on:view-history={() => setAppState(APPSTATE.HISTORY_ID)} />
</div> </div>
{/if} {/if}

2
front/volume/src/components/Profile.svelte

@ -96,7 +96,7 @@
</div> </div>
<div class="profile-body"> <div class="profile-body">
<p> <p>
<button on:click={() => dispatch("view-history", user.ftId)} <button on:click={() => dispatch("view-history", user.username)}
>View History</button >View History</button
> >
</p> </p>

Loading…
Cancel
Save