Merge branch 'dev'

This commit is contained in:
n8fr8 2022-05-02 16:05:27 -04:00
commit 4f1dd68810
18 changed files with 478 additions and 323 deletions

View file

@ -63,6 +63,13 @@ export default {
}) })
.catch((error) => { .catch((error) => {
console.log("Error creating client", error); console.log("Error creating client", error);
if (error.data.errcode ==='M_FORBIDDEN' && this.currentUser.is_guest) {
// Guest account and password don't work. We are in a strange state, probably because
// of server cleanup of accounts or similar. Wipe account and restart...
this.$store.commit("setUser", null);
this.$store.commit("setCurrentRoomId", null);
this.$navigation.push({ path: "/login" }, -1);
}
}) })
.finally(() => { .finally(() => {
this.loading = false; this.loading = false;
@ -87,16 +94,19 @@ export default {
// Assigns available language for ex 'zh_Hans' when browser header language is 'zh' or 'zh-HK' // Assigns available language for ex 'zh_Hans' when browser header language is 'zh' or 'zh-HK'
this.availableJsonTranslation= LocalesArr[LocalesArr.findIndex(locale => locale.includes(lang))]; this.availableJsonTranslation= LocalesArr[LocalesArr.findIndex(locale => locale.includes(lang))];
if (this.$i18n.messages[this.browserLanguage]) { if (!this.$store.state.language) {
this.$store.commit("setLanguage", this.browserLanguage); // Set default language if not set already
} else if (this.browserLanguage.includes("-")) { if (this.$i18n.messages[this.browserLanguage]) {
if (this.$i18n.messages[lang]) { this.$store.commit("setLanguage", this.browserLanguage);
this.$store.commit("setLanguage", lang); } else if (this.browserLanguage.includes("-")) {
if (this.$i18n.messages[lang]) {
this.$store.commit("setLanguage", lang);
} else {
this.$store.commit("setLanguage", this.availableJsonTranslation);
}
} else { } else {
this.$store.commit("setLanguage", this.availableJsonTranslation); this.$store.commit("setLanguage", this.availableJsonTranslation);
} }
} else {
this.$store.commit("setLanguage", this.availableJsonTranslation);
} }
// Set language // Set language

View file

@ -18,3 +18,9 @@
.white-space-pre { .white-space-pre {
white-space: pre; white-space: pre;
} }
.v-visible {
visibility: visible;
}
.v-hidden {
visibility: hidden;
}

View file

@ -115,6 +115,11 @@ $admin-fg: white;
background-color: $chat-background; background-color: $chat-background;
overflow: hidden; overflow: hidden;
.chat-room-invitations {
padding: 10px;
background-color: #f2f2f2;
}
.chat-content { .chat-content {
margin: 0; margin: 0;
padding-top: $chat-standard-padding-s; padding-top: $chat-standard-padding-s;
@ -818,7 +823,9 @@ $admin-fg: white;
} }
.filled-button { .filled-button {
min-width: 180px !important; @media #{map-get($display-breakpoints, 'sm-and-up')} {
min-width: 180px !important;
}
} }
.v-card { .v-card {
@ -826,6 +833,14 @@ $admin-fg: white;
border-radius: 20px; border-radius: 20px;
} }
.member .user-name {
margin-left: 6px;
}
.member .start-private-chat {
margin-left: 38px;
}
.member::after { .member::after {
content: " "; content: " ";
display: block; display: block;

View file

@ -161,4 +161,8 @@
@media #{map-get($display-breakpoints, 'sm-and-down')} { @media #{map-get($display-breakpoints, 'sm-and-down')} {
margin: 10px; margin: 10px;
} }
@media #{map-get($display-breakpoints, 'md-and-up')} {
width: $main-desktop-width;
margin: 0 auto;
}
} }

View file

@ -1,235 +1,237 @@
{ {
"language_display_name": "English", "language_display_name": "English",
"project": { "project": {
"name": "Convene", "name": "Convene",
"tag_line": "Simply connect" "tag_line": "Simply connect"
}, },
"menu": { "menu": {
"start_private_chat": "Private chat with this user", "start_private_chat": "Private chat with this user",
"reply": "Reply", "reply": "Reply",
"edit": "Edit", "edit": "Edit",
"delete": "Delete", "delete": "Delete",
"download": "Download", "download": "Download",
"ok": "Ok", "ok": "Ok",
"done": "Done", "done": "Done",
"cancel": "Cancel", "cancel": "Cancel",
"send": "Send", "send": "Send",
"back": "BACK", "back": "BACK",
"login": "Login", "login": "Login",
"logout": "Logout", "logout": "Logout",
"new_room": "New Room", "new_room": "New Room",
"undo": "Undo", "undo": "Undo",
"join": "Join", "join": "Join",
"ignore": "Ignore", "ignore": "Ignore",
"loading": "Loading {appName}" "loading": "Loading {appName}"
}, },
"message": { "message": {
"you": "You", "you": "You",
"user_created_room": "{user} created the room", "user_created_room": "{user} created the room",
"user_aliased_room": "{user} made the room alias {alias}", "user_aliased_room": "{user} made the room alias {alias}",
"user_changed_display_name": "{user} changed display name to {displayName}", "user_changed_display_name": "{user} changed display name to {displayName}",
"user_changed_avatar": "{user} changed the avatar", "user_changed_avatar": "{user} changed the avatar",
"user_changed_room_avatar": "{user} changed the room avatar", "user_changed_room_avatar": "{user} changed the room avatar",
"user_encrypted_room": "{user} made the room encrypted", "user_encrypted_room": "{user} made the room encrypted",
"user_was_invited": "{user} was invited to the chat...", "user_was_invited": "{user} was invited to the chat...",
"user_joined": "{user} joined the chat", "user_joined": "{user} joined the chat",
"user_left": "{user} left the chat", "user_left": "{user} left the chat",
"user_said": "{user} said:", "user_said": "{user} said:",
"file_prefix": "File: ", "file_prefix": "File: ",
"edited": "(edited)", "edited": "(edited)",
"download_progress": "{percentage}% downloaded", "download_progress": "{percentage}% downloaded",
"upload_progress": "Uploaded {count}", "upload_progress": "Uploaded {count}",
"upload_progress_with_total": "Uploaded {count} of {total}", "upload_progress_with_total": "Uploaded {count} of {total}",
"user_changed_room_history": "{user} made room history {type}", "user_changed_room_history": "{user} made room history {type}",
"room_history_world_readable": "readable by anyone", "room_history_world_readable": "readable by anyone",
"room_history_shared": "readable to all members in the room", "room_history_shared": "readable to all members in the room",
"room_history_invited": "readable to members from when they were invited", "room_history_invited": "readable to members from when they were invited",
"room_history_joined": "readable to members from when they joined", "room_history_joined": "readable to members from when they joined",
"user_changed_join_rules": "{user} made the room {type}", "user_changed_join_rules": "{user} made the room {type}",
"room_joinrule_invite": "invite only", "room_joinrule_invite": "invite only",
"room_joinrule_public": "public", "room_joinrule_public": "public",
"user_changed_room_name": "{user} changed room name to {name}", "user_changed_room_name": "{user} changed room name to {name}",
"user_changed_room_topic": "{user} changed room topic to {topic}", "user_changed_room_topic": "{user} changed room topic to {topic}",
"unread_messages": "Unread messages", "unread_messages": "Unread messages",
"replying_to": "Replying to {user}", "replying_to": "Replying to {user}",
"your_message": "Your message...", "your_message": "Your message...",
"scale_image": "Scale image", "scale_image": "Scale image",
"user_is_typing": "{user} is typing", "user_is_typing": "{user} is typing",
"users_are_typing": "{count} members are typing", "users_are_typing": "{count} members are typing",
"room_powerlevel_change": "{user} changed powerlevel of {changes}", "room_powerlevel_change": "{user} changed powerlevel of {changes}",
"user_powerlevel_change_from_to": "{user} from {powerOld} to {powerNew}", "user_powerlevel_change_from_to": "{user} from {powerOld} to {powerNew}",
"user_changed_guest_access_closed": "{user} disallowed guests to join the room", "user_changed_guest_access_closed": "{user} disallowed guests to join the room",
"user_changed_guest_access_open": "{user} allowed guests to join the room", "user_changed_guest_access_open": "{user} allowed guests to join the room",
"reply_image": "Image", "reply_image": "Image",
"reply_audio_message": "Audio message", "reply_audio_message": "Audio message",
"reply_video": "Video" "reply_video": "Video",
}, "time_ago": "Today | Yesterday | {count} days ago"
"room": { },
"members": "no members | 1 member | {count} members", "room": {
"leave": "Leave", "invitations": "You have no invitations | You have 1 invitation | You have {count} invitations",
"purge_set_room_state": "Setting room state", "members": "no members | 1 member | {count} members",
"purge_redacting_events": "Redacting events", "leave": "Leave",
"purge_removing_members": "Removing members", "purge_set_room_state": "Setting room state",
"purge_failed": "Failed to purge room!", "purge_redacting_events": "Redacting events",
"room_list_invites": "Invites", "purge_removing_members": "Removing members",
"room_list_rooms": "Rooms" "purge_failed": "Failed to purge room!",
}, "room_list_invites": "Invites",
"room_welcome": { "room_list_rooms": "Rooms"
"info": "Welcome! Here are a few things to know about your room:", },
"encrypted": "Messages are end-to-end encrypted.", "room_welcome": {
"room_history_is": "Room history is {type}.", "info": "Welcome! Here are a few things to know about your room:",
"room_history_joined": "People can only see the messages sent after they join.", "encrypted": "Messages are end-to-end encrypted.",
"join_public": "Anyone can join by opening this link: {link}.", "room_history_is": "Room history is {type}.",
"join_invite": "Only people you invite can join.", "room_history_joined": "People can only see the messages sent after they join.",
"info_permissions": "You can change join permissions at any time in the room settings.", "join_public": "Anyone can join by opening this link: {link}.",
"got_it": "Got it" "join_invite": "Only people you invite can join.",
}, "info_permissions": "You can change join permissions at any time in the room settings.",
"new_room": { "got_it": "Got it"
"new_room": "New Room", },
"create": "Create", "new_room": {
"next": "Next", "new_room": "New Room",
"name_room": "Name room", "create": "Create",
"room_topic": "Add a description if you like", "next": "Next",
"join_permissions": "Join permissions", "name_room": "Name room",
"set_join_permissions": "Set Join Permissions", "room_topic": "Add a description if you like",
"join_permissions_info": "These permissions determine how people can join the room and how easily others can be invited. They can be changed anytime.", "join_permissions": "Join permissions",
"get_link": "Get link", "set_join_permissions": "Set Join Permissions",
"add_people": "Add people", "join_permissions_info": "These permissions determine how people can join the room and how easily others can be invited. They can be changed anytime.",
"link_copied": "Link copied!", "get_link": "Get link",
"public_info": "Anyone with a link", "add_people": "Add people",
"public_description": "Get a link to share", "link_copied": "Link copied!",
"invite_info": "Only people added", "public_info": "Anyone with a link",
"invite_description": "Choose from a list or search by account ID", "public_description": "Get a link to share",
"status_creating": "Creating room", "invite_info": "Only people added",
"status_avatar_total": "Uploading avatar: {count} of {total}", "invite_description": "Choose from a list or search by account ID",
"status_avatar": "Uploading avatar: {count}" "status_creating": "Creating room",
}, "status_avatar_total": "Uploading avatar: {count} of {total}",
"device_list": { "status_avatar": "Uploading avatar: {count}"
"title": "DEVICES", },
"blocked": "Blocked", "device_list": {
"verified": "Verified", "title": "DEVICES",
"not_verified": "Not verified" "blocked": "Blocked",
}, "verified": "Verified",
"login": { "not_verified": "Not verified"
"title": "Login", },
"username": "Username (ex: marta)", "login": {
"password": "Enter Password", "title": "Login",
"username_required": "Username is required", "username": "Username (ex: marta)",
"password_required": "Password is required", "password": "Enter Password",
"login": "Login", "username_required": "Username is required",
"create_room": "Register & Create Room", "password_required": "Password is required",
"or": "OR", "login": "Login",
"invalid_message": "Invalid username or password" "create_room": "Register & Create Room",
}, "or": "OR",
"profile": { "invalid_message": "Invalid username or password"
"title": "My Profile", },
"temporary_identity": "This identity is temporary. Set a password to use it again", "profile": {
"set_password": "Set password", "title": "My Profile",
"change_name": "Change name", "temporary_identity": "This identity is temporary. Set a password to use it again",
"change_password": "Change password", "set_password": "Set password",
"select_language": "Language", "change_name": "Change name",
"set_language": "Set your language", "change_password": "Change password",
"language_description": "Convene is available in many languages.", "select_language": "Language",
"dont_see_yours": "Don't see yours?", "set_language": "Set your language",
"tell_us": "Tell us.", "language_description": "Convene is available in many languages.",
"password_old": "Old password", "dont_see_yours": "Don't see yours?",
"password_new": "New password", "tell_us": "Tell us.",
"password_repeat": "Repeat new password", "password_old": "Old password",
"display_name": "Display name" "password_new": "New password",
}, "password_repeat": "Repeat new password",
"profile_info_popup": { "display_name": "Display name"
"you_are": "You are", },
"identity": "{displayName}", "profile_info_popup": {
"identity_temporary": "{displayName}", "you_are": "You are",
"edit_profile": "Edit profile", "identity": "{displayName}",
"logout": "Logout", "identity_temporary": "{displayName}",
"want_more": "Want more?", "edit_profile": "Edit profile",
"powered_by": "This room is powered by {product}. Learn more at {productLink} or go ahead and create another room!", "logout": "Logout",
"new_room": "+ New room" "want_more": "Want more?",
}, "powered_by": "This room is powered by {product}. Learn more at {productLink} or go ahead and create another room!",
"join": { "new_room": "+ New room"
"title": "Welcome you have been invited to join", },
"user_name_label": "User name", "join": {
"remember_me": "Remember me", "title": "Welcome you have been invited to join",
"joining_as": "You are joining as:", "user_name_label": "User name",
"join": "Join room", "remember_me": "Remember me",
"enter_room": "Enter room", "joining_as": "You are joining as:",
"status_logging_in": "Logging in...", "join": "Join room",
"status_joining": "Joining room...", "enter_room": "Enter room",
"join_failed": "Failed to join room." "status_logging_in": "Logging in...",
}, "status_joining": "Joining room...",
"invite": { "join_failed": "Failed to join room."
"title": "Add Friends", },
"done": "Done", "invite": {
"send_invites_to": "Send invites to", "title": "Add Friends",
"status_inviting": "Inviting friend {index} of {count}", "done": "Done",
"status_error": "Failed to invite one or or more friends!" "send_invites_to": "Send invites to",
}, "status_inviting": "Inviting friend {index} of {count}",
"leave": { "status_error": "Failed to invite one or or more friends!"
"title_public": "Goodbye, {user}", },
"text_public": "You can always join this room again if you know the link.", "leave": {
"text_public_lastroom": "If you want to join this room again, you can join under a new identity. To keep {user}, {action}.", "title_public": "Goodbye, {user}",
"title_invite": "Are you sure you want to leave?", "text_public": "You can always join this room again if you know the link.",
"text_invite": "This room is locked. You cannot rejoin without a special permission.", "text_public_lastroom": "If you want to join this room again, you can join under a new identity. To keep {user}, {action}.",
"create_account": "create an account", "title_invite": "Are you sure you want to leave?",
"go_back": "Go back", "text_invite": "This room is locked. You cannot rejoin without a special permission.",
"leave": "Leave" "create_account": "create an account",
}, "go_back": "Go back",
"purge_room": { "leave": "Leave"
"title": "Delete room?", },
"info": "All members and messages will be removed. This action cannot be undone.", "purge_room": {
"button": "Delete", "title": "Delete room?",
"n_seconds": "{seconds} seconds", "info": "All members and messages will be removed. This action cannot be undone.",
"self_destruct": "Room will self destruct in seconds.", "button": "Delete",
"deleting": "Deleting room:", "n_seconds": "{seconds} seconds",
"notified": "We've notified members.", "self_destruct": "Room will self destruct in seconds.",
"room_deletion_notice": "Time to say goodbye! This room has been deleted by {user}. It will self destruct in seconds." "deleting": "Deleting room:",
}, "notified": "We've notified members.",
"goodbye": { "room_deletion_notice": "Time to say goodbye! This room has been deleted by {user}. It will self destruct in seconds."
"room_deleted": "Room deleted.", },
"close_tab": "Close browser tab", "goodbye": {
"view_other_rooms": "View other rooms" "room_deleted": "Room deleted.",
}, "close_tab": "Close browser tab",
"room_info": { "view_other_rooms": "View other rooms"
"title": "Room Details", },
"created_by": "Created by {user}", "room_info": {
"permissions": "Join Permissions", "title": "Room Details",
"join_invite": "Only People Added", "created_by": "Created by {user}",
"join_public": "Anyone with a link", "permissions": "Join Permissions",
"copy_link": "Copy invite link", "join_invite": "Only People Added",
"link_copied": "Link copied!", "join_public": "Anyone with a link",
"purge": "Delete room", "copy_link": "Copy invite link",
"members": "Members", "link_copied": "Link copied!",
"user": "{user}", "purge": "Delete room",
"user_you": "{user} (you)", "members": "Members",
"hide_all": "Hide", "user": "{user}",
"show_all": "Show all >", "user_you": "{user} (you)",
"leave_room": "Leave", "hide_all": "Hide",
"version_info": "Powered by Guardian Project. Version: {version}", "show_all": "Show all >",
"scan_code": "Scan to join the room" "leave_room": "Leave",
}, "version_info": "Powered by Guardian Project. Version: {version}",
"room_info_sheet": { "scan_code": "Scan to join the room"
"this_room": "This room", },
"view_details": "View details" "room_info_sheet": {
}, "this_room": "This room",
"voice_recorder": { "view_details": "View details"
"swipe_to_cancel": "Swipe to cancel", },
"release_to_cancel": "Release to cancel", "voice_recorder": {
"failed_to_record": "Failed to record audio", "swipe_to_cancel": "Swipe to cancel",
"not_supported_title": "Not supported", "release_to_cancel": "Release to cancel",
"not_supported_text": "Unfortunately, this browser does not support audio recording." "failed_to_record": "Failed to record audio",
}, "not_supported_title": "Not supported",
"power_level": { "not_supported_text": "Unfortunately, this browser does not support audio recording."
"admin": "administrator", },
"moderator": "moderator", "power_level": {
"default": "default", "admin": "administrator",
"custom": "custom ({level})", "moderator": "moderator",
"restricted": "restricted" "default": "default",
}, "custom": "custom ({level})",
"fallbacks": { "restricted": "restricted"
"audio_file": "Audio file", },
"video_file": "Video file", "fallbacks": {
"original_text": "<original text>", "audio_file": "Audio file",
"download_name": "Download" "video_file": "Video file",
} "original_text": "<original text>",
"download_name": "Download"
}
} }

View file

@ -48,6 +48,7 @@ export default {
mc: null, mc: null,
y: 0, y: 0,
startY: 0, startY: 0,
startYCoord: 0,
isMove: false, isMove: false,
state: this.defaultState, state: this.defaultState,
rect: {}, rect: {},
@ -65,14 +66,20 @@ export default {
const self = this; const self = this;
this.mc.on("panup pandown", (evt) => { this.mc.on("panup pandown", (evt) => {
self.y = evt.center.y - 16; self.y = self.startYCoord - (self.startY - evt.center.y);
}); });
this.mc.on("panstart", (evt) => { this.mc.on("panstart", (evt) => {
self.startY = evt.center.y; self.startY = evt.center.y;
self.startYCoord = this.calcY();
self.isMove = true; self.isMove = true;
}); });
this.mc.on("pancancel", (ignoredEvt) => {
self.y = self.startYCoord;
self.isMove = false;
});
this.mc.on("panend", (evt) => { this.mc.on("panend", (evt) => {
self.isMove = false; self.isMove = false;

View file

@ -1,5 +1,8 @@
<template> <template>
<div class="chat-root fill-height d-flex flex-column"> <div class="chat-root fill-height d-flex flex-column">
<div class="chat-room-invitations clickable" v-if="invitationCount > 0" @click.stop="onInvitationsClick">
{{ $tc("room.invitations", invitationCount)}}
</div>
<ChatHeader <ChatHeader
class="chat-header flex-grow-0 flex-shrink-0" class="chat-header flex-grow-0 flex-shrink-0"
v-on:header-click="onHeaderClick" v-on:header-click="onHeaderClick"
@ -137,7 +140,7 @@
<div v-if="replyToEvent" class="row"> <div v-if="replyToEvent" class="row">
<div class="col"> <div class="col">
<div class="font-weight-medium">{{ $t("message.replying_to", { user: replyToEvent.sender.name }) }}</div> <div class="font-weight-medium">{{ $t("message.replying_to", { user: replyToEvent.sender.name }) }}</div>
<div v-if="replyToContentType === 'm.text'" class="reply-text" :title="replyToEvent.getContent().body"> {{ replyToEvent.getContent().body }} </div> <div v-if="replyToContentType === 'm.text'" class="reply-text" :title="replyToEvent.getContent().body"> {{ replyToEvent.getContent().body | latestReply }} </div>
<div v-if="replyToContentType === 'm.image'"> {{ $t("message.reply_image") }} </div> <div v-if="replyToContentType === 'm.image'"> {{ $t("message.reply_image") }} </div>
<div v-if="replyToContentType === 'm.audio'"> {{ $t("message.reply_audio_message") }} </div> <div v-if="replyToContentType === 'm.audio'"> {{ $t("message.reply_audio_message") }} </div>
<div v-if="replyToContentType === 'm.video'"> {{ $t("message.reply_video") }} </div> <div v-if="replyToContentType === 'm.video'"> {{ $t("message.reply_video") }} </div>
@ -643,6 +646,16 @@ export default {
}; };
}, },
filters: {
latestReply(contents) {
const contentArr = contents.split('\n').reverse();
if (contentArr[0] === '') {
contentArr.shift();
}
return contentArr[0].replace(/^> (<.*> )?/g, '');
}
},
mounted() { mounted() {
const container = this.$refs.chatContainer; const container = this.$refs.chatContainer;
this.scrollPosition = new ScrollPosition(container); this.scrollPosition = new ScrollPosition(container);
@ -750,6 +763,9 @@ export default {
debugging() { debugging() {
return (window.location.host || "").startsWith("localhost"); return (window.location.host || "").startsWith("localhost");
}, },
invitationCount() {
return this.$matrix.invites.length;
}
}, },
watch: { watch: {
@ -771,6 +787,7 @@ export default {
this.timelineWindow = null; this.timelineWindow = null;
this.typingMembers = []; this.typingMembers = [];
this.initialLoadDone = false; this.initialLoadDone = false;
this.showCreatedRoomWelcomeHeader = false;
// Stop RR timer // Stop RR timer
this.stopRRTimer(); this.stopRRTimer();
@ -814,8 +831,8 @@ export default {
this.$refs.messageOperationsStrut.getBoundingClientRect(); this.$refs.messageOperationsStrut.getBoundingClientRect();
var rectOps = var rectOps =
this.$refs.messageOperations.$el.getBoundingClientRect(); this.$refs.messageOperations.$el.getBoundingClientRect();
top = rectAnchor.top - rectChat.top; top = rectAnchor.top - rectChat.top - 50;
left = rectAnchor.left - rectChat.left; left = rectAnchor.left - rectChat.left - 30;
if (left + rectOps.width >= rectChat.right) { if (left + rectOps.width >= rectChat.right) {
left = rectChat.right - rectOps.width - 10; // No overflow left = rectChat.right - rectOps.width - 10; // No overflow
} }
@ -1581,7 +1598,7 @@ export default {
const event = e.event; const event = e.event;
this.selectedEvent = event; this.selectedEvent = event;
this.updateRecentEmojis(); this.updateRecentEmojis();
this.showContextMenu = true; this.showContextMenu = !this.showContextMenu;
this.showContextMenuAnchor = e.anchor; this.showContextMenuAnchor = e.anchor;
}, },
@ -1597,6 +1614,7 @@ export default {
}, },
startPrivateChat(e) { startPrivateChat(e) {
this.loading = true;
this.$matrix this.$matrix
.getOrCreatePrivateChat(e.event.getSender()) .getOrCreatePrivateChat(e.event.getSender())
.then((room) => { .then((room) => {
@ -1616,6 +1634,9 @@ export default {
}) })
.catch((err) => { .catch((err) => {
console.error(err); console.error(err);
})
.finally(() => {
this.loading = false;
}); });
}, },
@ -1718,7 +1739,12 @@ export default {
}, },
dayForEvent(event) { dayForEvent(event) {
return util.formatDay(event.getTs()); let dayDiff = util.dayDiffToday(event.getTs());
if (dayDiff < 7) {
return this.$tc("message.time_ago", dayDiff);
} else {
return util.formatDay(event.getTs());
}
}, },
showRecordingUI() { showRecordingUI() {
@ -1787,6 +1813,9 @@ export default {
} }
this.$refs.roomInfoSheet.open(); this.$refs.roomInfoSheet.open();
}, },
onInvitationsClick() {
this.$navigation.push({ name: "Home" }, -1);
}
}, },
}; };
</script> </script>

View file

@ -22,9 +22,25 @@
<div class="num-members">{{ $tc("room.members", memberCount) }}</div> <div class="num-members">{{ $tc("room.members", memberCount) }}</div>
</v-col> </v-col>
<v-col cols="auto" class="text-end ma-0 pa-0"> <v-col cols="auto" class="text-end ma-0 pa-0">
<v-btn id="btn-leave-room" text class="leave-button" @click.stop="leaveRoom">{{ <v-btn
$t("room.leave") id="btn-purge-room"
}}</v-btn> v-if="userCanPurgeRoom"
color="red"
depressed
class="filled-button"
@click.stop="showPurgeConfirmation = true"
>
{{ $t("room_info.purge") }}
</v-btn>
<v-btn
id="btn-leave-room"
text
class="leave-button"
@click.stop="leaveRoom"
v-else
>
{{ $t("room.leave") }}
</v-btn>
</v-col> </v-col>
<v-col cols="auto" class="text-end ma-0 pa-0 ms-2"> <v-col cols="auto" class="text-end ma-0 pa-0 ms-2">
<v-avatar <v-avatar
@ -51,6 +67,12 @@
:show="showProfileInfo" :show="showProfileInfo"
@close="showProfileInfo = false" @close="showProfileInfo = false"
/> />
<!-- PURGE ROOM POPUP -->
<PurgeRoomDialog
:show="showPurgeConfirmation"
:room="room"
@close="showPurgeConfirmation = false"
/>
</v-container> </v-container>
</template> </template>
@ -58,19 +80,24 @@
import LeaveRoomDialog from "../components/LeaveRoomDialog"; import LeaveRoomDialog from "../components/LeaveRoomDialog";
import ProfileInfoPopup from "../components/ProfileInfoPopup"; import ProfileInfoPopup from "../components/ProfileInfoPopup";
import profileInfoMixin from "../components/profileInfoMixin"; import profileInfoMixin from "../components/profileInfoMixin";
import PurgeRoomDialog from "../components/PurgeRoomDialog";
import roomInfoMixin from "./roomInfoMixin";
export default { export default {
name: "ChatHeader", name: "ChatHeader",
mixins: [profileInfoMixin], mixins: [profileInfoMixin, roomInfoMixin],
components: { components: {
LeaveRoomDialog, LeaveRoomDialog,
ProfileInfoPopup, ProfileInfoPopup,
PurgeRoomDialog
}, },
data() { data() {
return { return {
memberCount: null, memberCount: null,
showLeaveConfirmation: false, showLeaveConfirmation: false,
showProfileInfo: false, showProfileInfo: false,
showPurgeConfirmation: false
}; };
}, },
mounted() { mounted() {

View file

@ -12,7 +12,7 @@
:disabled="step > steps.NAME_SET" :disabled="step > steps.NAME_SET"
> >
<v-icon>arrow_back</v-icon> <v-icon>arrow_back</v-icon>
<span>{{ $t("menu.back") }}</span> <span class="d-none d-sm-block">{{ $t("menu.back") }}</span>
</v-btn> </v-btn>
<!-- <v-btn <!-- <v-btn
text text

View file

@ -4,7 +4,18 @@
<div class="mt-2" v-if="roomJoinRule == 'public'"> <div class="mt-2" v-if="roomJoinRule == 'public'">
<i18n path="room_welcome.join_public" tag="span"> <i18n path="room_welcome.join_public" tag="span">
<template v-slot:link> <template v-slot:link>
<a :href="publicRoomLink" class="text-break">{{ publicRoomLink }}</a> <div style="position:relative;display:inline-block">
<a @click.stop="copyPublicLink" :href="publicRoomLink" class="text-break">{{ publicRoomLink }}</a>
<v-btn
v-if="publicRoomLinkCopied"
id="btn-copy-room-link"
color="#444444"
depressed
style="position:absolute;left:0;top:0"
class="filled-button link-copied-in-place"
>{{ $t("room_info.link_copied") }}</v-btn
>
</div>
</template> </template>
</i18n> </i18n>
</div> </div>
@ -54,6 +65,29 @@ export default {
return null; return null;
}, },
}, },
data() {
return {
publicRoomLinkCopied: false
}
},
methods: {
copyPublicLink() {
const self = this;
this.$copyText(this.publicRoomLink).then(
function (ignored) {
// Success!
self.publicRoomLinkCopied = true;
setInterval(() => {
// Hide again
self.publicRoomLinkCopied = false;
}, 3000);
},
function (e) {
console.log(e);
}
);
}
}
}; };
</script> </script>

View file

@ -272,6 +272,10 @@ export default {
} }
}, },
}, },
activeLanguage() {
// Null status on language change, we don't know what status we are in so we can't get the right string.
this.loadingMessage = null;
}
}, },
methods: { methods: {
getRoomInfo() { getRoomInfo() {

View file

@ -1,23 +1,22 @@
<template> <template>
<div v-if="room" class="room-info"> <div v-if="room" class="room-info">
<div class="chat-header"> <div class="chat-header">
<v-container fluid> <v-container fluid class="d-flex justify-space-between align-center">
<div class="room-name no-upper">{{ $t("room_info.title") }}</div>
<v-btn <v-btn
id="btn-back" id="btn-back"
text text
class="header-button-left" :class="$navigation && $navigation.canPop() ? 'v-visible' : 'v-hidden'"
v-show="$navigation && $navigation.canPop()"
@click.stop="$navigation.pop" @click.stop="$navigation.pop"
> >
<v-icon>arrow_back</v-icon> <v-icon>arrow_back</v-icon>
<span>{{ $t("menu.back") }}</span> <span class="d-none d-sm-block">{{ $t("menu.back") }}</span>
</v-btn> </v-btn>
<div class="room-name no-upper">{{ $t("room_info.title") }}</div>
<v-btn <v-btn
id="btn-leave-room" id="btn-leave-room"
color="black" color="black"
depressed depressed
class="header-button-right filled-button me-3" class="filled-button"
@click.stop="showLeaveConfirmation = true" @click.stop="showLeaveConfirmation = true"
>👋 {{ $t("room_info.leave_room") }}</v-btn >👋 {{ $t("room_info.leave_room") }}</v-btn
> >
@ -134,7 +133,7 @@
class="member ma-2" class="member ma-2"
v-for="(member, index) in joinedMembers" v-for="(member, index) in joinedMembers"
:key="member.userId" :key="member.userId"
v-show="showAllMembers || index < 5" v-show="showAllMembers || index < SHOW_MEMBER_LIMIT"
@click="toggleMemberExpanded(member)" @click="toggleMemberExpanded(member)"
> >
<v-avatar class="avatar" size="32" color="grey"> <v-avatar class="avatar" size="32" color="grey">
@ -143,6 +142,7 @@
member.name.substring(0, 1).toUpperCase() member.name.substring(0, 1).toUpperCase()
}}</span> }}</span>
</v-avatar> </v-avatar>
<span class="user-name">
{{ {{
member.userId == $matrix.currentUserId member.userId == $matrix.currentUserId
? $t("room_info.user_you", { ? $t("room_info.user_you", {
@ -152,12 +152,14 @@
user: member.user ? member.user.displayName : member.name, user: member.user ? member.user.displayName : member.name,
}) })
}} }}
</span>
<div v-if="member.userId != $matrix.currentUserId && !$matrix.isDirectRoomWith(room, member.userId) && expandedMembers.includes(member)" class="start-private-chat clickable" @click="startPrivateChat(member.userId)">Start private chat</div>
<DeviceList <DeviceList
v-if="expandedMembers.includes(member)" v-if="expandedMembers.includes(member)"
:member="member" :member="member"
/> />
</div> </div>
<div class="show-all" @click="showAllMembers = !showAllMembers"> <div class="show-all" @click="showAllMembers = !showAllMembers" v-if="joinedMembers.length > SHOW_MEMBER_LIMIT">
{{ {{
showAllMembers ? $t("room_info.hide_all") : $t("room_info.show_all") showAllMembers ? $t("room_info.hide_all") : $t("room_info.show_all")
}} }}
@ -165,19 +167,6 @@
</v-card-text> </v-card-text>
</v-card> </v-card>
<!-- PURGE ROOM -->
<div class="members ma-3 pa-3 text-center">
<v-btn
id="btn-purge-room"
v-if="userCanPurgeRoom"
color="red"
depressed
class="filled-button"
@click.stop="showPurgeConfirmation = true"
>{{ $t("room_info.purge") }}</v-btn
>
</div>
<div class="build-version"> <div class="build-version">
{{ $t("room_info.version_info", { version: buildVersion }) }} {{ $t("room_info.version_info", { version: buildVersion }) }}
</div> </div>
@ -188,12 +177,6 @@
@close="showLeaveConfirmation = false" @close="showLeaveConfirmation = false"
/> />
<PurgeRoomDialog
:show="showPurgeConfirmation"
:room="room"
@close="showPurgeConfirmation = false"
/>
<QRCodePopup :show="showFullScreenQR" :message="publicRoomLink" @close="showFullScreenQR = false" /> <QRCodePopup :show="showFullScreenQR" :message="publicRoomLink" @close="showFullScreenQR = false" />
</div> </div>
@ -201,18 +184,17 @@
<script> <script>
import LeaveRoomDialog from "../components/LeaveRoomDialog"; import LeaveRoomDialog from "../components/LeaveRoomDialog";
import PurgeRoomDialog from "../components/PurgeRoomDialog";
import DeviceList from "../components/DeviceList"; import DeviceList from "../components/DeviceList";
import QRCode from "qrcode"; import QRCode from "qrcode";
import roomInfoMixin from "./roomInfoMixin"; import roomInfoMixin from "./roomInfoMixin";
import QRCodePopup from './QRCodePopup.vue'; import QRCodePopup from './QRCodePopup.vue';
import util from "../plugins/utils";
export default { export default {
name: "RoomInfo", name: "RoomInfo",
mixins: [roomInfoMixin], mixins: [roomInfoMixin],
components: { components: {
LeaveRoomDialog, LeaveRoomDialog,
PurgeRoomDialog,
DeviceList, DeviceList,
QRCodePopup, QRCodePopup,
}, },
@ -223,7 +205,6 @@ export default {
displayName: "", displayName: "",
showAllMembers: false, showAllMembers: false,
showLeaveConfirmation: false, showLeaveConfirmation: false,
showPurgeConfirmation: false,
showFullScreenQR: false, showFullScreenQR: false,
expandedMembers: [], expandedMembers: [],
buildVersion: "", buildVersion: "",
@ -241,6 +222,7 @@ export default {
icon: "person_add", icon: "person_add",
}, },
], ],
SHOW_MEMBER_LIMIT: 5
}; };
}, },
mounted() { mounted() {
@ -439,6 +421,28 @@ export default {
this.updateQRCode(); this.updateQRCode();
}); });
}, },
startPrivateChat(userId) {
this.$matrix
.getOrCreatePrivateChat(userId)
.then((room) => {
this.$nextTick(() => {
this.$navigation.push(
{
name: "Chat",
params: {
roomId: util.sanitizeRoomId(
room.getCanonicalAlias() || room.roomId
),
},
},
-1
);
});
})
.catch((err) => {
console.error(err);
});
},
}, },
}; };
</script> </script>

View file

@ -52,7 +52,7 @@
<v-list-item-avatar size="40" color="#e0e0e0"> <v-list-item-avatar size="40" color="#e0e0e0">
<v-img :src="room.avatar" /> <v-img :src="room.avatar" />
</v-list-item-avatar> </v-list-item-avatar>
<div class="room-list-notification-count"> <div class="room-list-notification-count" v-if="notificationCount(room) > 0">
{{ notificationCount(room) }} {{ notificationCount(room) }}
</div> </div>
<v-list-item-content> <v-list-item-content>

View file

@ -45,6 +45,7 @@ export default {
}; };
}, },
mounted() { mounted() {
this.$root.$on('playback-start', this.onPlaybackStart);
this.player = this.$refs.player; this.player = this.$refs.player;
this.player.addEventListener("timeupdate", this.updateProgressBar); this.player.addEventListener("timeupdate", this.updateProgressBar);
this.player.addEventListener("play", () => { this.player.addEventListener("play", () => {
@ -58,6 +59,9 @@ export default {
this.playing = false; this.playing = false;
}); });
}, },
beforeDestroy() {
this.$root.$off('playback-start', this.onPlaybackStart);
},
computed: { computed: {
currentTime() { currentTime() {
return util.formatDuration(this.playTime); return util.formatDuration(this.playTime);
@ -80,6 +84,7 @@ export default {
methods: { methods: {
play() { play() {
if (this.player.src) { if (this.player.src) {
this.$root.$emit("playback-start", this);
if (this.player.paused) { if (this.player.paused) {
this.player.play(); this.player.play();
} else if (this.player.ended) { } else if (this.player.ended) {
@ -107,6 +112,11 @@ export default {
updateDuration() { updateDuration() {
this.duration = 1000 * this.player.duration; this.duration = 1000 * this.player.duration;
}, },
onPlaybackStart(item) {
if (item != this && this.playing) {
this.pause();
}
}
}, },
}; };
</script> </script>

View file

@ -88,10 +88,7 @@ export default {
while (lines.length && !lines[0].startsWith('> ')) lines.shift(); while (lines.length && !lines[0].startsWith('> ')) lines.shift();
// Reply fallback has a blank line after it, so remove it to prevent leading newline // Reply fallback has a blank line after it, so remove it to prevent leading newline
if (lines[0] === '') lines.shift(); if (lines[0] === '') lines.shift();
const text = lines const text = lines[0].replace(/^> (<.*> )?/g, '');
.map((item) => { return item.replace(/^> (<.*> )?/g, ''); })
.reverse()
.join('\n');
if (text) { if (text) {
return text; return text;
} }

View file

@ -1,7 +1,7 @@
export default { export default {
computed: { computed: {
user() { user() {
if (!this.$matrix.matrixClient) { if (!this.$matrix.ready) {
return null; return null;
} }
return this.$matrix.matrixClient.getUser(this.$matrix.currentUserId); return this.$matrix.matrixClient.getUser(this.$matrix.currentUserId);

View file

@ -546,19 +546,15 @@ class Util {
return t2.diff(t1, 'day'); return t2.diff(t1, 'day');
} }
formatDay(timestamp) { dayDiffToday(timestamp) {
var then = dayjs(timestamp).endOf('day'); var then = dayjs(timestamp).endOf('day');
var now = dayjs().endOf('day'); var now = dayjs().endOf('day');
const dayDiff = now.diff(then, 'day'); return now.diff(then, 'day');
if (dayDiff < 1) { }
return "Today";
} else if (dayDiff < 2) { formatDay(timestamp) {
return "Yesterday"; var then = dayjs(timestamp).endOf('day');
} else if (dayDiff < 7) { return then.format('L');
return "" + dayDiff + " days ago";
} else {
return then.format('L');
}
} }
formatRecordDuration(ms) { formatRecordDuration(ms) {

View file

@ -391,8 +391,8 @@ export default {
// Invitation. Need to call "recalculate" to pick // Invitation. Need to call "recalculate" to pick
// up room name, not sure why exactly. // up room name, not sure why exactly.
room.recalculate(); room.recalculate();
this.reloadRooms();
} }
this.reloadRooms();
}, },
onSessionLoggedOut() { onSessionLoggedOut() {
@ -409,12 +409,21 @@ export default {
// we need to hang on to the generated password and use that to login to a new // we need to hang on to the generated password and use that to login to a new
// session, so only wipe the token in s that case. // session, so only wipe the token in s that case.
// Clear the access token // Clear the access token
var user = JSON.parse(this.$store.state.auth.user); var user = this.$store.state.auth.user;
if (user.is_guest) { if (user.is_guest) {
delete user.access_token; delete user.access_token;
this.$store.commit("setUser", user); this.$store.commit("setUser", user);
// Login again // Login again
this.login(user); this.login(user).catch(error => {
if (error.data.errcode ==='M_FORBIDDEN' && this.currentUser.is_guest) {
// Guest account and password don't work. We are in a strange state, probably because
// of server cleanup of accounts or similar. Wipe account and restart...
this.$store.commit("setUser", null);
}
this.$store.commit("setCurrentRoomId", null);
this.$navigation.push({ path: "/login" }, -1);
})
} else { } else {
this.$store.commit("setUser", null); this.$store.commit("setUser", null);
this.$store.commit("setCurrentRoomId", null); this.$store.commit("setCurrentRoomId", null);
@ -688,10 +697,14 @@ export default {
for (const room of this.rooms) { for (const room of this.rooms) {
// Is the other member the one we are looking for? // Is the other member the one we are looking for?
if (this.isDirectRoomWith(room, userId)) { if (this.isDirectRoomWith(room, userId)) {
var member = room.getMember(userId); if (room.getMyMembership() == "invite") {
if (member && member.membership != "join") { this.matrixClient.joinRoom(room.roomId);
// Resend invite } else {
this.matrixClient.invite(room.roomId, userId); var member = room.getMember(userId);
if (member && member.membership != "join") {
// Resend invite
this.matrixClient.invite(room.roomId, userId);
}
} }
resolve(room); resolve(room);
return; return;
@ -703,6 +716,7 @@ export default {
const createRoomOptions = { const createRoomOptions = {
visibility: "private", // Not listed! visibility: "private", // Not listed!
preset: "private_chat", preset: "private_chat",
is_direct: true,
initial_state: [ initial_state: [
{ {
type: "m.room.encryption", type: "m.room.encryption",
@ -746,22 +760,18 @@ export default {
*/ */
isDirectRoomWith(room, userId) { isDirectRoomWith(room, userId) {
if ( if (
room.selfMembership == "join" && room.getJoinRule() == "invite" &&
room.getInvitedAndJoinedMemberCount() == 2 room.getMembers().length == 2
) { ) {
// Is the other member the one we are looking for? let other = room.getMember(userId);
if ( if (other) {
room if (room.getMyMembership() == "invite" && other.membership == "join") {
.getMembersWithMembership("join") return true;
.some((item) => item.userId == userId) } else if (room.getMyMembership() == "join" && room.canInvite(this.currentUserId)) {
) { return true;
return true; } else if (room.getMyMembership() == "join" && other.membership == "join") {
} else if ( return true;
room }
.getMembersWithMembership("invite")
.some((item) => item.userId == userId)
) {
return true;
} }
} }
return false; return false;