Can't use database from my importer

Plugin Development
  • First of all, I'm new to NodeJS development. I'm liking it so far (except for a few annoyances here and there).

    I am extending development of nodebb-plugin-import-ipboard (forked and will send a PR once it's done) to support a bunch of stuff the current plugin does not currently support, for instance:

    • IPB replies which are in a special blockquote format.
    • Spoiler blocks
    • Mentions
    • A few more things...

    On my nodebb-plugin-import-ipboard/index.js file, which I'm requiring from a manual test.js file (so it's not running inside NodeBB!), I placed a:
    var db = require('nodebb-plugin-import/server/db');

    But when I try to use it like this:
    var imported_post = db.getObject("_imported_post:1566");
    I just get "undefined".
    I can see on the debugger variables Redis is loaded (but I don't know if it was loaded correctly.)

    I also tried loading data instead of db:
    var data = require('nodebb-plugin-import/server/data');
    and
    var imported_post = data.getImportedPost("1566");

    And I just get undefined.
    Can someone tell me what I'm doing wrong?


Suggested Topics


  • 0 Votes
    11 Posts
    846 Views

    @dogs
    Not sure if this is still relevant to you, but I followed your code and was getting the same results. The code wasn't firing despite having a console log in the theme.js file.

    Then I decided to click on the 'Clone widgets from...' and selected 'Categories'. After that all of the .tpl names showed up in the drop down. After that any changes to the theme.js file are firing as should.

    Make sure you build and restart. I am using the included GRUNT to make development faster. Cheers!

  • 0 Votes
    1 Posts
    266 Views

    Hello,
    I have begun work on a custom email plugin, and while looking at some others that are available to see how they went about things I noticed that all of the available plugins (at least that I have found so far) already have an entry in the email setup list, regardless of if you have downloaded the associated plugin for that service (ex. Sendgrid, Mailgun, etc).

    So my questions is, if I have a custom email plugin, how exactly would I go about making it selectable / usable by the forum? Does it need to be present in the default email list? Is there a way to have my plugin inject itself into that list of providers or is there a way to override that list so that the forum knows not to use the credentials and settings in there, but instead use the ones in the plugin?

    The only real switch I have found is the "Use an external email server to send emails", which I would imagine that if it is turned off, that would not be much help either.

    If anyone has any insight on how the system works in regards to this and can point me in the right direction, I would appreciate it!

    Thanks,
    -MH

  • 0 Votes
    5 Posts
    1k Views

    Minor FYI....Elasticsearch has made a strong stand that they are not a database. There are certain levels of consistency and reliability to qualify as a database that they have said they cannot support. But if your data isn't critical, and you don't mind a noticeable a delay between when you write a document and when it available for reading, then that's fine. 🙂

  • 0 Votes
    3 Posts
    2k Views

    @yariplus Thanks!

  • 0 Votes
    3 Posts
    2k Views

    Off course, tha'll work!
    Thanks heaps for that!