fix topic update integration test, topicGetByUrl now optionally applies defaults
[websub-hub] / src / db / postgres / index.js
index 34511102ec5a0e596d0408e2a2bb8bfedeb94eab..2eca12f4909799f6d60ab2249d79d47a3cb4e6e1 100644 (file)
@@ -789,14 +789,17 @@ class DatabasePostgres extends Database {
   }
 
 
-  async topicGetByUrl(dbCtx, topicUrl) {
+  async topicGetByUrl(dbCtx, topicUrl, applyDefaults = true) {
     const _scope = _fileScope('topicGetByUrl');
     this.logger.debug(_scope, 'called', { topicUrl });
 
     let topic;
     try {
       topic = await dbCtx.oneOrNone(this.statement.topicGetByUrl, { topicUrl });
-      return this._topicDefaults(topic);
+      if (applyDefaults) {
+        topic = this._topicDefaults(topic);
+      }
+      return topic;
     } catch (e) {
       this.logger.error(_scope, 'failed', { error: e, topic, topicUrl });
       throw e;