Merge Request #35

Merged
softwarepublico/colab!35
Created by Carlos Coêlho

Disable social networks

Assignee: Sergio Oliveira
Milestone: None

Merged by Sergio Oliveira

Source branch has been removed
Commits (6)
5 participants
  • 08d286e4ed2d9bc51fc10057fc32a3d4?s=40&d=identicon
    Carlos Coêlho @carlos

    @msfernandes @alexandrealmeidabarbosa Please, review these commits.

    Choose File ...   File name...
    Cancel
  • 5eb59358fc7b3b7402ae353f8fb36293?s=40&d=identicon
    Macartur Sousa @macartur

    Everythings is OK. @seocam

    Choose File ...   File name...
    Cancel
  • 2eecd4b7edebcb887e143c62846b2048?s=40&d=identicon
    Rodrigo Siqueira de Melo started a discussion on the outdated diff
    last updated by Rodrigo Siqueira de Melo
    colab/settings.py
    9 9 """
    10 10  
    11 11 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
      12 +import mimetypes
    12 13 import os
    13   -BASE_DIR = os.path.dirname(__file__)
    14 14  
    15   -# Used for settings translation
      15 +from django.contrib.messages import constants as messages
    1
    2eecd4b7edebcb887e143c62846b2048?s=40&d=identicon
    Rodrigo Siqueira de Melo started a discussion on the outdated diff
    last updated by Sergio Oliveira
    colab/super_archives/models.py
    210   - now = timezone.now()
    211   - days_ago = lambda date: (now - date).days
    212   - get_score = lambda weight, created: max(weight - (days_ago(created)
    213   - // 3), 5)
    214   -
    215 218 vote_score = 0
    216 219 replies_score = 0
    217 220 for msg in self.message_set.all():
    218 221 # Calculate replies_score
    219   - replies_score += get_score(300, msg.received_time)
      222 + replies_score += self.get_score(300, msg.received_time)
    220 223  
    221 224 # Calculate vote_score
    222 225 for vote in msg.vote_set.all():
    223   - vote_score += get_score(100, vote.created)
      226 + vote_score += self.get_score(100, vote.created)
    2
    • 2eecd4b7edebcb887e143c62846b2048?s=40&d=identicon
      Rodrigo Siqueira de Melo @rodrigo

      Why you defined 300 at line number 222 and 100 here?

      Choose File ...   File name...
      Cancel
    • 9fe63c7bd60deeb55e409a1d7dd173f5?s=40&d=identicon
      Sergio Oliveira @seocam

      @rodrigosiqueiramelo is that question for me? You can use @username to make direct questions.

      The 100 and 300 are just weights. When calculating the relevance score for a thread each reply is 3x stronger than a vote in the same thread. That's because the vote it's not for the thread but for an answer. In fact so far voting is not a broadly used feature.

      As this relevance algorithm is very primitive ideas for improving it are very welcome.

      Choose File ...   File name...
      Cancel
    2eecd4b7edebcb887e143c62846b2048?s=40&d=identicon
    Rodrigo Siqueira de Melo started a discussion on the outdated diff
    last updated by Carlos Coêlho
    tests/run.py
    ... ... @@ -3,17 +3,16 @@
  • 2eecd4b7edebcb887e143c62846b2048?s=40&d=identicon
    Rodrigo Siqueira de Melo @rodrigo

    1 - All tests running without error. 2 - Flake8 passed. 3 - I gave some suggestions about the code style.

    About the feature: The feature looks ok, however when I compared the behaviour of the new feature with the old one I noticed some differences. Following: 1 - If you disable the social network, it is ok. 2 - If you enable the social network, something is different from "beta". You cannot see the social network in your profile, however, in the old version you could. Please, take a look at the picture attached in this message to make clear the problem. @carlospecter @kanashiro.duarte

    Choose File ...   File name...
    Cancel
  • 08d286e4ed2d9bc51fc10057fc32a3d4?s=40&d=identicon
    Carlos Coêlho @carlos

    It was missing a context processor in order to properly treat whether social networks are enabled or not.

    Choose File ...   File name...
    Cancel
  • 9fe63c7bd60deeb55e409a1d7dd173f5?s=40&d=identicon
    Sergio Oliveira @seocam

    I don't think that's the best approach for user profile customization. In fact that just allow us to disable/enable a bunch of fields. That's ok for now but I'd you guys to starting thinking further ;)

    Choose File ...   File name...
    Cancel
  • 9fe63c7bd60deeb55e409a1d7dd173f5?s=40&d=identicon
    Sergio Oliveira started a discussion on the outdated diff
    last updated by Carlos Coêlho
    colab/super_archives/models.py
    182 186 self.subject_token,
    183 187 self.message_set.count())
    184 188  
      189 + def days_ago(self, date):
    2
    • 9fe63c7bd60deeb55e409a1d7dd173f5?s=40&d=identicon
      Sergio Oliveira @seocam

      I would define both days_ago and get_score as protected methods. It doesn't make sense to expose than as a model method:

      thread.days_ago(date)? thread.get_score(weight, created)? This is even confusing since it actually won't return thread.score.

      Choose File ...   File name...
      Cancel
    • 08d286e4ed2d9bc51fc10057fc32a3d4?s=40&d=identicon
      Carlos Coêlho @carlos

      Understood, we'll change them into protected methods.

      Choose File ...   File name...
      Cancel
    9fe63c7bd60deeb55e409a1d7dd173f5?s=40&d=identicon
    Sergio Oliveira started a discussion on the outdated diff
    last updated by Sergio Oliveira
    colab/wsgi.py
    8 8 """
    9 9  
    10 10 import os
      11 +from django.core.wsgi import get_wsgi_application
    3
    • 9fe63c7bd60deeb55e409a1d7dd173f5?s=40&d=identicon
      Sergio Oliveira @seocam

      Does that work? I believe django generates this file in that way for a reason. We must set settings before trying to import django stuff.

      Choose File ...   File name...
      Cancel
    • 08d286e4ed2d9bc51fc10057fc32a3d4?s=40&d=identicon
      Carlos Coêlho @carlos

      Maybe we'll need to add a flag to ignore these lines on both wsgi.py and settings.py, don't you think? We've changed them because the build was failing.

      Choose File ...   File name...
      Cancel
    • 9fe63c7bd60deeb55e409a1d7dd173f5?s=40&d=identicon
      Sergio Oliveira @seocam

      flake8 added the E402 and E731 recently. It also affected Django repo: https://github.com/django/django/commit/6e23c9be46a3ab74c39daba5ce344b818ac30608

      Their solution was to ignore these errors (they already ignore other errors).

      Independent on the solution I believe we should deal with it in a different MR.

      Choose File ...   File name...
      Cancel
    9fe63c7bd60deeb55e409a1d7dd173f5?s=40&d=identicon
    Sergio Oliveira started a discussion on the outdated diff
    last updated by Sergio Oliveira
    colab/settings.py
    256 258 SUPER_ARCHIVES_EXCLUDE = []
    257 259 SUPER_ARCHIVES_LOCK_FILE = '/var/lock/colab/import_emails.lock'
    258 260  
    259   -# Feedzilla (planet)
    260   -from feedzilla.settings import * # noqa (flake8 ignore)
    1
    • 9fe63c7bd60deeb55e409a1d7dd173f5?s=40&d=identicon
      Sergio Oliveira @seocam

      ???

      Why are you changing feedzilla stuff out-of feedzilla area? The settings are grouped by tool for making it easier to find/change it.

      Choose File ...   File name...
      Cancel
  • 9fe63c7bd60deeb55e409a1d7dd173f5?s=40&d=identicon
    Sergio Oliveira @seocam

    Guys, this MR is full of changes not related with the feature. If that's not a MR meant to be a major refactor please try to stick to feature you are working on. I'm waiting for a full review on this without unrelated changes.

    Choose File ...   File name...
    Cancel
  • 08d286e4ed2d9bc51fc10057fc32a3d4?s=40&d=identicon
    Carlos Coêlho @carlos

    Removed unrelated stuff and protected methods. Ran the tests, it's all OK. About the flake8 warning, an issue will be opened to discuss this subject.

    Choose File ...   File name...
    Cancel