Skip to content

Commit

Permalink
Remove old post view
Browse files Browse the repository at this point in the history
  • Loading branch information
soyapark committed Jan 16, 2020
1 parent 09a13de commit 1c60c1f
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 71 deletions.
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
FROM python:2
ENV PYTHONUNBUFFERED 1
RUN apt-get update && apt-get install -y mysql-client cron && rm -rf /var/lib/apt
RUN apt-get update && rm -rf /var/lib/apt
RUN apt-get update && apt-get install -y \
telnet \
default-mysql-client \
cron && \
rm -rf /var/lib/apt/lists/*
RUN mkdir -p /home/ubuntu/production/mailx
WORKDIR /home/ubuntu/production/mailx
COPY ./murmur-env/. /opt/murmur/
Expand Down
12 changes: 9 additions & 3 deletions browser/templates/murmur/mobile_list_posts.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,25 @@ <h4><label class="label2" id="tag_{{ forloop.counter0 }}" style="background-colo
</div>

<div class="post-list-container">

{% if active_group.name != "No Groups Yet" and is_member%}
<a href="/groups/{{ active_group.name }}/create_post"><button type="button">+ New Post</button></a>
<a href="/groups/{{ active_group.name }}"><button type="button">View Group Info</button></a>
<BR><BR>
<input type="text" class="default-text" value="Search within posts" title="Search within posts"/>
{% elif not is_member %}
<a href="/accounts/login/?next=/groups/{{ active_group.name }}"><button type="button">Join the list</button></a>
{% if user.is_authenticated %}
<button type="button" id="btn-subscribe-group">Join the list</button>
{% else %}
<a href="/accounts/login/?next=/groups/{{ active_group.name }}">
<button type="button">Join the list</button>
</a>
{% endif %}

<a href="/accounts/register/">Don't have a Murmur account yet?</a>
{% else %}
<i>You are not in any groups yet. <a href="/group_list">Join or create a new group.</a>
</i>
{% endif %}
{% endif %}
<BR><BR>
</div>

Expand Down
60 changes: 1 addition & 59 deletions browser/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,66 +91,8 @@ def index(request):
if WEBSITE == 'murmur':
return HttpResponseRedirect('/posts')
elif WEBSITE == 'squadbox':
return HttpResponseRedirect('/my_group_list')


@render_to(WEBSITE+'/posts.html')
def posts(request):
if request.user.is_authenticated():
user = get_object_or_404(UserProfile, email=request.user.email)
groups = Group.objects.filter(membergroup__member=user).values("name")

thread_id = request.GET.get('tid')
if thread_id:
try:
group_name = Thread.objects.get(id=thread_id).group.name
except Thread.DoesNotExist:
pass
active_group = load_groups(request, groups, user, group_name=group_name)
else:
active_group = load_groups(request, groups, user)

if active_group['active']:
group = Group.objects.get(name=active_group['name'])
active_group['description'] = group.description
member = MemberGroup.objects.filter(member=user, group=group)
if member.count() > 0:
is_member = True

# not a member of any groups
if not active_group['active']:
return HttpResponseRedirect('/group_list')
elif group.public or is_member:
return HttpResponseRedirect('/post_list?group_name=%s' % (active_group['name']))
# if request.flavour == "mobile":
# return HttpResponseRedirect('/post_list?group_name=%s' % (active_group['name']))
# else:
# if is_member:
# request.session['active_group'] = active_group['name']
# return page_info
# else:
# return HttpResponseRedirect('/post_list?group_name=%s' % (active_group['name']))
else:
if len(groups) == 0:
return HttpResponseRedirect('/group_list')
else:
return redirect('/404?e=member')

else:
user = None
groups = []
active_group = request.GET.get('group_name')
if active_group:
group = Group.objects.get(name=active_group)
if group.public:
return HttpResponseRedirect('/post_list?group_name=%s' % (active_group))
else:
return redirect('/404?e=member')
else:
return HttpResponseRedirect(global_settings.LOGIN_URL)

return HttpResponseRedirect('/my_group_list')

# One that being used for listing group at the moment
@render_to(WEBSITE+'/mobile_list_posts.html')
def post_list(request):
tag_info = None
Expand Down
2 changes: 1 addition & 1 deletion config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# for secure connections.
relay_config = {'host': os.getenv('RELAY_HOST', 'localhost'), 'port': 8825}

receiver_config = {'host': '0.0.0.0', 'port': 8823}
receiver_config = {'host': 'localhost', 'port': 8823}

handlers = ['smtp_handler.main']

Expand Down
8 changes: 5 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
web:
build: .
container_name: murmur_web
command: bash -c "lamson start; cron && python manage.py runserver 0.0.0.0:8000"
command: bash -c "lamson start --FORCE & cron; python manage.py runserver 0.0.0.0:8000"
volumes:
- .:/home/ubuntu/production/mailx
ports:
Expand All @@ -29,11 +29,13 @@ services:
smtp:
image: namshi/smtp
expose:
- 587
- 587-8825
ports:
- "8825"
environment:
- GMAIL_USER=${GMAIL_USER}
- GMAIL_PASSWORD=${GMAIL_PASSWORD}
- PORT=587
- PORT=8825
restart: always
volumes:
youps-db:
1 change: 0 additions & 1 deletion http_handler/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ def _get_website():

EMAIL_HOST = 'localhost'
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_PORT = 25
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = False
Expand Down
2 changes: 1 addition & 1 deletion http_handler/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
if WEBSITE == 'murmur':
new_patterns = [
url(r'^about', 'browser.views.about'),
url(r'^posts$', 'browser.views.posts'),
url(r'^posts$', 'browser.views.post_list'),

url(r'^unsubscribe_get', 'browser.views.unsubscribe_get'),
url(r'^subscribe_get', 'browser.views.subscribe_get'),
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Django==1.6.11
Jinja2==2.7.3
MarkupSafe==0.23
MySQL-python==1.2.5
mysqlclient==1.4.6
South==1.0.1
bleach==1.4
chardet==2.3.0
Expand Down
1 change: 1 addition & 0 deletions smtp_handler/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ def handle_post_murmur(message, group, host, verified):

attachments = res['attachments']

logger.info("%s from %s is %s" %(message['Subject'], sender_addr, "reply" if message_is_reply else "post"))
if message_is_reply:
post_subject = "Re: " + re.sub("\[.*?\]", "", message['Subject'][4:]).strip()
insert_func = insert_reply
Expand Down

0 comments on commit 1c60c1f

Please sign in to comment.