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

Abierto
#26,260 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
ios, objective-c, swift
Área
mobile

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

[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.

Lenguaje dominante
Swift
Estrellas
3.9k
Forks
1.2k
Merge medio
1 d 23 h
PR fusionados (30 d)
136

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de wordpress-mobile/WordPress-iOS

Todos los issues de wordpress-mobile/WordPress-iOS

Issues similares

Más issues de Swift

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.