Nodebb: Flag Detail Page causing server crash when reporter has blocked poster

Created on 8 Nov 2018  路  3Comments  路  Source: NodeBB/NodeBB

In Nodebb 1.10.1

When viewing a flag detail page the forum crashes because the reporter has blocked the person being reported.

modsController.flags.detail ->
flags.get (in src/flags.js) ->
Flags.getTarget (in src/flags.js) ->
posts.getPostsByPids (in src/posts.js) ->
user.blocks.filter (which filters out the reported post causing getPostsByPids to return empty postData) ->
topics.addPostData (in src/posts.js - which returns undefined) ->
causes the Object.keys function below to produce this error "Cannot convert undefined or null to object"

https://github.com/NodeBB/NodeBB/blob/c8d3c3197ba3025ed395e400f8cb0b312fac790e/src/controllers/mods.js#L140

bug

Most helpful comment

:man_facepalming:

All 3 comments

:man_facepalming:

Just to clarify, this occurs when the moderator viewing the page has blocked the reported individual, right?

No when the reporter of the flagged post has blocked the poster of the post. When doing getPostsByPids it uses data.base.uid which is the reporter of the flag. Though which ever uid you use, if they have them blocked then the same issue will occur

Was this page helpful?
0 / 5 - 0 ratings

Related issues

darKnight0037 picture darKnight0037  路  4Comments

BenLubar picture BenLubar  路  3Comments

julianlam picture julianlam  路  4Comments

djensen47 picture djensen47  路  4Comments

cryptoethic picture cryptoethic  路  4Comments