mirror of
https://github.com/RedWizardsLab/EchoHub.git
synced 2026-09-04 23:34:10 +02:00
feat: add /meta command for channel metadata retrieval
- Implemented the `/meta` command to fetch and display channel metadata including room ID, topic, message count, unique user count, estimated size, and protection level. - Added `ChannelMetaDto` to encapsulate channel metadata. - Updated `ChannelsController` to handle the new `/meta` endpoint. - Introduced `UploadLimits` configuration for admin-defined upload size limits for files, images, audio, and avatars. - Enhanced error handling and user feedback for metadata retrieval. - Updated documentation to reflect changes in encryption and room metadata. - Added tests for the new functionality and upload limits.
This commit is contained in:
@@ -451,10 +451,17 @@ public sealed class ChatMessageManager
|
||||
|
||||
private static string FormatDateTime(DateTimeOffset timestamp)
|
||||
{
|
||||
if (timestamp.Date == DateTimeOffset.Now.Date)
|
||||
return timestamp.ToLocalTime().ToString("t");
|
||||
else
|
||||
return timestamp.ToLocalTime().ToString("g");
|
||||
// Server timestamps arrive in UTC; convert to local before deciding the calendar day,
|
||||
// otherwise a "today" message near midnight is misclassified against the local date.
|
||||
var local = timestamp.ToLocalTime();
|
||||
|
||||
// Today's messages show a compact date + short time; older messages fall back to the
|
||||
// culture's general short date/time. Both always include the date so new messages
|
||||
// are never left date-less.
|
||||
if (local.Date == DateTimeOffset.Now.Date)
|
||||
return $"{local:d} {local:t}";
|
||||
|
||||
return local.ToString("g");
|
||||
}
|
||||
|
||||
internal static string FormatFileSize(long? bytes)
|
||||
|
||||
Reference in New Issue
Block a user