Skip to content

[Sources] Wordpress_com #16500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 8, 2025
Merged

Conversation

SokolovskyiK
Copy link
Contributor

@SokolovskyiK SokolovskyiK commented May 1, 2025

@vunguyenhung
Fixes #15127
Fixed sources: new post, comment, and follower.
Tested via pd dev — everything works.

Please note that I added activate() so that when the source is deployed, it fetches the latest comment, post, or follower to initialize properly and emit events only for items with higher IDs.

If the user changes something like the site or type, the last comment/post/follower ID is reinitialized without emitting events.
For example, if they change the post ID to one where the last comment ID is lower, it could otherwise cause unpredictable behavior.
To prevent this, activate() reinitializes on any change.

изображение
изображение
изображение
изображение

Summary by CodeRabbit

  • New Features

    • Added options to configure polling intervals for new comments, followers, and posts.
    • Introduced follower type selection for new follower detection.
    • Improved initialization and activation handling for new comment, follower, and post triggers.
  • Improvements

    • Enhanced summary messages for post creation and deletion actions for better clarity.
    • Centralized and simplified data fetching and initialization logic across triggers.
  • Bug Fixes

    • Removed unnecessary warnings and error messages from post, comment, follower, and media actions.
  • Chores

    • Updated component and action versions.

Copy link

vercel bot commented May 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) May 7, 2025 8:58am

Copy link

vercel bot commented May 1, 2025

@SokolovskyiK is attempting to deploy a commit to the Pipedreamers Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented May 1, 2025

Error: Could not generate a valid Mermaid diagram after multiple attempts.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

components/wordpress_com/sources/new-follower/new-follower.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

components/wordpress_com/wordpress_com.app.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@adolfo-pd adolfo-pd added the User submitted Submitted by a user label May 1, 2025
@pipedream-component-development
Copy link
Collaborator

Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified.

@pipedream-component-development
Copy link
Collaborator

Thanks for submitting this PR! When we review PRs, we follow the Pipedream component guidelines. If you're not familiar, here's a quick checklist:

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🔭 Outside diff range comments (2)
components/wordpress_com/sources/new-follower/new-follower.mjs (2)

80-87: ⚠️ Potential issue

initialize is called with the wrong cursor key ("lastPostId" instead of "lastFollowerId").

Passing the wrong key means the cursor for followers is never updated; every run after the first will treat all followers as “new” and emit duplicates.

-    if (!lastFollowerId) await wordpress.initialize(followers, db, "lastPostId");
+    if (!lastFollowerId) await wordpress.initialize(followers, db, "lastFollowerId");

90-110: 🛠️ Refactor suggestion

Persist the cursor as a number to avoid string/number mismatches.

maxFollowerIdTracker may be set to a string when you copy follower.ID.
Persisting it as a string and later coercing with Number()NaN can break the “no-duplicate” guarantee.

-      if (Number(follower.ID) > maxFollowerIdTracker) {
-        maxFollowerIdTracker = follower.ID;
+      const followerIdNum = Number(follower.ID);
+      if (followerIdNum > maxFollowerIdTracker) {
+        maxFollowerIdTracker = followerIdNum;
       }
 …
-      await db.set("lastFollowerId", maxFollowerIdTracker);
+      await db.set("lastFollowerId", Number(maxFollowerIdTracker));
🧹 Nitpick comments (5)
components/wordpress_com/wordpress_com.app.mjs (1)

165-175: Good implementation of the initialization logic

The initialize method provides a centralized way to handle cursor initialization for WordPress sources. It appropriately:

  • Checks for empty arrays
  • Logs informative messages
  • Sets the database cursor value
  • Returns appropriate Boolean results

This implementation will help prevent duplicate event emissions as mentioned in the PR objectives.

There's a small style issue with an extra space before the semicolon on line 174.

-      return true ;
+      return true;
components/wordpress_com/actions/upload-media/upload-media.mjs (1)

78-79: Improved success message format

The summary message has been reformatted to be more user-friendly with consistent formatting for warnings.

There's a parenthesis in the message that appears to be a typo:

- $.export("$summary", `Media ID "${media.ID})" has been successfully uploaded` +
+ $.export("$summary", `Media ID "${media.ID}" has been successfully uploaded` +
components/wordpress_com/common/methods.mjs (1)

204-212: Suppress dangling hyphen when no warnings are present

throwCustomError() now safely defaults warnings to an empty array – great!
However, when warnings.length === 0, the formatted string still appends "\n- " which leaves a stray hyphen at the end of every error message.

-  throw new Error(` ${mainMessage} ( ${thrower} error ) : ${error.message}. ` + "\n- " +
-     warnings.join("\n- "));
+  const warningsBlock = warnings.length
+    ? "\n- " + warnings.join("\n- ")
+    : "";
+
+  throw new Error(
+    ` ${mainMessage} ( ${thrower} error ) : ${error.message}. ${warningsBlock}`,
+  );

This keeps the output tidy when no warnings exist while preserving the current format when they do.

components/wordpress_com/sources/new-follower/new-follower.mjs (2)

35-60: Minor: use the destructured db consistently (or drop it).

Inside activate() you destructure db but still reference this.db.
Pick one form to keep the code consistent and easier to read.

-      await this.db.set("lastFollowerId", null); //reset
+      await db.set("lastFollowerId", null); // reset

(or remove db from the destructuring list).


29-33: Consider adding sensible defaults to the timer prop.

Without a default, users must always configure the interval manually, which can be error-prone.
Typical sources expose a reasonable default (e.g. every 15 min) while still allowing overrides.

Example:

 timer: {
   type: "$.interface.timer",
   label: "Timer",
   description: "How often to poll WordPress for new followers.",
+  default: {
+    intervalSeconds: 900,
+  },
 },
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 302aec1 and c1859ac.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • components/wordpress_com/actions/create-post/create-post.mjs (2 hunks)
  • components/wordpress_com/actions/delete-post/delete-post.mjs (2 hunks)
  • components/wordpress_com/actions/upload-media/upload-media.mjs (2 hunks)
  • components/wordpress_com/common/methods.mjs (1 hunks)
  • components/wordpress_com/sources/new-comment/new-comment.mjs (3 hunks)
  • components/wordpress_com/sources/new-follower/new-follower.mjs (4 hunks)
  • components/wordpress_com/sources/new-post/new-post.mjs (3 hunks)
  • components/wordpress_com/wordpress_com.app.mjs (2 hunks)
🔇 Additional comments (6)
components/wordpress_com/wordpress_com.app.mjs (1)

48-54: Well-implemented mock utility function

This _mock$ function provides a clean implementation using Proxy to intercept any property access and return a function that logs arguments. This will be useful for testing and debugging purposes.

components/wordpress_com/actions/delete-post/delete-post.mjs (2)

7-7: Version increment is appropriate

The version bump from 0.0.1 to 0.0.2 is appropriate for the message format change.


51-52: Improved success message format

The summary message has been reformatted to be more user-friendly with better wording and formatting.

components/wordpress_com/actions/create-post/create-post.mjs (2)

7-7: Significant version increment

The version has been incremented from 0.0.1 to 0.0.9, which is a substantial jump for what appears to be a relatively minor change in the summary message format.

Was this intended to be such a large version increment, or was it meant to be 0.0.2 to match the other actions?


83-85: Enhanced success message with post title

The summary message has been improved to include the post title in addition to the ID, making it more informative for users.

components/wordpress_com/actions/upload-media/upload-media.mjs (1)

8-8: Version increment is appropriate

The version bump from 0.0.1 to 0.0.2 is appropriate for the message format change.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
components/wordpress_com/sources/new-follower/new-follower.mjs (2)

35-60: The activate hook implementation looks good but needs documentation.

The activate hook properly initializes the component by resetting state and fetching initial data. This prevents emitting historical events on first run and handles parameter changes correctly.

Consider adding a brief JSDoc comment explaining the purpose of the activate hook, particularly highlighting how it handles reinitialization when parameters change.

hooks: {
+  /**
+   * Initializes the component by resetting state and fetching initial follower data.
+   * This ensures we only emit events for new followers after activation and
+   * properly reinitialize when site parameters change.
+   */
  async activate() {

52-58: Consider conditional initialization in activate hook.

The activate hook always resets the lastFollowerId to null, which means any deployment will reset tracking. Consider if this is the intended behavior, especially for updates that don't change functionality.

You might want to use conditional logic that only resets when certain props change:

- await this.db.set("lastFollowerId", null); //reset
+ // Only reset if site has changed
+ const currentSite = await this.db.get("currentSite");
+ if (currentSite !== site) {
+   await this.db.set("lastFollowerId", null);
+   await this.db.set("currentSite", site);
+ }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c1859ac and 588ac45.

📒 Files selected for processing (8)
  • components/airtable_oauth/package.json (1 hunks)
  • components/wordpress_com/actions/create-post/create-post.mjs (2 hunks)
  • components/wordpress_com/actions/delete-post/delete-post.mjs (2 hunks)
  • components/wordpress_com/actions/upload-media/upload-media.mjs (2 hunks)
  • components/wordpress_com/sources/new-comment/new-comment.mjs (3 hunks)
  • components/wordpress_com/sources/new-follower/new-follower.mjs (4 hunks)
  • components/wordpress_com/sources/new-post/new-post.mjs (3 hunks)
  • components/wordpress_com/wordpress_com.app.mjs (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • components/airtable_oauth/package.json
🚧 Files skipped from review as they are similar to previous changes (6)
  • components/wordpress_com/actions/delete-post/delete-post.mjs
  • components/wordpress_com/actions/create-post/create-post.mjs
  • components/wordpress_com/actions/upload-media/upload-media.mjs
  • components/wordpress_com/wordpress_com.app.mjs
  • components/wordpress_com/sources/new-comment/new-comment.mjs
  • components/wordpress_com/sources/new-post/new-post.mjs
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Lint Code Base
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
🔇 Additional comments (4)
components/wordpress_com/sources/new-follower/new-follower.mjs (4)

7-7: Version increment looks appropriate.

The version bump from 0.0.1 to 0.0.4 aligns with the significant functionality changes in this component.


10-19: Good refactoring for improved modularity.

Extracting the follower fetching logic into a dedicated method improves code organization and maintainability. This encapsulation makes the code more readable and easier to maintain.


29-33: User-configurable polling frequency is a good addition.

Adding a timer property allows users to control how frequently the component checks for new followers, which improves flexibility and resource utilization.


75-75: Code refactoring improves consistency.

Using the extracted method aligns with the architectural improvements made throughout the component.

michelle0927
michelle0927 previously approved these changes May 3, 2025
Copy link
Collaborator

@michelle0927 michelle0927 left a comment

Choose a reason for hiding this comment

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

Looks good, I just updated some of the versions. I know when you're testing, you probably have to increase them more. However, for publishing, we want the versions just one digit higher than they were previously published at.

@SokolovskyiK
Copy link
Contributor Author

@michelle0927
Oh, so when I publish to my account for testing, increasing the version doesn’t affect the version in the whole system for the same key?
Got it — just +1 from the latest merged version.
Thanks, will do

Copy link
Collaborator

@vunguyenhung vunguyenhung left a comment

Choose a reason for hiding this comment

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

Hello @SokolovskyiK, could you check my comments here?

Comment on lines 83 to 85
$.export("$summary",
`Post “${this.title}” is successfully created with ID “${response?.ID}”` +
"\n- " + warnings.join("\n- "));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove the warnings stuff here. Just export the summary as plain text

Suggested change
$.export("$summary",
`Post “${this.title}” is successfully created with ID “${response?.ID}”` +
"\n- " + warnings.join("\n- "));
$.export("$summary",
`Post “${this.title}” is successfully created with ID “${response?.ID}”`);

Comment on lines 51 to 52
$.export("$summary", `Post ID “${response?.ID}” has been successfully deleted` +
"\n- " + warnings.join("\n- "));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove the warnings stuff here. Just export the summary as plain text

Suggested change
$.export("$summary", `Post ID “${response?.ID}” has been successfully deleted` +
"\n- " + warnings.join("\n- "));
$.export("$summary", `Post ID “${response?.ID}” has been successfully deleted`);

Comment on lines 77 to 79
`Media ID “${media.ID}” has been successfully uploaded`;
$.export("$summary", `Media ID “${media.ID}” has been successfully uploaded` +
"\n- " + warnings.join("\n- "));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove the warnings stuff here. Just export the summary as plain text

Suggested change
`Media ID “${media.ID}” has been successfully uploaded`;
$.export("$summary", `Media ID “${media.ID}” has been successfully uploaded` +
"\n- " + warnings.join("\n- "));
$.export("$summary", `Media ID “${media.ID}” has been successfully uploaded`);

Comment on lines 49 to 57
timer: {
type: "$.interface.timer",
label: "Timer",
description: "How often to poll WordPress for new comments.",
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add default timer

Suggested change
timer: {
type: "$.interface.timer",
label: "Timer",
description: "How often to poll WordPress for new comments.",
},
timer: {
type: "$.interface.timer",
label: "Timer",
description: "How often to poll WordPress for new comments.",
default: {
// import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
},
},

Comment on lines 29 to 37
timer: {
type: "$.interface.timer",
label: "Timer",
description: "How often to poll WordPress for new followers.",
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add default timer

Suggested change
timer: {
type: "$.interface.timer",
label: "Timer",
description: "How often to poll WordPress for new followers.",
},
timer: {
type: "$.interface.timer",
label: "Timer",
description: "How often to poll WordPress for new followers.",
default: {
// import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
},
},

Comment on lines 48 to 56
timer: {
type: "$.interface.timer",
label: "Timer",
description: "How often to poll WordPress for new posts.",
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add default timer

Suggested change
timer: {
type: "$.interface.timer",
label: "Timer",
description: "How often to poll WordPress for new posts.",
},
timer: {
type: "$.interface.timer",
label: "Timer",
description: "How often to poll WordPress for new posts.",
default: {
// import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
},
},

Comment on lines 48 to 54
_mock$() {
return new Proxy({}, {
get() {
return (...args) => console.log(...args);
},
});
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just recently found out that - no, we don't=)
Will remove it

@@ -1,6 +1,6 @@
{
"name": "@pipedream/airtable_oauth",
"version": "0.5.0",
"version": "0.5.1",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please revert this change, it is not related to wordpress.com app

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok

@SokolovskyiK
Copy link
Contributor Author

@vunguyenhung Hi. Sure, will do.

@SokolovskyiK
Copy link
Contributor Author

SokolovskyiK commented May 5, 2025

Hi. @vunguyenhung
Done.

But after I did this
изображение

Components check did not like it

изображение

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
components/wordpress_com/sources/new-follower/new-follower.mjs (1)

47-54: Added timer configuration as requested.

The timer property has been implemented with the recommended default polling interval as requested in previous review comments.

🧹 Nitpick comments (2)
components/wordpress_com/wordpress_com.app.mjs (1)

165-175: Well-structured initialization method for cursor management.

The initialize method centralizes cursor initialization logic across source components, reducing code duplication and standardizing the "last seen" ID tracking process.

Minor formatting issue:

- return true ;
+ return true;
components/wordpress_com/sources/new-follower/new-follower.mjs (1)

56-72: Effective initialization implementation.

The activate hook properly initializes the source by resetting the cursor and fetching initial followers. This ensures the source only emits events for new followers after activation, addressing a key PR objective.

Consider adding a comment explaining the reset purpose:

- await this.db.set("lastFollowerId", null); //reset
+ // Reset cursor when source is activated or parameters are changed
+ await this.db.set("lastFollowerId", null);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bbf87b2 and 25c3d7b.

📒 Files selected for processing (2)
  • components/wordpress_com/sources/new-follower/new-follower.mjs (2 hunks)
  • components/wordpress_com/wordpress_com.app.mjs (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: pnpm publish
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
🔇 Additional comments (7)
components/wordpress_com/wordpress_com.app.mjs (2)

142-142: Improved follower API integration with type filtering.

The getWordpressFollowers method now supports filtering followers by type through the new type parameter, which is properly passed to the API endpoint.

Also applies to: 147-147


157-164: Appropriately implemented FormData validation.

This utility method correctly checks if an input is a FormData object by verifying it has the expected methods and properties. As confirmed in the past review comments, this replaces the previously imported common method.

components/wordpress_com/sources/new-follower/new-follower.mjs (5)

2-2: Properly imported platform constant and incremented version.

The version increment and import of the default polling interval constant are appropriate for the changes being made.

Also applies to: 8-8


11-21: Well-organized method encapsulation.

Creating a dedicated getWordpressFollowers method improves code organization and maintainability by centralizing the API call logic.


31-46: Good implementation of follower type selection.

The new type property with clear options and descriptions gives users flexibility to choose between WordPress.com followers and email-only followers.


74-74: Improved run method signature and API call.

Updated to use the new centralized method for fetching followers, which improves code maintainability.

Also applies to: 80-80


86-86:

✅ Verification successful

Simplified first-run logic.

The explicit first-run cursor initialization has been replaced with a single call to wordpress.initialize, which centralizes and standardizes this logic.


🏁 Script executed:

#!/bin/bash
# Verify that all other sources use consistent initialization patterns
grep -r "wordpress.initialize" --include="*.mjs" components/wordpress_com/sources/

Length of output: 875


Simplified first-run logic verified

All WordPress sources now use a single call to wordpress.initialize(...) when their last*Id is unset, centralizing cursor setup consistently:

  • components/wordpress_com/sources/new-comment/new-comment.mjs
  • components/wordpress_com/sources/new-post/new-post.mjs
  • components/wordpress_com/sources/new-follower/new-follower.mjs

No further changes needed.

@michelle0927
Copy link
Collaborator

Hi @vunguyenhung, this one needs your approval to be merged.

@vunguyenhung
Copy link
Collaborator

Hey @michelle0927 , approved

@michelle0927 michelle0927 merged commit 4b5a9bf into PipedreamHQ:master May 8, 2025
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
User submitted Submitted by a user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Components] wordpress_com
5 participants