fix membership and unsupported event info

master
adb 4 years ago
parent bf286929cb
commit ec4bdbbec4

@ -5,9 +5,9 @@
<event-content :content="event.content"/> <event-content :content="event.content"/>
<div class="time">{{getTime(event.origin_server_ts)}}</div> <div class="time">{{getTime(event.origin_server_ts)}}</div>
</div> </div>
<div v-else class="info"> <div v-else :class="type==='send'?'info send':'info receive'">
<span v-if="event.type==='m.room.member'">{{membershipEvents[event.content.membership](event)}}</span> <span v-if="event.type==='m.room.member'">{{membershipEvents[event.content.membership](event)}}</span>
<span v-else>unsupported event</span> <span v-else>unsupported event: {{event.type}}</span>
<span class="time"> {{getTime(event.origin_server_ts)}}</span> <span class="time"> {{getTime(event.origin_server_ts)}}</span>
</div> </div>
</div> </div>
@ -49,10 +49,12 @@ export default {
return{ return{
replyEvent: undefined, replyEvent: undefined,
membershipEvents:{ membershipEvents:{
invite(event){ return `invited ${calcUserName(event.target.userId)}` }, invite(event){ return `invited ${event.target?calcUserName(event.target.userId):event.content.displayname||event.state_key}` },
join(event){ join(event){
if (event.content.displayname !== null) return `changed username to ${event.content.displayname}` if (!event.unsigned.prev_content) return 'joined the room';
return 'joined the room' if (event.unsigned.prev_content.displayName !== event.content.displayname)
return `changed displayname from ${event.unsigned.prev_content.displayname} to ${event.content.displayname}`;
return 'updated their account';
}, },
leave(){ return 'left the room' }, leave(){ return 'left the room' },
ban(event){return `banned ${calcUserName(event.target.userId)}` } ban(event){return `banned ${calcUserName(event.target.userId)}` }
@ -79,6 +81,9 @@ export default {
font-size: 0.7rem; font-size: 0.7rem;
} }
} }
.info.send{
text-align: right;
}
.message{ .message{
position: relative; position: relative;
width: max-content; width: max-content;

@ -36,7 +36,8 @@
</video><br> </video><br>
{{content.body}} {{content.body}}
</div> </div>
<div v-else class="italic">unsupported message type {{content.msgtype}}</div> <div v-else-if="content.msgtype" class="italic">unsupported message type: {{content.msgtype}}</div>
<div v-else class="italic">deleted message</div>
</template> </template>
<script> <script>

Loading…
Cancel
Save