GSoC 2015: Coding Period (End)
Friday, August 21, 2015I got my threaded comments feature finally working :D Struggled a lot for implementing a comment tree structure but fortunately, it is working quite nicely now. It was very important as without creating a comment-tree structure, we would have ended making queries for every single comment to get it's replies. It's obviously an inefficient way and for a large number of comments/reply thread this would've been a bad method.
I was made quite clear by my mentors about how this should be implemented. Now, every comment is made to refer to the ticket's item id. Therefore, using a single whoosh query, all the comments concerned with a particular ticket item are obtained. So, I get all the comments which looks something like this:
comments = { 'comment1':['reply1', 'reply2', 'reply3'],
'reply1':['reply4', 'reply5'],
'reply4':['reply6'],
'reply2':[],
'reply3':[],
'reply5':[],
'reply6':[],
'comment2':[],
}
The above representation is for:
comment1
reply1
reply4
reply6
reply5
reply2
reply3
comment2
Every comment also has an additional reply_to field which contains the id of the parent comment i.e. comment to which the reply is made. So, I tried this field to create a comment/reply tree. Initially, I tried creating a tree using nested list implementation. For above example I intended to do something like this:
['reply1', ['reply4', ['reply6', []], 'reply5', []], 'reply2', [], 'reply3', []]
But I failed to implement this. Later on after few paper-pencil hours I got the exact thing which I wanted but I got another way of creating indented threads of comments. I used the same recursive function I used to get above results and just altered it a bit to create a list of comments along with their indentation levels. Something like this:
[['reply1', 10], ['reply4', 20], ['reply6', 30], ['reply5', 20], ['reply2', 10], ['reply3', 10]]
In this way , only single level list is created and now there's neither a need to parse the old list based tree in the templates nor any other tree parsing python code is needed.
After this, I did a little UI improvements of the comments to make it look pretty, wrote few lines of CSS and now it looks nice.
I also worked on improving the Advanced Search feature. Implemented it more like the exisitng /+search view so it looks quite familiar. It has a search bar and extra search options: effort, difficulty, severity, priority, tags, assigned to and author which are initially collapsed like the options are listed in /+search view.
In the last week I worked on making my open CRs working, fixed issues, tested the code in both: basic and modernized theme and made sure that it works fine in both the themes, made the patch ready to be committed. I've committed the working code which can be viewed here:
https://bitbucket.org/vipul-sharma/moin-2.0/commits/branch/defaultand all the CRs are listed here: https://codereview.appspot.com/user/vipul
End of GSoC 2015 Coding Period
This has been an amazing three months of learning for me :) It was a great experience and thanks to my mentors: Thomas and Saurabh for their constant support and guidance throughout this program. I learned a lot about this project and about Open Source development from them. I would love to continue my contribution to MoinMoin in future :D and would love to contribute more to Open Source. There is lot more to learn !
0 comments