-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 643 #770
Issue 643 #770
Conversation
* Base working concept * Eventual showing of the reason in respective views... currently set to a horizontal ellipsis if absent... see additional notes below Applies to OpenUserJS#643 and OpenUserJS#641 NOTES: * Test with QSP `?flagged=true` for lists and Admin or better privileges on script homepage and user homepage with logged in and logged out... there are at least 6 routes *(4 with QSP and 2 without but all elevated to Admin+)* needed to test against * If for some reason some user is flagged but there aren't any actual flags it will show up as no user and no reason e.g. Flagged column will be empty for those mustache opts * Using series in some of the *async* related calls to hopefully ensure natural ordered flags * **NOT COMPACTED** for clarity as well as for strict *async* usage * One bug fix in a view with colspan * One restoration in `.../modelParser.js` * Some class changes in a view TODO: *(mitigation)* * Needs reason attached to flagging route ... separate issue to be created and milestoned near OpenUserJS#485 and OpenUserJS#262 and similarly done in OpenUserJS#513
* Standardize on `flagList` since `flagged` is already in use * Some compaction of the code ... backed out a few changes in prior commit... added a master asynchronous function to the flag library * One bug fix with `modelParser` to acccomodate prior commit reversion **NOTES**: * This should be functionally equivalent to the last commit feature wise and a lot easier to maintain. An example of this is the dynamic field name change in this commit... easily changeable in case someone doesn't like that name but should be okay for now. Applies to OpenUserJS#643 and indirectly OpenUserJS#641
@sizzlemctwizzle |
Misc notes (before merging... questions may change):
|
if (aErr) { | ||
aNext(); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MITIGATION: Test why this error fall through is the only one (for express)... I am guessing if we (ever) have an error in the changed views ("elsewhere") we're going to 500 and not fail gracefully.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asyncComplete should always test for an error and handle it (at the very least a 500 page). If we can catch an error earlier on then great, but this is really the last line of defense. It would be nice if we could find a way to abstract this function and put it in libs/helpers.js since I hate seeing the same logic repeated, but I realize the difficulty of doing this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kind of figured that with the missing aNext()
and it raised an eyebrow yesterday in my background thinking... I think I'll do that in a single PR with some cleanup just on ./controllers/user.js
... I read elsewhere that ES6 is going to need undefined
for certain functions instead of null
(or worse some other huge object in a bug) so that is why I have been splitting out the aNext()
and return
statements... also it makes more sense not to return something that isn't there and could change down the line.
Just a misc note too node 4.x went LTS (Long Term Support) according to their site e.g. 5.x is around some corner.
Need some input from those questions above before anyone can merge. Additional note...we could eventually show Mods just the reason, but not the user/author, so they can make an informed decision as to flag a critically flagged script/user but I left that alone for this PR. |
@@ -148,3 +150,51 @@ exports.unflag = function (aModel, aContent, aUser, aCallback) { | |||
} | |||
}); | |||
}; | |||
|
|||
exports.setFlaggedListInModel = function (aModelName, aOptions, aCallback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is definitely the wrong module for this function. This module is supposed to be completely devoid of any front-end view logic (notice how "aOptions" or "options" are mentioned nowhere else in this file). This module defines the logic for how flagging is handled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So where should it go?... I don't have a clue since this function is a "one of a kind new" thing AFAIK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Answered in my comment below.
Yes, as my line comment says, the code should be moved. Create a
There is code for this already. Vote, Flag, and Remove are all actions that I implemented in that order. They are very similar so the implementations got more well thought out as I went (with Remove being the best version). I suspect that's why you're having a problem finding the right place to put the new flag function, since it's controller logic and Flag doesn't currently have a controller.
Nice to have, but lower priority. |
Done locally... need to link it in though.
That appears Greek to me at the moment... what?
Did you want me to create a base vote.js controller too?
I'll have to wait and see what you say on this part once I create the controller(s). Thanks for the feedback... more to tinker with to get this reworking. Will buzz you later. |
* Created `flag.js` controller as per sizzle and moved the export there * Created `vote.js` controller base * Move/remove last commit stuff out that was added in. * Renamed `setFlaggedListInModel` to `setFlaggedListToModel` ... this still could use some advice on exact name that is wanted for the identifier. * NOTE'd a possible extra dir traversal that shouldn't be needed as compared to below requires... this is beyond this PR and will retest/cleanup in another unrelated commit so just noting it Applies to OpenUserJS#643
@sizzlemctwizzle I still don't have a clue what you meant by "Remove has a model, lib, and controller.". Did create a vote.js controller just as a placeholder to avoid future confusion perhaps. Not linked in anywhere though. Noticed a weird Now what is the correct next step? Fully retested on dev at current PR tip since this is super fresh and that was a simple move. |
Remove action: Flag action: Vote action: |
Oh durrr... I was taking "Remove" as something you wanted me to do... not the controller itself. Sawwy. |
So did you want a different identifier name for this function e.g. signature or do you think this is PR READY? |
How about getFlaggedListForContent? |
Disagree due to the confusion. If I come back to a similar case where I can't figure out where to put it I may not recall this conversation.
I'm game for that... I thought about calling it |
Good point. I actually found myself unable to remember which actions lacked which files.
If I see Model in the name it makes me think I'm going to get (mongoose) model objects back from the function, when this function really adds more content via |
* Using this to be more consistent with other contributors and upon the advice of Lord Sizzle! :) Applies to OpenUserJS#643
Okay... done and retested (logged out, logged in with anyone, logged in with Admin) ... anything else before you test it with PR READY? I've done a shiz load of testing on this function (over 50 hours) especially when I compacted it so it should be good to go. Thanks for your patience with me and "hand holding" at my request... I'm still not clear on MVC and all the local book stores have nothing on this style of coding... search results just aren't doing it... may have to pay a visit to a University to get a hold of a book! :) |
* As described earlier placeholder so anyone knows where to start to put things without a search NOTE: Specific to OpenUserJS#770 (comment) Applies indirectly to OpenUserJS#643
* This is somewhat flexible when needed but will assist in directing contributions. This is mostly the current pattern. * During a cleanup phase will probably match this general code styling in the other controllers Applies indirectly to OpenUserJS#643
Auto-merging soon as retests and pouring over the code for a few more hours seems good to go. |
Read specific commit notes since this was at least a
twosix part'er.Applies to #643 and leads into #641
Tested on dev and local pro
A screenshot, perhaps more: