Objective-C: follow-ups from the WPLog migration (#26259)

Đang mở
#26,260 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
ios, objective-c, swift
Lĩnh vực
mobile

Hướng nghiên cứu

Start with CommentService.m and inspect setHierarchyAndDepthOnComment:withParentComment: and its two callers to confirm when the placeholder ID is assigned. Then review the listed -Wnonnull call sites in MediaService, SafariActivity, MenuPostService, and MenusViewController; build the app target with -Werror=format to check the warnings are resolved. Done when posted replies use their real IDs, new replies sort after existing IDs, and the listed warnings are addressed.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

[Type] Task Observability

Problems found while moving Objective-C logging to WPLog* in #26259. None of them block that PR. They're existing bugs outside the logging change, found by a -Werror=format build and by reading CommentService.

  • setHierarchyAndDepthOnComment:withParentComment: always uses the placeholder comment ID.
    In CommentService.m, if (commentID != 0) compares the NSNumber object to 0, not its value, so the check is always true. The comment above it says only new, unsent comments (ID 0) should get the placeholder 9999999, so they sort last among their siblings. Instead every comment going through this method gets it.

    Two callers are affected:

    • createHierarchicalCommentWithContent:withParent:postID:siteID:inContext:, for a new local reply. Here the placeholder is intended.
    • updateHierarchicalComment:withRemoteComment:, after the server returns the posted reply with its real ID. Here the real ID should be used.

    So a posted reply probably keeps a …0009999999 ordering key until the next full sync (hierarchyFromAncestors:andCommentID:) recomputes it. Separately, 9999999 has only 7 digits, so it doesn't sort last on sites whose comment IDs have 8 or more digits.

    Found by reading the code only. Not reproduced in the app: the effect on comment thread order hasn't been checked. Likely fix: compare the value (comment.commentID == 0) and use a placeholder that sorts after any Int32 ID, for example INT32_MAX (2147483647, still 10 digits).

  • Pre-existing: five -Wnonnull warnings (nil passed where a value is required).
    These show up when building with -Wformat warnings as errors (-Wnonnull is in that group):

    • MediaService updateMedia:success:failure: and updateMedia:overallSuccess:failure: pass fieldsToUpdate:nil.
    • SafariActivity.performActivity passes options:nil to openURL:options:completionHandler:. Should be @{}.
    • MenuPostService passes withOptions:nil.
    • MenusViewController sets self.headerViewController.blog = nil.

    For each, either pass an empty value, or mark the parameter nullable if nil is meant to be allowed. After that, the app target could build with -Werror=format permanently, so format-string mistakes fail CI instead of producing wrong log lines.

Ngôn ngữ chính
Swift
Star
3.9k
Fork
1.2k
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
136

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của wordpress-mobile/WordPress-iOS

Tất cả issue của wordpress-mobile/WordPress-iOS

Issue tương tự

Thêm issue về Swift

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.