Skip to content

Commit

Permalink
remove "Invite to share screen" feature (#4516)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vipul authored Sep 28, 2020
1 parent 30cb647 commit 771844b
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 106 deletions.
29 changes: 0 additions & 29 deletions kitsune/questions/jinja2/questions/message/screen_share.ltxt

This file was deleted.

8 changes: 0 additions & 8 deletions kitsune/questions/jinja2/questions/question_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -364,14 +364,6 @@ <h3 class="sumo-card-heading">{{ _('Post a Reply') }}</h3>
<li class="rss">
<a href="{{ url('questions.answers.feed', question.id) }}">{{ _("Subscribe to feed") }}</a>
</li>
{% if user.has_perm('users.screen_share') %}
<li>
<form class="screen-share-form cf" method="post" action="{{ url('questions.screen_share', question.id) }}">
{% csrf_token %}
<a href="#" class="btn btn-submit" data-type="submit">{{ _('Invite to share screen') }}</a>
</form>
</li>
{% endif %}

{% if user.has_perm('flagit.can_moderate') %}
<li>
Expand Down
27 changes: 0 additions & 27 deletions kitsune/questions/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from kitsune.sumo.templatetags.jinja_helpers import urlparams
from kitsune.sumo.tests import LocalizingClient, eq_msg, get, template_used
from kitsune.sumo.urlresolvers import reverse
from kitsune.users.models import Profile
from kitsune.users.tests import UserFactory, add_permission
from kitsune.wiki.tests import DocumentFactory, RevisionFactory

Expand Down Expand Up @@ -693,32 +692,6 @@ def test_answers_limit(self):
eq_(4, Answer.objects.count())


class TestScreenShare(TestCaseBase):
def setUp(self):
self.user = UserFactory()
add_permission(self.user, Profile, "screen_share")
self.question = QuestionFactory()

def test_screen_share_answer(self):
"""Test that the answer gets created when the screen sharing invite is sent."""
eq_(self.question.answers.count(), 0)
self.client.login(username=self.user.username, password="testpass")
url = reverse("questions.screen_share", args=[self.question.id])
res = self.client.post(url, follow=True)
eq_(res.status_code, 200)
eq_(self.question.answers.count(), 1)

def test_screen_share_metadata(self):
"""Test that the screen sharing meta data is added to the question."""
eq_(self.question.metadata.get("screen_sharing"), None)
self.client.login(username=self.user.username, password="testpass")
url = reverse("questions.screen_share", args=[self.question.id])
res = self.client.post(url, follow=True)
eq_(res.status_code, 200)
q = Question.objects.get(pk=self.question.pk)
eq_(q.metadata.get("screen_sharing"), "true")


class TestStats(ElasticTestCase):
client_class = LocalizingClient

Expand Down
3 changes: 0 additions & 3 deletions kitsune/questions/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@
views.remove_tag_async,
name="questions.remove_tag_async",
),
url(
r"^/(?P<question_id>\d+)/screen-share/$", views.screen_share, name="questions.screen_share"
),
# Feeds
# Note: this needs to be above questions.list because "feed"
# matches the product slug regex.
Expand Down
38 changes: 0 additions & 38 deletions kitsune/questions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
from kitsune.upload.models import ImageAttachment
from kitsune.upload.views import upload_imageattachment
from kitsune.users.models import Setting
from kitsune.users.templatetags.jinja_helpers import display_name
from kitsune.wiki.facets import topics_for
from kitsune.wiki.utils import get_featured_articles

Expand Down Expand Up @@ -1417,43 +1416,6 @@ def metrics(request, locale_code=None):
return render(request, template, data)


@require_POST
@permission_required("users.screen_share")
def screen_share(request, question_id):
question = get_object_or_404(Question, pk=question_id, is_spam=False)

if not question.allows_new_answer(request.user):
raise PermissionDenied

content = _(
"I invited {user} to a screen sharing session, "
"and I'll give an update here once we are done."
)
answer = Answer(
question=question,
creator=request.user,
content=content.format(user=display_name(question.creator)),
)
answer.save()

question.add_metadata(screen_sharing="true")

if Setting.get_for_user(request.user, "questions_watch_after_reply"):
QuestionReplyEvent.notify(request.user, question)

message = render_to_string(
"questions/message/screen_share.ltxt",
{
"asker": display_name(question.creator),
"contributor": display_name(request.user),
},
)

return HttpResponseRedirect(
"%s?to=%s&message=%s" % (reverse("messages.new"), question.creator.username, message)
)


def _answers_data(request, question_id, form=None, watch_form=None, answer_preview=None):
"""Return a map of the minimal info necessary to draw an answers page."""
question = get_object_or_404(Question, pk=question_id)
Expand Down
17 changes: 17 additions & 0 deletions kitsune/users/migrations/0025_auto_20200926_0638.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 2.2.14 on 2020-09-26 06:38

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('users', '0024_auto_20200914_0433'),
]

operations = [
migrations.AlterModelOptions(
name='profile',
options={'permissions': (('view_karma_points', 'Can view karma points'), ('deactivate_users', 'Can deactivate users'))},
),
]
1 change: 0 additions & 1 deletion kitsune/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ class Meta(object):
permissions = (
("view_karma_points", "Can view karma points"),
("deactivate_users", "Can deactivate users"),
("screen_share", "Can screen share"),
)

def __str__(self):
Expand Down

0 comments on commit 771844b

Please sign in to comment.