Show mentioned badges & enable scrolling to mentions in conversations

This commit is contained in:
trevor-signal 2023-05-23 17:59:07 -04:00 committed by GitHub
parent caaeda8abe
commit d012779e87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 694 additions and 184 deletions

View file

@ -0,0 +1,38 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { Database } from '@signalapp/better-sqlite3';
import type { LoggerType } from '../../types/Logging';
export default function updateToSchemaVersion83(
currentVersion: number,
db: Database,
logger: LoggerType
): void {
if (currentVersion >= 83) {
return;
}
db.transaction(() => {
db.exec(
`
ALTER TABLE messages
ADD COLUMN mentionsMe INTEGER NOT NULL DEFAULT 0;
-- one which includes story data...
CREATE INDEX messages_unread_mentions ON messages
(conversationId, readStatus, mentionsMe, isStory, storyId, received_at, sent_at)
WHERE readStatus IS NOT NULL;
-- ...and one which doesn't, so storyPredicate works as expected
CREATE INDEX messages_unread_mentions_no_story_id ON messages
(conversationId, readStatus, mentionsMe, isStory, received_at, sent_at)
WHERE isStory IS 0 AND readStatus IS NOT NULL;
`
);
db.pragma('user_version = 83');
})();
logger.info('updateToSchemaVersion83: success!');
}

View file

@ -58,6 +58,7 @@ import updateToSchemaVersion79 from './79-paging-lightbox';
import updateToSchemaVersion80 from './80-edited-messages';
import updateToSchemaVersion81 from './81-contact-removed-notification';
import updateToSchemaVersion82 from './82-edited-messages-read-index';
import updateToSchemaVersion83 from './83-mentions';
function updateToSchemaVersion1(
currentVersion: number,
@ -1982,10 +1983,10 @@ export const SCHEMA_VERSIONS = [
updateToSchemaVersion77,
updateToSchemaVersion78,
updateToSchemaVersion79,
updateToSchemaVersion80,
updateToSchemaVersion81,
updateToSchemaVersion82,
updateToSchemaVersion83,
];
export function updateSchema(db: Database, logger: LoggerType): void {