Skip to content

Show a toast after successfully submitting a comment. - #25945

Open
Vivek09Chahal wants to merge 3 commits into
wordpress-mobile:trunkfrom
Vivek09Chahal:Toast-Implemetation-on-comment-submit
Open

Show a toast after successfully submitting a comment.#25945
Vivek09Chahal wants to merge 3 commits into
wordpress-mobile:trunkfrom
Vivek09Chahal:Toast-Implemetation-on-comment-submit

Conversation

@Vivek09Chahal

@Vivek09Chahal Vivek09Chahal commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Description

Open issue: #24573

When a user submits a comment (or a reply) on a post, the composer previously just dismissed with no feedback. This adds a toast/notice confirming the submission, shown only when the comment is held for moderation (i.e. not auto-approved), so the user understands why their comment isn't visible yet.

Changes

The core problem: the composer had no way to know whether a comment was actually held for moderation. I traced the real status through the whole call chain and made it flow back to the UI.

  • CommentService (replyToPost: / replyToHierarchicalCommentWithID:) — the success block now passes back the created Comment (void (^)(Comment * _Nullable)) so callers can inspect its approval status. The reply object is re-fetched from the main context via existingObjectWithID:error:.
  • CommentCreateViewModelsave(content:) and the internal _save / sendComment closures now return Bool ("is pending moderation"), derived from newComment?.isApproved() == false.
  • CommentCreateViewController — after a successful save, once the composer is dismissed it posts a Notice with InAppUpdateNoticeStyle when isPendingModeration is true. Copy: "Comment is awaiting review" (new localized string commentCreate.commentHeldForModeration).
  • CommentDetailViewControllercreateReply / createPostCommentReply updated to propagate the same Bool through to the composer.
  • InAppUpdateNoticeStyle — extended with a new initializer taking an optional SF Symbol icon, iconColor, and title:
    • When a title is given → builds an attributedMessage (icon inline before bold text) and makes the notice auto-dismiss.
    • When nil → keeps the original persistent in-app-update banner behavior.
    • isDismissable is now set per-instance instead of a hardcoded false.
    • The toast uses checkmark.seal.fill tinted UIAppColor.success.

Testing instructions

  1. Sign in and open a post in the Reader whose site holds comments for moderation (or comment as a non-member on a site that moderates first-time commenters).
  2. Tap the comment field, type a comment, and send.
  3. Verify the composer dismisses and a toast appears: "Comment is awaiting review" with a green checkmark-seal icon, auto-dismissing after a few seconds.
  4. Repeat for a reply to an existing comment, from both the Reader comments thread and a comment opened via Notifications.
  5. On a site where your comments are auto-approved, verify no toast appears (comment just posts).
  6. Check: light/dark mode, larger Dynamic Type, VoiceOver (icon is decorative, title is read), RTL layout.
  7. Regression-check the existing in-app-update banner (persistent, non-dismissable) still looks and behaves as before.
Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-08-26.at.18.18.44.mov

Copilot AI lite review requested due to automatic review settings August 26, 2026 14:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Vivek09Chahal

Copy link
Copy Markdown
Contributor Author

Currently only implemented Toast message show up, as we don't have access to the unapproved comments. So can't implement

We display the pending comment in the comments list with a special "awaiting review" status to communicate that the comment successfully posted, but is not yet publicly visible.

this for now as comment API only send the data of the approved comments.

iconColor: UIAppColor.success, title: Strings.commentHeldForModeration
))
.post()
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This notice does not apply to all sites, right? Some site you can just publish without being reviewed. Like, if you are member of another site, your comments on that site should go straight to approved?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok will update according to that 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated Code, now toast will show only when comment is unapproved.

The core problem: the composer had no way to know whether a comment was actually held for moderation. I traced the real status through the whole call chain and made it flow back to the UI.

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