[CLOSED] Requirements for Discourse Plugin for Topic Serializer (API) v1 (CLOSED)

Superseded by this requirement (v2):


Not Parsed Code Block

Proposed Plugin Overview:

Plugin Outlet: topic-category

Discourse plugin to add a integer value from the post_custom_fields postgres table and insert that value as follows into the appropriate topic JSON API serializer so it will be available in the Get a single topic API here:

https://docs.discourse.org/#tag/Topics/paths/~1t~1{id}.json/get

Screen Shot 2020-05-09 at 7.59.39 PM

The serialized additional JSON entry to the API should be in this format:

"legacy_threadid": <integer>

(location after the id (of the topic) preferred but not required:

Screen Shot 2020-05-09 at 8.15.40 PM

Where the integer is the (first) value from this (or similar query):

Draft Query:

discourse=>  select c.value as legacy_threadid ,p.topic_id from post_custom_fields c join posts p on (p.id = c.post_id) where c.value like '%thread%'  and p.topic_id =376851;
 legacy_threadid | topic_id 
-----------------+----------
 thread-283354   |   376851
(1 row)

In this real-world example, split the resulting thread-283354 and return only the integer 283354 in the API as:

"legacy_threadid": 283354

If there is no match, return 0;

Configurable so only users with specified trust level or above in setting can access (only runs for this trust level and above)

Finally, add any required code to make this value available to a Discourse theme component (based on emberjs) as a property, such as:

{{legacy_threadid}}

and also add an option (via the plugin settings) to display a <span> at plugin-outlet:

connectors/topic-category

Where the template is defined in the plugin setttings.yml

plugins:
  legacy_forum_info_enabled:
    default: false
    client: true
  plugin_outlet_enabled:   
    default: true
  template: 'handlebars template'.  #see below
  minimum_trust_level:  trust_level_4  #configurable

Example Template:

<span class="legacy-threadid">Legacy thread <a class="legacy-threadid-link" href="https://www.unix.com/showthread.php?t={{legacy_threadid}}</a></span>
  • Required Delivery Date: No big rush, hopefully within a few weeks.
  • Budget: Open to reasonable offers for this small plugin.
  • Prefer Javascript plugin (if possible) but can discuss Ruby

Any questions, please ask. Thanks.


Notes


  1. The purpose of this plugin is primarily so the staff can check the post text (integrity check) in the original forum if they see any "oddities" in the migrated posts, especially in code or bbcode translations. This plugin is not intended for anyone other than our staff to use.

  2. If the DB query returns no match the template should display a configurable template from the settings.

  3. Development questions and collaboration on this plugin should occur openly in this topic.

1 Like

Update:

This requirement will be superseded by a different spec.

Reason:

post_custom_fields is not required. Can be done with topic_custom_fields so need to revise the spec.

Action:

Topic closed. Will post new spec soon.

Moderator comments were removed during original forum migration.