group chat about text

This commit is contained in:
Martti Malmi 2021-02-13 00:08:47 +02:00
parent cf69c90f86
commit 96567f15ff
3 changed files with 7 additions and 3 deletions

View File

@ -295,6 +295,7 @@ function addChannel(chat) {
chat.participantProfiles = {};
chat.on('name', v => State.local.get('channels').get(chat.uuid).get('name').put(v));
chat.on('photo', v => State.local.get('channels').get(chat.uuid).get('photo').put(v));
chat.on('about', v => State.local.get('channels').get(chat.uuid).get('about').put(v));
chat.onMy('participants', participants => {
if (typeof participants === 'object') {
var keys = Object.keys(participants);

View File

@ -73,7 +73,6 @@ class ChatView extends Component {
this.iv = setInterval(go, 3000);
State.local.get('channels').get(this.props.id).get('participants').map().on((v, k, b, e) => {
console.log(3, k);
this.eventListeners['participants'] = e;
this.participants[k] = true;
this.setState({participants: this.participants});

View File

@ -50,6 +50,7 @@ class Header extends Component {
this.setState({unseenTotal});
});
State.local.get('activeRoute').on(activeRoute => {
this.setState({about:null});
this.eventListeners.forEach(e => e.off());
this.eventListeners = [];
this.setState({activeRoute});
@ -75,6 +76,10 @@ class Header extends Component {
this.eventListeners.push(eve);
this.setState({title: name});
});
State.local.get('channels').get(this.chatId).get('about').on((about, a, b, eve) => {
this.eventListeners.push(eve);
this.setState({about});
});
}
} else {
this.setState({title});
@ -99,7 +104,6 @@ class Header extends Component {
const activeRoute = this.state.activeRoute;
const chat = Session.channels[this.chatId];
const isTyping = chat && chat.isTyping;
const about = chat && chat.about;
const onlineStatus = !(chat && chat.uuid) && activeRoute && activeRoute.length > 20 && !isTyping && this.getOnlineStatusText();
const key = Session.getKey().pub;
const searchBox = this.chatId ? '' : html`<${SearchBox}/>`;
@ -125,7 +129,7 @@ class Header extends Component {
</div>
`: ''}
${isTyping ? html`<small class="typing-indicator">${t('typing')}</small>` : ''}
${about ? html`<small class="participants">${about}</small>` : ''}
${this.state.about ? html`<small class="participants">${this.state.about}</small>` : ''}
${this.chatId ? html`<small class="last-seen">${onlineStatus || ''}</small>` : ''}
${searchBox}
</div>