Skip to content

Commit

Permalink
Store int history as string in mongo
Browse files Browse the repository at this point in the history
Http Results can include keps which are vaild JSON but invalid mongo
keys. Store them as a string, then check when formatting them for
dispkay if they are json that needs to be stringifies or already a
string.
  • Loading branch information
cpitman authored and geekgonecrazy committed Nov 28, 2017
1 parent 21c4efa commit eac8f68
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ <h2>
<div class="input-line double-col">
<label>{{_ "Integration_Outgoing_WebHook_History_Error_Stacktrace"}}</label>
<div>
<pre><code class="code-colors hljs json">{{{ hljsStack history.errorStack }}}</code></pre>
<pre><code class="code-colors hljs json">{{{ jsonStringify history.errorStack }}}</code></pre>
</div>
</div>
{{/if}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,12 @@ Template.integrationsOutgoingHistory.helpers({
},

jsonStringify(data) {
return data ? hljs.highlight('json', JSON.stringify(data, null, 2)).value : '';
},

hljsStack(errorStack) {
if (!errorStack) {
if (!data) {
return '';
} else if (typeof errorStack === 'object') {
return hljs.highlight('json', JSON.stringify(errorStack, null, 2)).value;
} else if (typeof data === 'object') {
return hljs.highlight('json', JSON.stringify(data, null, 2)).value;
} else {
return hljs.highlight('json', errorStack).value;
return hljs.highlight('json', data).value;
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ RocketChat.integrations.triggerHandler = new class RocketChatIntegrationHandler
}

if (typeof httpResult !== 'undefined') {
history.httpResult = httpResult;
history.httpResult = JSON.stringify(httpResult, null, 2);
}

if (typeof error !== 'undefined') {
Expand Down

0 comments on commit eac8f68

Please sign in to comment.