Skip to content

Commit 2d3d1c0

Browse files
authored
Merge pull request #11133 from Ostap-Zherebetskyi/feature/ENG-7908-remove-meetings-comments-and-osf-groups-notifications
[ENG-7908] Remove Meetings, Comments and OSF Groups Notifications
2 parents 878d2c7 + d9004bc commit 2d3d1c0

28 files changed

+16
-1361
lines changed

admin/templates/base.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,6 @@
288288
</div>
289289
{% endif %}
290290
{% endif %}
291-
{% if perms.osf.view_conference %}
292-
<li><a href="{% url 'meetings:list' %}"><i class='fa fa-link'></i> <span>Meetings</span></a></li>
293-
{% endif %}
294291
{% if perms.osf.view_metrics %}
295292
<li><a href="{% url 'metrics:metrics' %}"><i class='fa fa-link'></i> <span>Metrics</span></a></li>
296293
{% endif %}

api_tests/subscriptions/views/test_subscriptions_list.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@ def url(self, user, node):
3434
def test_list_complete(self, app, user, provider, node, global_user_notification, url):
3535
res = app.get(url, auth=user.auth)
3636
notification_ids = [item['id'] for item in res.json['data']]
37-
# There should only be 4 notifications: users' global, node's comments, node's file updates and provider's preprint added.
38-
assert len(notification_ids) == 4
37+
# There should only be 3 notifications: users' global, node's file updates and provider's preprint added.
38+
assert len(notification_ids) == 3
3939
assert f'{user._id}_global' in notification_ids
4040
assert f'{provider._id}_new_pending_submissions' in notification_ids
41-
assert f'{node._id}_comments' in notification_ids
4241
assert f'{node._id}_file_updated' in notification_ids
4342

4443
def test_unauthenticated(self, app, url):

osf/management/commands/transfer_quickfiles_to_projects.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@
1616
)
1717
from osf.models.base import generate_guid
1818
from osf.models.quickfiles import get_quickfiles_project_title
19-
from osf.models.queued_mail import QueuedMail
2019
from osf.utils.datetime_aware_jsonfield import DateTimeAwareJSONField
2120

2221
from addons.osfstorage.models import OsfStorageFile
23-
from website import mails, settings
2422
from django.contrib.contenttypes.models import ContentType
2523

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

6765
node_logs = []
68-
queued_mail = []
6966
pbar = tqdm(total=target_count)
7067
for node in quick_files_nodes:
7168
node_logs.append(NodeLog(
@@ -75,17 +72,6 @@ def remove_quickfiles():
7572
params={'node': node._id},
7673
action=NodeLog.MIGRATED_QUICK_FILES
7774
))
78-
queued_mail.append(QueuedMail(
79-
user=node.creator,
80-
to_addr=node.creator.email,
81-
send_at=QUICKFILES_DATE,
82-
email_type=mails.QUICKFILES_MIGRATED.tpl_prefix,
83-
data=dict(
84-
osf_support_email=settings.OSF_SUPPORT_EMAIL,
85-
can_change_preferences=False,
86-
quickfiles_link=node.absolute_url
87-
)
88-
))
8975
node.logs.update(
9076
params=Func(
9177
F('params'),
@@ -100,8 +86,6 @@ def remove_quickfiles():
10086
logger.info('Updated logs')
10187
NodeLog.objects.bulk_create(node_logs)
10288
logger.info(f'Created {len(node_logs)} logs')
103-
QueuedMail.objects.bulk_create(queued_mail)
104-
logger.info(f'Created {len(queued_mail)} mails')
10589

10690
quick_files_nodes.update(description=QUICKFILES_DESC, type='osf.node')
10791
logger.info(f'Projectified {target_count} QuickFilesNodes')

osf/models/comment.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from framework.exceptions import PermissionsError
1414
from website import settings
1515
from website.util import api_v2_url
16-
from website.project import signals as project_signals
1716
from website.project.model import get_valid_mentioned_users_guids
1817

1918

@@ -164,7 +163,6 @@ def create(cls, auth, **kwargs):
164163
comment.save()
165164
new_mentions = get_valid_mentioned_users_guids(comment, comment.node.contributors_and_group_members)
166165
if new_mentions:
167-
project_signals.mention_added.send(comment, new_mentions=new_mentions, auth=auth)
168166
comment.ever_mentioned.add(*comment.node.contributors.filter(guids___id__in=new_mentions))
169167

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

179177
comment.node.save()
180-
project_signals.comment_added.send(comment, auth=auth, new_mentions=new_mentions)
181-
182178
return comment
183179

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

199195
if save:
200196
if new_mentions:
201-
project_signals.mention_added.send(self, new_mentions=new_mentions, auth=auth)
202197
self.ever_mentioned.add(*self.node.contributors.filter(guids___id__in=new_mentions))
203198
self.save()
204199
self.node.add_log(

osf_tests/test_comment.py

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from website import settings
1515
from addons.osfstorage import settings as osfstorage_settings
1616
from website.project.views.comment import update_file_guid_referent
17-
from website.project.signals import comment_added, mention_added
1817
from framework.exceptions import PermissionsError
1918
from tests.base import capture_signals
2019
from osf.models import Comment, NodeLog, Guid, BaseFileNode
@@ -219,36 +218,12 @@ class TestCommentModel:
219218

220219
]
221220
create_cases = [
222-
# Make sure valid mentions send signals
223-
{
224-
'comment_content': comment_mention_valid,
225-
'expected_signals': {comment_added, mention_added},
226-
'expected_error_msg': None,
227-
},
228-
# User mentions a contributor
229-
{
230-
'comment_content': comment_contributor_mentioned,
231-
'expected_signals': {comment_added, mention_added},
232-
'expected_error_msg': None,
233-
},
234221
# Make sure comments aren't NoneType
235222
{
236223
'comment_content': None,
237224
'expected_signals': set(),
238225
'expected_error_msg': "{'content': ['This field cannot be null.']}",
239226
},
240-
# User makes valid comment
241-
{
242-
'comment_content': comment_valid,
243-
'expected_signals': {comment_added},
244-
'expected_error_msg': None,
245-
},
246-
# User mentions themselves
247-
{
248-
'comment_content': comment_self_mentioned,
249-
'expected_signals': {comment_added, mention_added},
250-
'expected_error_msg': None,
251-
},
252227
# Prevent user from entering a comment that's too long with a mention
253228
{
254229
'comment_content': comment_too_long_with_mention,
@@ -257,41 +232,17 @@ class TestCommentModel:
257232
},
258233
]
259234
edit_cases = [
260-
# Send if mention is valid
261-
{
262-
'comment_content': comment_mention_valid,
263-
'expected_signals': {mention_added},
264-
'expected_error_msg': None,
265-
},
266-
# User mentions a contributor
267-
{
268-
'comment_content': comment_contributor_mentioned,
269-
'expected_signals': {mention_added},
270-
'expected_error_msg': None,
271-
},
272235
# User edits valid comment
273236
{
274237
'comment_content': comment_valid,
275238
'expected_signals': set(),
276239
'expected_error_msg': None,
277240
},
278-
# User mentions themselves
279-
{
280-
'comment_content': comment_self_mentioned,
281-
'expected_signals': {mention_added},
282-
'expected_error_msg': None,
283-
},
284241
# Don't send mention if already mentioned
285242
{
286243
'comment_content': comment_mention_edited_twice,
287244
'expected_signals': set(),
288245
'expected_error_msg': None,
289-
},
290-
# Send mention if already mentioned
291-
{
292-
'comment_content': comment_mention_project_with_contributor,
293-
'expected_signals': {mention_added},
294-
'expected_error_msg': None,
295246
}
296247
]
297248
params = {

tests/test_conferences.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -231,18 +231,6 @@ def test_upload_no_file_name(self, mock_put, mock_get_url):
231231
cookies={settings.COOKIE_NAME: self.user.get_or_create_cookie().decode()},
232232
)
233233

234-
@mock.patch('website.conferences.utils.upload_attachments')
235-
def test_add_poster_by_email(self, mock_upload_attachments):
236-
conference = ConferenceFactory()
237-
238-
with self.make_context(data={'from': '[email protected]', 'subject': 'It\'s PARTY TIME!'}):
239-
msg = message.ConferenceMessage()
240-
views.add_poster_by_email(conference, msg)
241-
242-
user = OSFUser.objects.get(username='[email protected]')
243-
assert user.email == '[email protected]'
244-
assert user.fullname == user._id # user's shouldn't be able to use email as fullname, so we use the guid.
245-
246234

247235
class TestMessage(ContextTestCase):
248236
PUSH_CONTEXT = False

0 commit comments

Comments
 (0)