Skip to content

Commit 5afb102

Browse files
committed
Merge remote-tracking branch 'upstream/dev' into fix-qa-issues-user-settings
2 parents 1ea32bf + ba7a7b7 commit 5afb102

File tree

94 files changed

+1892
-1054
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+1892
-1054
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"build-release-base": "cross-env NODE_ENV=production electron-builder --config.extraMetadata.environment=production",
4040
"build-release": "yarn build-release-base --publish=never --config.directories.output=release",
4141
"build-release-publish": "yarn build-release-base --publish=always",
42-
"ready": "yarn dedup --fail && yarn build-everything && yarn lint && yarn test",
42+
"ready": "yarn dedup --fail && yarn build && yarn lint && yarn test",
4343
"postinstall": "yarn patch-package && yarn electron-builder install-app-deps",
4444
"update-git-info": "node ./build/updateLocalConfig.js",
4545
"worker:utils": "webpack --config=./utils.worker.config.js",
@@ -76,7 +76,7 @@
7676
"fs-extra": "11.3.0",
7777
"glob": "10.4.5",
7878
"image-type": "^4.1.0",
79-
"libsession_util_nodejs": "https://github.com/session-foundation/libsession-util-nodejs/releases/download/v0.5.5/libsession_util_nodejs-v0.5.5.tar.gz",
79+
"libsession_util_nodejs": "https://github.com/session-foundation/libsession-util-nodejs/releases/download/v0.5.6/libsession_util_nodejs-v0.5.6.tar.gz",
8080
"libsodium-wrappers-sumo": "^0.7.15",
8181
"linkify-it": "^5.0.0",
8282
"lodash": "^4.17.21",

protos/SignalService.proto

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,12 @@ message DataMessage {
200200
message LokiProfile {
201201
optional string displayName = 1;
202202
optional string profilePicture = 2;
203+
/**
204+
* The timestamp of the last profile update.
205+
* This is used to prioritize the correct profile info based on multiple and outdated incoming messages.
206+
Note: this is in milliseconds.
207+
*/
208+
optional uint64 lastProfileUpdateMs = 3;
203209
}
204210

205211
message OpenGroupInvitation {

ts/components/SessionInboxView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ async function createSessionInboxStore() {
7575
conversationLookup: makeLookup(conversations, 'id'),
7676
},
7777
user: {
78-
ourDisplayNameInProfile: UserUtils.getOurProfile()?.displayName || '',
78+
ourDisplayNameInProfile: (await UserUtils.getOurProfile()).displayName || '',
7979
ourNumber: UserUtils.getOurPubKeyStrFromCache(),
8080
uploadingNewAvatarCurrentUser: false,
8181
uploadingNewAvatarCurrentUserFailed: false,

ts/components/conversation/header/ConversationHeader.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,7 @@ function RecreateGroupButton() {
164164
ConversationTypeEnum.PRIVATE
165165
);
166166
if (!memberConvo.get('active_at')) {
167-
memberConvo.set({
168-
active_at: Constants.CONVERSATION.LAST_JOINED_FALLBACK_TIMESTAMP,
169-
});
167+
memberConvo.setActiveAt(Constants.CONVERSATION.LAST_JOINED_FALLBACK_TIMESTAMP);
170168
await memberConvo.commit();
171169
}
172170
/* eslint-enable no-await-in-loop */

ts/components/conversation/message/message-content/ClickToTrustSender.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const ClickToTrustSender = (props: { messageId: string }) => {
5151
},
5252
closeTheme: SessionButtonColor.Danger,
5353
onClickOk: async () => {
54-
convo.set({ isTrustedForAttachmentDownload: true });
54+
convo.setIsTrustedForAttachmentDownload(true);
5555
await convo.commit();
5656
const messagesInConvo = await Data.getLastMessagesByConversation(convo.id, 100, false);
5757

@@ -104,9 +104,9 @@ export const ClickToTrustSender = (props: { messageId: string }) => {
104104
})
105105
);
106106

107-
message.set({ preview });
107+
message.setPreview(preview);
108108

109-
message.set({ attachments: downloadedAttachments });
109+
message.setAttachments(downloadedAttachments);
110110
await message.commit();
111111
})
112112
);

ts/components/dialog/debug/components.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import { releasedFeaturesActions } from '../../../state/ducks/releasedFeatures';
3535
import { networkDataActions } from '../../../state/ducks/networkData';
3636
import { DEBUG_MENU_PAGE, type DebugMenuPageProps } from './DebugMenuModal';
3737
import { SimpleSessionInput } from '../../inputs/SessionInput';
38+
import { NetworkTime } from '../../../util/NetworkTime';
3839

3940
const hexRef = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
4041

@@ -57,9 +58,13 @@ async function generateOneRandomContact() {
5758
// createdAt is set to now in libsession-util itself,
5859
// but we still need to mark that conversation as active
5960
// for it to be inserted in the config
60-
created.setKey('active_at', Date.now());
61-
created.setKey('isApproved', true);
62-
created.setSessionDisplayNameNoCommit(id.slice(2, 8));
61+
created.setActiveAt(Date.now());
62+
await created.setIsApproved(true, false);
63+
await created.setSessionProfile({
64+
type: 'displayNameChangeOnlyPrivate',
65+
displayName: id.slice(2, 8),
66+
profileUpdatedAtSeconds: NetworkTime.nowSeconds(),
67+
});
6368

6469
await created.commit();
6570
return created;

ts/components/dialog/shared/ModalPencilButton.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export function ModalPencilIcon(props: { onClick: () => void }) {
77
unicode={LUCIDE_ICONS_UNICODE.PENCIL}
88
onClick={props.onClick}
99
iconSize="large"
10+
dataTestId="modal-pencil-button"
1011
iconColor="var(--text-primary-color)"
1112
/>
1213
);

ts/components/dialog/user-settings/pages/PrivacySettingsPage.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ import {
2020
useUserSettingsCloseAction,
2121
useUserSettingsTitle,
2222
} from './userSettingsHooks';
23-
import { CallManager, UserUtils } from '../../../../session/utils';
23+
import { CallManager } from '../../../../session/utils';
2424
import { SessionButtonColor } from '../../../basic/SessionButton';
2525
import {
2626
useHasLinkPreviewEnabled,
2727
useWeHaveBlindedMsgRequestsEnabled,
2828
} from '../../../../state/selectors/settings';
2929
import { SettingsKey } from '../../../../data/settings-key';
30-
import { SessionUtilUserProfile } from '../../../../session/utils/libsession/libsession_utils_user_profile';
3130
import { getPasswordHash, Storage } from '../../../../util/storage';
3231
import { SettingsToggleBasic } from '../components/SettingsToggleBasic';
3332
import { SettingsPanelButtonInlineBasic } from '../components/SettingsPanelButtonInlineBasic';
3433
import { UserSettingsModalContainer } from '../components/UserSettingsModalContainer';
34+
import { UserConfigWrapperActions } from '../../../../webworker/workers/browser/libsession_worker_interface';
3535

3636
const toggleCallMediaPermissions = async (triggerUIUpdate: () => void) => {
3737
const currentValue = window.getCallMediaPermissions();
@@ -193,9 +193,8 @@ export function PrivacySettingsPage(modalState: UserSettingsModalState) {
193193
onClick={async () => {
194194
const toggledValue = !weHaveBlindedRequestsEnabled;
195195
await window.setSettingValue(SettingsKey.hasBlindedMsgRequestsEnabled, toggledValue);
196-
await SessionUtilUserProfile.insertUserProfileIntoWrapper(
197-
UserUtils.getOurPubKeyStrFromCache()
198-
);
196+
await UserConfigWrapperActions.setEnableBlindedMsgRequest(toggledValue);
197+
199198
forceUpdate();
200199
}}
201200
text={{ token: 'messageRequestsCommunities' }}

ts/components/leftpane/ActionsPanel.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ const doAppStartUp = async () => {
164164
// Schedule all avatarMigrateJobs in some time to let anything incoming from the network be handled first
165165
void AvatarMigrate.scheduleAllAvatarMigrateJobs();
166166
}, 1 * DURATION.MINUTES);
167+
168+
void regenerateLastMessagesGroupsCommunities();
167169
};
168170

169171
function useUpdateBadgeCount() {
@@ -195,6 +197,24 @@ function useDebugThemeSwitch() {
195197
);
196198
}
197199

200+
/**
201+
* We only need to regenerate the last message of groups/communities once,
202+
* and we can remove it in a few months safely
203+
*/
204+
async function regenerateLastMessagesGroupsCommunities() {
205+
if (Storage.getBoolOr(SettingsKey.lastMessageGroupsRegenerated, false)) {
206+
return; // already regenerated once
207+
}
208+
209+
ConvoHub.use()
210+
.getConversations()
211+
.filter(m => m.isClosedGroupV2() || m.isPublic())
212+
.forEach(m => {
213+
m.updateLastMessage();
214+
});
215+
await Storage.put(SettingsKey.lastMessageGroupsRegenerated, true);
216+
}
217+
198218
/**
199219
* ActionsPanel is the far left banner (not the left pane).
200220
* The panel with buttons to switch between the message/contact/settings/theme views

ts/components/leftpane/overlay/OverlayMessage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export const OverlayMessage = () => {
8686
if (!convo.isActive() || convo.isHidden()) {
8787
// bump the timestamp only if we were not active before
8888
if (!convo.isActive()) {
89-
convo.set({ active_at: Date.now() });
89+
convo.setActiveAt(Date.now());
9090
}
9191
await convo.unhideIfNeeded(false);
9292

0 commit comments

Comments
 (0)