mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-26 14:05:52 +00:00
resolve comments
This commit is contained in:
+2
-2
@@ -802,8 +802,8 @@ processChatCommand' vr = \case
|
||||
fileSize <- liftIO $ CF.getFileContentsSize $ CryptoFile fsFilePath cryptoArgs
|
||||
chunkSize <- asks $ fileChunkSize . config
|
||||
withStore' $ \db -> do
|
||||
fileId <- createLocalFile CIFSSndComplete db user nf ciId createdAt cf fileSize chunkSize
|
||||
pure CIFile {fileId, fileName = takeFileName filePath, fileSize, fileSource = Just cf, fileStatus = CIFSSndComplete, fileProtocol = FPLocal}
|
||||
fileId <- createLocalFile CIFSSndStored db user nf ciId createdAt cf fileSize chunkSize
|
||||
pure CIFile {fileId, fileName = takeFileName filePath, fileSize, fileSource = Just cf, fileStatus = CIFSSndStored, fileProtocol = FPLocal}
|
||||
ci <- liftIO $ mkChatItem cd ciId content ciFile_ Nothing Nothing Nothing False createdAt Nothing createdAt
|
||||
pure . CRNewChatItem user $ AChatItem SCTLocal SMDSnd (LocalChat nf) ci
|
||||
APIUpdateChatItem (ChatRef cType chatId) itemId live mc -> withUser $ \user -> withChatLock "updateChatItem" $ case cType of
|
||||
|
||||
@@ -106,7 +106,6 @@ filesHelpInfo =
|
||||
[ green "File transfer commands:",
|
||||
indent <> highlight "/file @<contact> <file_path> " <> " - send file to contact",
|
||||
indent <> highlight "/file #<group> <file_path> " <> " - send file to group",
|
||||
indent <> highlight "/file $<folder> <file_path> " <> " - add file to folder",
|
||||
indent <> highlight "/image <name> [<file_path>] " <> " - send file as image to @contact or #group",
|
||||
indent <> highlight "/freceive <file_id> [<file_path>] " <> " - accept to receive file",
|
||||
indent <> highlight "/fforward <name> [<file_id>] " <> " - forward received file to @contact or #group",
|
||||
|
||||
@@ -11,26 +11,21 @@ m20240102_note_folders =
|
||||
CREATE TABLE note_folders (
|
||||
note_folder_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
user_id INTEGER NOT NULL REFERENCES users ON DELETE CASCADE,
|
||||
created_at TEXT NOT NULL,
|
||||
updated_at TEXT NOT NULL,
|
||||
chat_ts TEXT NOT NULL,
|
||||
created_at TEXT NOT NULL DEFAULT(datetime('now')),
|
||||
updated_at TEXT NOT NULL DEFAULT(datetime('now')),
|
||||
chat_ts TEXT NOT NULL DEFAULT(datetime('now')),
|
||||
favorite INTEGER NOT NULL DEFAULT 0,
|
||||
unread_chat INTEGER DEFAULT 0 NOT NULL
|
||||
unread_chat INTEGER NOT NULL DEFAULT 0
|
||||
);
|
||||
|
||||
ALTER TABLE chat_items ADD COLUMN note_folder_id INTEGER DEFAULT NULL REFERENCES note_folders ON DELETE CASCADE;
|
||||
ALTER TABLE files ADD COLUMN note_folder_id INTEGER DEFAULT NULL REFERENCES note_folders ON DELETE CASCADE;
|
||||
|
||||
INSERT INTO note_folders
|
||||
SELECT
|
||||
NULL as note_folder_id,
|
||||
u.user_id as user_id,
|
||||
datetime('now') as created_at,
|
||||
datetime('now') as updated_at,
|
||||
datetime('now') as chat_ts,
|
||||
0 as favorite,
|
||||
0 as unread_chat
|
||||
FROM users u;
|
||||
CREATE INDEX chat_items_note_folder_id ON chat_items(note_folder_id);
|
||||
CREATE INDEX files_note_folder_id ON files(note_folder_id);
|
||||
CREATE INDEX note_folders_user_id ON note_folders(user_id);
|
||||
|
||||
INSERT INTO note_folders (user_id) SELECT user_id FROM users;
|
||||
|]
|
||||
|
||||
down_m20240102_note_folders :: Query
|
||||
@@ -38,5 +33,7 @@ down_m20240102_note_folders =
|
||||
[sql|
|
||||
DROP TABLE note_folders;
|
||||
ALTER TABLE chat_items DROP COLUMN note_folder_id;
|
||||
ALTER TABLE chat_items DROP INDEX chat_items_note_folder_id;
|
||||
ALTER TABLE files DROP COLUMN note_folder_id;
|
||||
ALTER TABLE files DROP INDEX files_note_folder_id;
|
||||
|]
|
||||
|
||||
@@ -552,11 +552,11 @@ CREATE TABLE IF NOT EXISTS "msg_deliveries"(
|
||||
CREATE TABLE note_folders(
|
||||
note_folder_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
user_id INTEGER NOT NULL REFERENCES users ON DELETE CASCADE,
|
||||
created_at TEXT NOT NULL,
|
||||
updated_at TEXT NOT NULL,
|
||||
chat_ts TEXT NOT NULL,
|
||||
created_at TEXT NOT NULL DEFAULT(datetime('now')),
|
||||
updated_at TEXT NOT NULL DEFAULT(datetime('now')),
|
||||
chat_ts TEXT NOT NULL DEFAULT(datetime('now')),
|
||||
favorite INTEGER NOT NULL DEFAULT 0,
|
||||
unread_chat INTEGER DEFAULT 0 NOT NULL
|
||||
unread_chat INTEGER NOT NULL DEFAULT 0
|
||||
);
|
||||
CREATE INDEX contact_profiles_index ON contact_profiles(
|
||||
display_name,
|
||||
@@ -823,3 +823,6 @@ CREATE INDEX idx_msg_deliveries_agent_msg_id ON "msg_deliveries"(
|
||||
connection_id,
|
||||
agent_msg_id
|
||||
);
|
||||
CREATE INDEX chat_items_note_folder_id ON chat_items(note_folder_id);
|
||||
CREATE INDEX files_note_folder_id ON files(note_folder_id);
|
||||
CREATE INDEX note_folders_user_id ON note_folders(user_id);
|
||||
|
||||
@@ -1182,7 +1182,6 @@ fileTransferCancelled (FTSnd FileTransferMeta {cancelled} _) = cancelled
|
||||
fileTransferCancelled (FTRcv RcvFileTransfer {cancelled}) = cancelled
|
||||
|
||||
-- For XFTP file transfers FSConnected means "uploaded to XFTP relays"
|
||||
-- Local files are always FSComplete
|
||||
data FileStatus = FSNew | FSAccepted | FSConnected | FSComplete | FSCancelled deriving (Eq, Ord, Show)
|
||||
|
||||
instance FromField FileStatus where fromField = fromTextField_ textDecode
|
||||
|
||||
Reference in New Issue
Block a user