That's right, if clause is to maintain compatibility with video app, if we decide to move thumbnail_date_group class to shared/media/js, if not we can do without if. 

Code for setting firstThumbnailPosition is in thumbnail_list.js inside getItemGroup method, where we are getting the group for newly added file and setting the first thumbnailposition to the total number of thumbnails in all previous groups. We are setting the datasetindex of all subsequent thumbnails in gallery.js at Line 544. 

I agree using filenames as dataset values is a much neater approach. However in gallery.js , we are using data set index and files[ ] heavily in ImageEditor.js, frames.js and in gallery.js. Using file name instead of data set index will refactor a lot of code in these files. Thas why decided to maintain dataset index with above code. Let me know if we should keep data set index  or go ahead with refactoring to use file names as scope of this bug.