Repository: liqd/a4-meinberlin

Issue:
voting in brainstorming
the votings are shown on pop up for ideas within brainstorming although there is no voting.

<img width="332" alt="bildschirmfoto 2019-02-05 um 15 01 57" src="https://user-images.githubusercontent.com/35491681/52278354-20299380-2957-11e9-8368-dfb42c142a3a.png">



Discussion:
note: from a4, not a react component 
should it then be changed in A4? It just does not make sense to count votings if there is no voting-function for ideas in brainstorming. in the listview we don't show it, only on the pop-ups.
hey @phillimorland : Just got a call from administration who notices this bug in a running project. Can we fix it before the next release? Are there open questions?
ok, talked to @MagdaN , it is not that easy so we should keep it in mind but I'll take it out of the milestone.
@CarolingerSeilchenspringer we have removed votes from all pop ups in a4, this includes the map ideas as the pop up doesn't know if it is a map idea of a brainstorm idea so was only quick fix, comments remain. Will have to check about updating a4 in mB before next release but if thats a go, will close this issue
@phillimorland thanks for the quick fix. How complicated would it be to still show the votes for modules with voting? I do think we should show the votes and I guess it would be hard for me to argue why we don't show something we showed before. 
@CarolingerSeilchenspringer we would need to tell the popups what module they are from, @fuzzylogic2000 is that possible?
@phillimorland I would think, that we can tell it if it needs the count or doesn't like you did for the new comments. But I will need to check.
Well, this is still not easy.
@phillimorland I hoped, we could add a variable to the template tag or the feature to let it know or check if it is rateable. But the only (easiest) way now is to add another js-file for maps with ideas that have voting. We would need to then check in the template, because brainstorming and map ideas use the same one. https://github.com/liqd/a4-meinberlin/blob/e672d72da2520fe24152120d65c945427678718f/meinberlin/apps/mapideas/templates/meinberlin_mapideas/mapidea_list.html#L5 We would also need to add it to webpack.
Oh, but we also do check for the image https://github.com/liqd/adhocracy4/blob/acd3c9cc16a3858739a87e8a356e5a2f40dc03d2/adhocracy4/maps/static/a4maps/a4maps_display_points.js#L72 How does this get in there?
@CarolingerSeilchenspringer How important is this? I already invested about 20 minutes to come this far and to change the behaviour/add a new file to a4/investigate if there's a better solution would take another while. 
@fuzzylogic2000 it is not urgent but important. This also effects a+ so I think we should find a solution. So we could take it out of the milestone but then we would just postpone the problem. And to have the popup without any infos on voting and comments would be a sad step back for UX in my opinion.
we have comments still just no ratings
So, we decided to not fix it for the next release. But we still need to update a4. So I will put it back into the milestone...

Resolving patch:
diff --git a/meinberlin/apps/newsletters/emails.py b/meinberlin/apps/newsletters/emails.py
--- a/meinberlin/apps/newsletters/emails.py
+++ b/meinberlin/apps/newsletters/emails.py
@@ -50,5 +50,6 @@ class NewsletterEmailAll(NewsletterEmail):
 
     def get_receivers(self):
         return User.objects\
+            .filter(get_newsletters=True)\
             .filter(is_active=True)\
             .distinct()
diff --git a/meinberlin/apps/users/admin.py b/meinberlin/apps/users/admin.py
--- a/meinberlin/apps/users/admin.py
+++ b/meinberlin/apps/users/admin.py
@@ -12,7 +12,8 @@ class UserAdmin(auth.admin.UserAdmin):
     fieldsets = (
         (None, {'fields': ('username', 'email', 'password', 'groups')}),
         (_('Permissions'), {'fields': ('is_staff', 'is_superuser')}),
-        (_('Important dates'), {'fields': ('last_login', 'date_joined')}),
+        (_('Important dates'),
+         {'fields': ('last_login', 'date_joined', 'get_newsletters')}),
     )
     add_fieldsets = (
         (None, {
@@ -20,10 +21,10 @@ class UserAdmin(auth.admin.UserAdmin):
             'fields': ('username', 'email', 'password1', 'password2'),
         }),
     )
-    readonly_fields = ('date_joined', 'last_login')
+    readonly_fields = ('date_joined', 'last_login', 'get_newsletters')
     list_display = (
         'id', 'username', 'email', 'date_joined', 'last_login', 'is_staff',
-        'is_superuser'
+        'is_superuser', 'get_newsletters'
     )
     list_filter = ('is_staff', 'is_superuser', 'last_login')
     search_fields = ('username', 'email', 'id')


Test patch: