Skip to content

chore: remove ZMUser.selfUser(inUserSession:) - WPB-20362#4260

Merged
caldrian merged 2 commits intodevelopfrom
chore/delete-zmselfuser-inusersession-WPB-20362
Feb 4, 2026
Merged

chore: remove ZMUser.selfUser(inUserSession:) - WPB-20362#4260
caldrian merged 2 commits intodevelopfrom
chore/delete-zmselfuser-inusersession-WPB-20362

Conversation

@caldrian
Copy link
Contributor

@caldrian caldrian commented Feb 3, 2026

TaskWPB-20362 [iOS/Integration] - Searching for Apps specifically

Issue

This PR removes some unnecessary complexity by replacing ZMUser.selfUser(inUserSession:).


Checklist

  • Title contains a reference JIRA issue number like [WPB-XXX].
  • Description is filled and free of optional paragraphs.
  • Adds/updates automated tests.

UI accessibility checklist

If your PR includes UI changes, please utilize this checklist:

  • Make sure you use the API for UI elements that support large fonts.
  • All colors are taken from WireDesign.ColorTheme or constructed using WireDesign.BaseColorPalette.
  • New UI elements have Accessibility strings for VoiceOver.

@caldrian caldrian requested review from a team, David-Henner, Copilot and netbe and removed request for a team February 3, 2026 20:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the codebase to remove the deprecated ZMUser.selfUser(inUserSession:) method and replace all usages with the more direct ZMUser.selfUser(in: viewContext) API. This simplifies the code by eliminating an unnecessary abstraction layer.

Changes:

  • Removed the ZMUser.selfUser(inUserSession:) method definition from ZMUser header and implementation files
  • Updated all call sites to use ZMUser.selfUser(in: viewContext) instead of ZMUser.selfUser(inUserSession:)
  • Refactored ZMSearchUser to store a weak reference to viewContext instead of contextProvider
  • Fixed typos in variable names (converation → conversation, searchUserViewConroller → searchUserViewController)
  • Minor code cleanup including import ordering and whitespace removal

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
wire-ios/Wire-iOS/Sources/UserInterface/Settings/DebugActions.swift Updated to use new selfUser API
wire-ios/Wire-iOS/Sources/UserInterface/SelfProfile/SelfProfileViewController.swift Updated to use new selfUser API and removed intermediate variable
wire-ios/Wire-iOS/Sources/UserInterface/MainController/ZClientViewController+ShowContentDelegate.swift Fixed typo in variable name, added @mainactor annotation to Task
wire-ios/Wire-iOS/Sources/Helpers/syncengine/ZMUser+Self.swift Updated static helper methods to use new selfUser API
wire-ios/Wire-iOS/Sources/Developer/DeveloperTools/DeveloperToolsViewModel.swift Updated to use new selfUser API
wire-ios/Wire-iOS/Sources/AuthenticatedRouter.swift Fixed typo in parameter name (converation → conversation)
wire-ios-sync-engine/Tests/Source/UserSession/SearchTaskTests.swift Reordered imports alphabetically
wire-ios-sync-engine/Tests/Source/UserSession/SearchDirectoryTests.swift Updated ZMSearchUser initializer to use viewContext parameter
wire-ios-sync-engine/Tests/Source/Synchronization/Strategies/SearchUserImageStrategyTests.swift Updated ZMSearchUser initializer to use viewContext parameter
wire-ios-sync-engine/Source/UserSession/ZMUserSession/ZMUserSession+UserSession.swift Updated three computed properties to use new selfUser API
wire-ios-sync-engine/Source/UserSession/ZMUserSession/ZMUserSession+Authentication.swift Updated logout method to use new selfUser API
wire-ios-sync-engine/Source/UserSession/URLActionProcessors/DeepLinkURLActionProcessor.swift Removed extraneous blank line
wire-ios-sync-engine/Source/UserSession/URLActionProcessors/ConnectToBotURLActionProcessor.swift Updated ZMSearchUser initializer to use viewContext parameter
wire-ios-sync-engine/Source/SessionManager/UserSessionLoader.swift Removed searchContext from EARService database contexts array
wire-ios-sync-engine/Source/SessionManager/SessionManager.swift Updated to use new selfUser API
wire-ios-sync-engine/Source/SessionManager/SessionManager+Backup.swift Refactored to move activeUserSession check earlier and use new selfUser API
wire-ios-data-model/Tests/Source/Model/UserTypeTests+Materialize.swift Updated ZMSearchUser test helper to use viewContext parameter
wire-ios-data-model/Tests/Source/Model/User/ZMSearchUserTests.m Updated all ZMSearchUser initializers from initWithContextProvider to initWithViewContext
wire-ios-data-model/Tests/Source/Model/User/ZMSearchUserTests+TeamUser.swift Updated test helper to use viewContext parameter
wire-ios-data-model/Tests/Source/Model/User/ZMSearchUserTests+ProfileImages.swift Updated test helper to use viewContext parameter
wire-ios-data-model/Tests/Source/Model/User/ZMSearchUserTests+Connections.swift Updated ZMSearchUser initializer to use viewContext parameter
wire-ios-data-model/Tests/Source/Model/Observer/SearchUserSnapshotTests.swift Updated test helper to use viewContext parameter
wire-ios-data-model/Tests/Source/Model/Observer/SearchUserObserverTests.swift Updated test helper to use viewContext parameter
wire-ios-data-model/Tests/Source/Model/Observer/SearchUserObserverCenterTests.swift Updated test helper to use viewContext parameter
wire-ios-data-model/Source/Public/ZMUser.h Removed ZMUser (Utilities) category declaration
wire-ios-data-model/Source/Model/User/ZMUser.m Removed ZMUser (Utilities) category implementation
wire-ios-data-model/Source/Model/User/ZMSearchUser.swift Replaced contextProvider with viewContext property throughout, updated initializers and methods
wire-ios-data-model/Source/Model/User/UserType+Federation.swift Removed unused Foundation import

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

Test Results

5 373 tests   5 346 ✅  7m 21s ⏱️
  680 suites     27 💤
    3 files        0 ❌

Results for commit 75f527f.

♻️ This comment has been updated with latest results.

Summary: workflow run #21661133269
Allure report (download zip): html-report-27515-chore_delete-zmselfuser-inusersession-WPB-20362

Copy link
Collaborator

@netbe netbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM:) I thought it was introduced to help out in tests

@caldrian caldrian enabled auto-merge February 4, 2026 10:18
@caldrian caldrian added this pull request to the merge queue Feb 4, 2026
Merged via the queue into develop with commit c688701 Feb 4, 2026
12 checks passed
@caldrian caldrian deleted the chore/delete-zmselfuser-inusersession-WPB-20362 branch February 4, 2026 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants