Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2010)

Unified Diff: appengine/monorail/features/cues.py

Issue 1868553004: Open Source Monorail (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/monorail/features/commitlogcommands.py ('k') | appengine/monorail/features/filterrules.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/monorail/features/cues.py
diff --git a/appengine/monorail/features/cues.py b/appengine/monorail/features/cues.py
new file mode 100644
index 0000000000000000000000000000000000000000..f56821dd7bcf583764d5009f53216134d6a53c18
--- /dev/null
+++ b/appengine/monorail/features/cues.py
@@ -0,0 +1,50 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is govered by a BSD-style
+# license that can be found in the LICENSE file or at
+# https://developers.google.com/open-source/licenses/bsd
+
+"""Simple servlet to store the fact that a user has dismissed a cue card.
+
+Cue cards are small on-page help items that appear when the user has
+done a certain action or is viewing a project that is in a certain
+state. The cue card give the user a suggestion of what he/she should
+do next. Cue cards can be dismissed to reduce visual clutter on the
+page once the user has learned the content of the suggestion. That
+preference is recorded in the User PB, and the same cue card will not
+be presented again to the same user.
+
+Exmple: The logged in user has dismissed the cue card that tells him/her how
+to search for numbers in the issue tracker:
+
+ POST /hosting/cues.do
+ cue_id=search_for_numbers&token=12344354534
+"""
+
+
+import logging
+
+from framework import jsonfeed
+from framework import monorailrequest
+
+
+class SetCuesFeed(jsonfeed.JsonFeed):
+ """A class to process an AJAX request to dismiss a cue card."""
+
+ def HandleRequest(self, mr):
+ """Processes a user's POST request to dismiss a cue card.
+
+ Args:
+ mr: commonly used info parsed from the request.
+ """
+
+ cue_id = mr.GetParam('cue_id')
+ if not cue_id:
+ raise monorailrequest.InputException('no cue_id specified')
+
+ logging.info('Handling user set cue request: %r', cue_id)
+ new_dismissed_cues = mr.auth.user_pb.dismissed_cues
+ new_dismissed_cues.append(cue_id)
+ self.services.user.UpdateUserSettings(
+ mr.cnxn, mr.auth.user_id, mr.auth.user_pb,
+ dismissed_cues=new_dismissed_cues)
+
« no previous file with comments | « appengine/monorail/features/commitlogcommands.py ('k') | appengine/monorail/features/filterrules.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698