hotspots: Remove intro_reply hotspot.

Zulip shows two guides on How to reply, first one by
the welcome bot and second one is intro_reply hotspot.
To simply and avoid redundancy, intro_reply hotspot is
removed.

Fixes #20482.
This commit is contained in:
Nikhil Maske 2021-12-07 20:13:26 +05:30 committed by Tim Abbott
parent 116a0f6f9d
commit 091772b534
9 changed files with 9 additions and 98 deletions

View File

@ -800,15 +800,6 @@ export function initialize() {
$(`#hotspot_${CSS.escape(hotspot_name)}_icon`).remove();
});
$("body").on("click", ".hotspot-button", (e) => {
e.preventDefault();
e.stopPropagation();
hotspots.post_hotspot_as_read("intro_reply");
hotspots.close_hotspot_icon($("#hotspot_intro_reply_icon"));
$("#hotspot_intro_reply_icon").remove();
});
// stop propagation
$("body").on("click", ".hotspot.overlay .hotspot-popover", (e) => {
e.stopPropagation();

View File

@ -3,7 +3,6 @@ import _ from "lodash";
import render_hotspot_icon from "../templates/hotspot_icon.hbs";
import render_hotspot_overlay from "../templates/hotspot_overlay.hbs";
import render_intro_reply_hotspot from "../templates/intro_reply_hotspot.hbs";
import * as blueslip from "./blueslip";
import * as channel from "./channel";
@ -21,15 +20,6 @@ const VIEWPORT_CENTER = "viewport_center";
// popover orientation can optionally be fixed here (property: popover),
// otherwise popovers.compute_placement is used to compute orientation
const HOTSPOT_LOCATIONS = new Map([
[
"intro_reply",
{
element: ".selected_message .messagebox-content",
offset_x: 0.85,
offset_y: 0.7,
popover: BOTTOM,
},
],
[
"intro_streams",
{
@ -213,11 +203,6 @@ function place_popover(hotspot) {
}
function insert_hotspot_into_DOM(hotspot) {
if (hotspot.name === "intro_reply") {
$("#bottom_whitespace").append(render_intro_reply_hotspot({}));
return;
}
const hotspot_overlay_HTML = render_hotspot_overlay({
name: hotspot.name,
title: hotspot.title,

View File

@ -968,8 +968,7 @@ body.dark-theme {
}
/* Popover: */
.hotspot.overlay .hotspot-popover,
#hotspot_intro_reply_icon {
.hotspot.overlay .hotspot-popover {
border-color: hsla(0, 0%, 0%, 0.2) !important;
/* Based on the `.hotspot-popover` shadow in `hotspots.css`, but with a new
color. */
@ -1038,7 +1037,6 @@ body.dark-theme {
/* Content: */
.hotspot.overlay .hotspot-popover .hotspot-popover-content,
#hotspot_intro_reply_icon,
.hotspot.overlay .hotspot-popover .hotspot-popover-bottom {
background-color: hsl(212, 28%, 18%);
}

View File

@ -243,52 +243,3 @@
#hotspot_intro_gear_icon {
z-index: 103;
}
.hotspot-inline {
width: 350px;
max-width: 95%;
box-shadow: 0 5px 10px hsla(220, 4%, 54%, 0.1);
border-radius: 4px;
background-color: hsl(0, 0%, 98%);
margin: 0 auto;
position: relative;
.hotspot-img {
margin-left: 5px;
}
.hotspot-confirm {
display: block;
}
.hotspot-inline-top .hotspot-title {
background-color: hsl(168, 100%, 35%);
margin: 0;
color: hsl(0, 0%, 100%);
font-weight: 600;
line-height: 24px;
padding: 5px 13px;
font-size: 1.15em;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.hotspot-inline-left {
display: inline-block;
width: 90px;
}
.hotspot-inline-right {
display: inline-block;
width: auto;
margin-left: 10px;
vertical-align: middle;
}
}
#hotspot_intro_reply_icon {
position: relative;
background-color: hsl(0, 0%, 100%);
top: 50%;
transform: perspective(1px) translateY(-75%);
}

View File

@ -1,10 +0,0 @@
<div class="hotspot-inline trailing_bookend bookend hotspot-message" id="hotspot_intro_reply_icon">
<div class="hotspot-inline-top"><h1 class="hotspot-title">Send a reply</h1></div>
<div class="hotspot-inline-left">
<img class="hotspot-img" alt="" src="/static/images/hotspots/whale.svg" />
</div>
<div class="hotspot-inline-right">
<p>{{t 'Click anywhere on a message to reply.' }}</p>
<button class="hotspot-button hotspot-confirm" type="button">{{t 'Got it!' }}</button>
</div>
</div>

View File

@ -9,10 +9,6 @@ from django.utils.translation import gettext_lazy
from zerver.models import UserHotspot, UserProfile
INTRO_HOTSPOTS: Dict[str, Dict[str, Promise]] = {
"intro_reply": {
"title": gettext_lazy("Reply to a message"),
"description": gettext_lazy("Click anywhere on a message to reply."),
},
"intro_streams": {
"title": gettext_lazy("Catch up on a stream"),
"description": gettext_lazy(

View File

@ -1806,7 +1806,7 @@ class NormalActionsTest(BaseAction):
self.user_profile.save(update_fields=["tutorial_status"])
events = self.verify_action(
lambda: do_mark_hotspot_as_read(self.user_profile, "intro_reply")
lambda: do_mark_hotspot_as_read(self.user_profile, "intro_streams")
)
check_hotspots("events[0]", events[0])

View File

@ -16,14 +16,14 @@ class TestGetNextHotspots(ZulipTestCase):
def test_first_hotspot(self) -> None:
hotspots = get_next_hotspots(self.user)
self.assert_length(hotspots, 1)
self.assertEqual(hotspots[0]["name"], "intro_reply")
self.assertEqual(hotspots[0]["name"], "intro_streams")
def test_some_done_some_not(self) -> None:
do_mark_hotspot_as_read(self.user, "intro_reply")
do_mark_hotspot_as_read(self.user, "intro_streams")
do_mark_hotspot_as_read(self.user, "intro_compose")
hotspots = get_next_hotspots(self.user)
self.assert_length(hotspots, 1)
self.assertEqual(hotspots[0]["name"], "intro_streams")
self.assertEqual(hotspots[0]["name"], "intro_topics")
def test_all_intro_hotspots_done(self) -> None:
with self.settings(TUTORIAL_ENABLED=True):
@ -54,16 +54,16 @@ class TestHotspots(ZulipTestCase):
def test_hotspots_url_endpoint(self) -> None:
user = self.example_user("hamlet")
self.login_user(user)
result = self.client_post("/json/users/me/hotspots", {"hotspot": "intro_reply"})
result = self.client_post("/json/users/me/hotspots", {"hotspot": "intro_streams"})
self.assert_json_success(result)
self.assertEqual(
list(UserHotspot.objects.filter(user=user).values_list("hotspot", flat=True)),
["intro_reply"],
["intro_streams"],
)
result = self.client_post("/json/users/me/hotspots", {"hotspot": "invalid"})
self.assert_json_error(result, "Unknown hotspot: invalid")
self.assertEqual(
list(UserHotspot.objects.filter(user=user).values_list("hotspot", flat=True)),
["intro_reply"],
["intro_streams"],
)

View File

@ -1178,7 +1178,7 @@ class UserProfileTest(ZulipTestCase):
UserHotspot.objects.filter(user=cordelia).delete()
UserHotspot.objects.filter(user=iago).delete()
hotspots_completed = {"intro_reply", "intro_streams", "intro_topics"}
hotspots_completed = {"intro_streams", "intro_topics"}
for hotspot in hotspots_completed:
UserHotspot.objects.create(user=cordelia, hotspot=hotspot)