mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-07 10:02:24 +02:00
Fixed saved date on messages.
Hotfix for empty message_history setting. Signed-off-by: Armored Dragon <publicmail@armoreddragon.com>
This commit is contained in:
parent
66fd21777c
commit
391a33d149
2 changed files with 20 additions and 8 deletions
|
@ -21,7 +21,7 @@
|
|||
var chat_overlay_window;
|
||||
var app_button;
|
||||
const channels = ["domain", "local"];
|
||||
var message_history = Settings.getValue("ArmoredChat-Messages", []);
|
||||
var message_history = Settings.getValue("ArmoredChat-Messages", []) || [];
|
||||
var max_local_distance = 20; // Maximum range for the local chat
|
||||
var pal_data = AvatarManager.getPalData().data;
|
||||
|
||||
|
@ -119,6 +119,7 @@
|
|||
hour12: false,
|
||||
});
|
||||
saved_message.dateString = new Date().toLocaleDateString(undefined, {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
});
|
||||
|
@ -210,11 +211,13 @@
|
|||
function _loadSettings() {
|
||||
settings = Settings.getValue("ArmoredChat-Config", settings);
|
||||
|
||||
// Load message history
|
||||
message_history.forEach((message) => {
|
||||
delete message.action;
|
||||
_emitEvent({ type: "show_message", ...message });
|
||||
});
|
||||
if (message_history) {
|
||||
// Load message history
|
||||
message_history.forEach((message) => {
|
||||
delete message.action;
|
||||
_emitEvent({ type: "show_message", ...message });
|
||||
});
|
||||
}
|
||||
|
||||
// Send current settings to the app
|
||||
_emitEvent({ type: "initial_settings", settings: settings });
|
||||
|
|
|
@ -150,11 +150,11 @@ Rectangle {
|
|||
id: listview
|
||||
|
||||
delegate: Loader {
|
||||
width: parent.width
|
||||
property int delegateIndex: index
|
||||
property string delegateText: model.text
|
||||
property string delegateUsername: model.username
|
||||
property string delegateDate: model.date
|
||||
width: parent.width // FIXME: Causes warning, but required for style?
|
||||
|
||||
sourceComponent: {
|
||||
if (model.type === "chat") {
|
||||
|
@ -165,6 +165,12 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
id: chat_scrollbar
|
||||
height: 100
|
||||
size: 0.05
|
||||
}
|
||||
|
||||
model: getChannel(pageVal)
|
||||
|
||||
}
|
||||
|
@ -437,9 +443,12 @@ Rectangle {
|
|||
}
|
||||
|
||||
function scrollToBottom() {
|
||||
if (listview.count == 0) return;
|
||||
// if (chat_scrollbar.visualPosition > 0.85) {
|
||||
listview.positionViewAtIndex(listview.count - 1, ListView.End);
|
||||
listview.positionViewAtEnd();
|
||||
listview.contentY = listview.contentY + 50;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
@ -485,7 +494,7 @@ Rectangle {
|
|||
|
||||
switch (message.type){
|
||||
case "show_message":
|
||||
addMessage(message.displayName, message.message, `[ ${time} - ${date} ]`, message.channel, "chat");
|
||||
addMessage(message.displayName, message.message, `[ ${message.timeString || time} - ${message.dateString || date} ]`, message.channel, "chat");
|
||||
break;
|
||||
case "avatar_connected":
|
||||
addMessage("SYSTEM", message.message, `[ ${time} - ${date} ]`, "domain", "notification");
|
||||
|
|
Loading…
Reference in a new issue