diff --git a/base/models.py b/base/models.py
index 9d2fc1c005..08afc333ff 100644
--- a/base/models.py
+++ b/base/models.py
@@ -19,22 +19,6 @@ class UuidObjidMap(models.Model):
uuid = models.CharField(max_length=40)
obj_id = models.CharField(max_length=40, unique=True)
-class FileComment(models.Model):
- """
- Model used for leave comment on file.
- NOTE:
- Need manually create index for (file_path_hash, repo_id).
- """
- repo_id = models.CharField(max_length=36, db_index=True)
- file_path = models.TextField()
- file_path_hash = models.CharField(max_length=12)
- from_email = models.EmailField()
- message = models.TextField()
- timestamp = models.DateTimeField(default=datetime.datetime.now)
-
- class Meta:
- ordering = ['-timestamp']
-
class FileDiscuss(models.Model):
"""
Model used to represents the relationship between group message and file/dir.
diff --git a/templates/file_comments.html b/templates/file_comments.html
deleted file mode 100644
index 44f9d5ca74..0000000000
--- a/templates/file_comments.html
+++ /dev/null
@@ -1,16 +0,0 @@
-{% load seahub_tags avatar_tags%}
-{% load url from future %}
-
- {% for comment in comments %}
-
- {% endfor %}
-
diff --git a/urls.py b/urls.py
index abbc146362..f566387e37 100644
--- a/urls.py
+++ b/urls.py
@@ -69,7 +69,6 @@ urlpatterns = patterns('',
url(r'^d/(?P[a-f0-9]{10})/files/$', view_file_via_shared_dir, name='view_file_via_shared_dir'),
(r'^file_upload_progress_page/$', file_upload_progress_page),
(r'^events/$', events),
- (r'^file_comment/$', file_comment),
(r'^pdf_full_view/$', pdf_full_view),
url(r'^i18n/$', i18n, name='i18n'),
(r'^download/repo/$', repo_download),
diff --git a/views/__init__.py b/views/__init__.py
index 469b839e0f..4ecc935e05 100644
--- a/views/__init__.py
+++ b/views/__init__.py
@@ -47,7 +47,7 @@ from pysearpc import SearpcError
from seahub.base.accounts import User
from seahub.base.decorators import sys_staff_required
-from seahub.base.models import UuidObjidMap, FileComment, InnerPubMsg, InnerPubMsgReply
+from seahub.base.models import UuidObjidMap, InnerPubMsg, InnerPubMsgReply
from seahub.contacts.models import Contact
from seahub.contacts.signals import mail_sended
from seahub.group.forms import MessageForm, MessageReplyForm
@@ -990,56 +990,6 @@ def repo_del_file(request, repo_id):
url = reverse('repo', args=[repo_id]) + ('?p=%s' % urllib2.quote(parent_dir.encode('utf-8')))
return HttpResponseRedirect(url)
-
-def file_comment(request):
- if request.method == 'POST':
- # handle post request to leave comment on a file
- content_type = 'application/json; charset=utf-8'
- path = request.GET.get('p', '')
-
- f = FileCommentForm(request.POST)
- if f.is_valid():
- repo_id = f.cleaned_data['repo_id']
- file_path = f.cleaned_data['file_path']
- file_path_hash = md5_constructor(file_path).hexdigest()[:12]
- message = f.cleaned_data['message']
- fc = FileComment(repo_id=repo_id, file_path=file_path,
- file_path_hash=file_path_hash,
- from_email=request.user.username, message=message)
- fc.save()
-
- # Get repo groups
- org, base_template = check_and_get_org_by_repo(repo_id,
- request.user.username)
- if org:
- repo_shared_groups = get_org_groups_by_repo(org.org_id,
- repo_id)
- else:
- repo_shared_groups = get_shared_groups_by_repo(repo_id)
-
- for group in repo_shared_groups:
- # save group message, and length should be less than 500
- gm = GroupMessage(group_id=group.id,
- from_email=request.user.username,
- message=message[:500])
- gm.save()
- # send signal
- grpmsg_added.send(sender=GroupMessage, group_id=group.id,
- from_email=request.user.username)
-
- # save attachment
- ma = MessageAttachment(group_message=gm, repo_id=repo_id,
- attach_type='file', path=path,
- src='filecomment')
- ma.save()
-
- comments = FileComment.objects.filter(file_path_hash=file_path_hash,
- repo_id=repo_id)
- html = render_to_string("file_comments.html", {
- 'comments':comments})
- return HttpResponse(json.dumps({'html': html}),
- content_type=content_type)
-
def repo_file_get(raw_path, file_enc):
err = ''
diff --git a/views/file.py b/views/file.py
index b2c5663c96..f261184f39 100644
--- a/views/file.py
+++ b/views/file.py
@@ -30,7 +30,7 @@ from pysearpc import SearpcError
from auth.decorators import login_required
from base.decorators import repo_passwd_set_required
-from base.models import UuidObjidMap, FileComment
+from base.models import UuidObjidMap
from contacts.models import Contact
from share.models import FileShare
from seahub.utils import get_httpserver_root, show_delete_days, render_error, \
@@ -278,7 +278,6 @@ def view_file(request, repo_id):
# construct some varibles
u_filename = os.path.basename(path)
filename_utf8 = urllib2.quote(u_filename.encode('utf-8'))
- comment_open = request.GET.get('comment_open', '')
current_commit = get_commits(repo_id, 0, 1)[0]
# Check whether user has permission to view file and get file raw path,
@@ -371,9 +370,7 @@ def view_file(request, repo_id):
else:
repogrp_str = ''
- # fetch file comments
file_path_hash = md5_constructor(urllib2.quote(path.encode('utf-8'))).hexdigest()[:12]
- comments = FileComment.objects.filter(file_path_hash=file_path_hash, repo_id=repo_id)
# fetch file contributors and latest contributor
contributors, last_modified, last_commit_id = get_file_contributors(repo_id, path.encode('utf-8'), file_path_hash, obj_id)
@@ -410,8 +407,6 @@ def view_file(request, repo_id):
'filetype': ret_dict['filetype'],
"applet_root": get_ccnetapplet_root(),
'groups': groups,
- 'comments': comments,
- 'comment_open':comment_open,
'DOCUMENT_CONVERTOR_ROOT': DOCUMENT_CONVERTOR_ROOT,
'use_pdfjs':USE_PDFJS,
'contributors': contributors,