Skip to content

[ENG-7908] Remove Meetings, Comments and OSF Groups Notifications #11133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions admin/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,6 @@
</div>
{% endif %}
{% endif %}
{% if perms.osf.view_conference %}
<li><a href="{% url 'meetings:list' %}"><i class='fa fa-link'></i> <span>Meetings</span></a></li>
{% endif %}
{% if perms.osf.view_metrics %}
<li><a href="{% url 'metrics:metrics' %}"><i class='fa fa-link'></i> <span>Metrics</span></a></li>
{% endif %}
Expand Down
5 changes: 2 additions & 3 deletions api_tests/subscriptions/views/test_subscriptions_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ def url(self, user, node):
def test_list_complete(self, app, user, provider, node, global_user_notification, url):
res = app.get(url, auth=user.auth)
notification_ids = [item['id'] for item in res.json['data']]
# There should only be 4 notifications: users' global, node's comments, node's file updates and provider's preprint added.
assert len(notification_ids) == 4
# There should only be 3 notifications: users' global, node's file updates and provider's preprint added.
assert len(notification_ids) == 3
assert f'{user._id}_global' in notification_ids
assert f'{provider._id}_new_pending_submissions' in notification_ids
assert f'{node._id}_comments' in notification_ids
assert f'{node._id}_file_updated' in notification_ids

def test_unauthenticated(self, app, url):
Expand Down
16 changes: 0 additions & 16 deletions osf/management/commands/transfer_quickfiles_to_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@
)
from osf.models.base import generate_guid
from osf.models.quickfiles import get_quickfiles_project_title
from osf.models.queued_mail import QueuedMail
from osf.utils.datetime_aware_jsonfield import DateTimeAwareJSONField

from addons.osfstorage.models import OsfStorageFile
from website import mails, settings
from django.contrib.contenttypes.models import ContentType

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -65,7 +63,6 @@ def remove_quickfiles():
logger.info(f'Created {len(guids)} Guids')

node_logs = []
queued_mail = []
pbar = tqdm(total=target_count)
for node in quick_files_nodes:
node_logs.append(NodeLog(
Expand All @@ -75,17 +72,6 @@ def remove_quickfiles():
params={'node': node._id},
action=NodeLog.MIGRATED_QUICK_FILES
))
queued_mail.append(QueuedMail(
user=node.creator,
to_addr=node.creator.email,
send_at=QUICKFILES_DATE,
email_type=mails.QUICKFILES_MIGRATED.tpl_prefix,
data=dict(
osf_support_email=settings.OSF_SUPPORT_EMAIL,
can_change_preferences=False,
quickfiles_link=node.absolute_url
)
))
node.logs.update(
params=Func(
F('params'),
Expand All @@ -100,8 +86,6 @@ def remove_quickfiles():
logger.info('Updated logs')
NodeLog.objects.bulk_create(node_logs)
logger.info(f'Created {len(node_logs)} logs')
QueuedMail.objects.bulk_create(queued_mail)
logger.info(f'Created {len(queued_mail)} mails')

quick_files_nodes.update(description=QUICKFILES_DESC, type='osf.node')
logger.info(f'Projectified {target_count} QuickFilesNodes')
Expand Down
5 changes: 0 additions & 5 deletions osf/models/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from framework.exceptions import PermissionsError
from website import settings
from website.util import api_v2_url
from website.project import signals as project_signals
from website.project.model import get_valid_mentioned_users_guids


Expand Down Expand Up @@ -164,7 +163,6 @@ def create(cls, auth, **kwargs):
comment.save()
new_mentions = get_valid_mentioned_users_guids(comment, comment.node.contributors_and_group_members)
if new_mentions:
project_signals.mention_added.send(comment, new_mentions=new_mentions, auth=auth)
comment.ever_mentioned.add(*comment.node.contributors.filter(guids___id__in=new_mentions))

comment.save()
Expand All @@ -177,8 +175,6 @@ def create(cls, auth, **kwargs):
)

comment.node.save()
project_signals.comment_added.send(comment, auth=auth, new_mentions=new_mentions)

return comment

def edit(self, content, auth, save=False):
Expand All @@ -198,7 +194,6 @@ def edit(self, content, auth, save=False):

if save:
if new_mentions:
project_signals.mention_added.send(self, new_mentions=new_mentions, auth=auth)
self.ever_mentioned.add(*self.node.contributors.filter(guids___id__in=new_mentions))
self.save()
self.node.add_log(
Expand Down
49 changes: 0 additions & 49 deletions osf_tests/test_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from website import settings
from addons.osfstorage import settings as osfstorage_settings
from website.project.views.comment import update_file_guid_referent
from website.project.signals import comment_added, mention_added
from framework.exceptions import PermissionsError
from tests.base import capture_signals
from osf.models import Comment, NodeLog, Guid, BaseFileNode
Expand Down Expand Up @@ -219,36 +218,12 @@ class TestCommentModel:

]
create_cases = [
# Make sure valid mentions send signals
{
'comment_content': comment_mention_valid,
'expected_signals': {comment_added, mention_added},
'expected_error_msg': None,
},
# User mentions a contributor
{
'comment_content': comment_contributor_mentioned,
'expected_signals': {comment_added, mention_added},
'expected_error_msg': None,
},
# Make sure comments aren't NoneType
{
'comment_content': None,
'expected_signals': set(),
'expected_error_msg': "{'content': ['This field cannot be null.']}",
},
# User makes valid comment
{
'comment_content': comment_valid,
'expected_signals': {comment_added},
'expected_error_msg': None,
},
# User mentions themselves
{
'comment_content': comment_self_mentioned,
'expected_signals': {comment_added, mention_added},
'expected_error_msg': None,
},
# Prevent user from entering a comment that's too long with a mention
{
'comment_content': comment_too_long_with_mention,
Expand All @@ -257,41 +232,17 @@ class TestCommentModel:
},
]
edit_cases = [
# Send if mention is valid
{
'comment_content': comment_mention_valid,
'expected_signals': {mention_added},
'expected_error_msg': None,
},
# User mentions a contributor
{
'comment_content': comment_contributor_mentioned,
'expected_signals': {mention_added},
'expected_error_msg': None,
},
# User edits valid comment
{
'comment_content': comment_valid,
'expected_signals': set(),
'expected_error_msg': None,
},
# User mentions themselves
{
'comment_content': comment_self_mentioned,
'expected_signals': {mention_added},
'expected_error_msg': None,
},
# Don't send mention if already mentioned
{
'comment_content': comment_mention_edited_twice,
'expected_signals': set(),
'expected_error_msg': None,
},
# Send mention if already mentioned
{
'comment_content': comment_mention_project_with_contributor,
'expected_signals': {mention_added},
'expected_error_msg': None,
}
]
params = {
Expand Down
12 changes: 0 additions & 12 deletions tests/test_conferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,18 +231,6 @@ def test_upload_no_file_name(self, mock_put, mock_get_url):
cookies={settings.COOKIE_NAME: self.user.get_or_create_cookie().decode()},
)

@mock.patch('website.conferences.utils.upload_attachments')
def test_add_poster_by_email(self, mock_upload_attachments):
conference = ConferenceFactory()

with self.make_context(data={'from': '[email protected]', 'subject': 'It\'s PARTY TIME!'}):
msg = message.ConferenceMessage()
views.add_poster_by_email(conference, msg)

user = OSFUser.objects.get(username='[email protected]')
assert user.email == '[email protected]'
assert user.fullname == user._id # user's shouldn't be able to use email as fullname, so we use the guid.


class TestMessage(ContextTestCase):
PUSH_CONTEXT = False
Expand Down
Loading
Loading