MatheusrdSantos / vue-quick-chat

A simple chat component created with Vue.js
MIT License
128 stars 45 forks source link

set myself depending on participantId #23

Closed Qanah closed 4 years ago

Qanah commented 4 years ago

Hay Guys

I try to make the component work automatically without add extra code from the user

newMessage: (state, message) => {
    message.timestamp = moment(message.timestamp);
    message.myself = message.participantId === state.myself.id;
    state.messages = [...state.messages, message];
}

setMessages: (state, messages) => {
    messages.map(message => {
        message.timestamp = moment(message.timestamp);
        message.myself = message.participantId === state.myself.id;
    });
    state.messages = messages;
}
MatheusrdSantos commented 4 years ago

Hi, @Qanah! I agree with your changes. Please, fix the PR as I commented. After the fixes, I'll merge your PR.

Qanah commented 4 years ago

Hi, @MatheusrdSantos Please check now.

MatheusrdSantos commented 4 years ago

@Qanah, thanks for your contribution. I'll release a new version with your changes.