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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is govered by a BSD-style
3 # license that can be found in the LICENSE file or at
4 # https://developers.google.com/open-source/licenses/bsd
5
6 """Simple servlet to store the fact that a user has dismissed a cue card.
7
8 Cue cards are small on-page help items that appear when the user has
9 done a certain action or is viewing a project that is in a certain
10 state. The cue card give the user a suggestion of what he/she should
11 do next. Cue cards can be dismissed to reduce visual clutter on the
12 page once the user has learned the content of the suggestion. That
13 preference is recorded in the User PB, and the same cue card will not
14 be presented again to the same user.
15
16 Exmple: The logged in user has dismissed the cue card that tells him/her how
17 to search for numbers in the issue tracker:
18
19 POST /hosting/cues.do
20 cue_id=search_for_numbers&token=12344354534
21 """
22
23
24 import logging
25
26 from framework import jsonfeed
27 from framework import monorailrequest
28
29
30 class SetCuesFeed(jsonfeed.JsonFeed):
31 """A class to process an AJAX request to dismiss a cue card."""
32
33 def HandleRequest(self, mr):
34 """Processes a user's POST request to dismiss a cue card.
35
36 Args:
37 mr: commonly used info parsed from the request.
38 """
39
40 cue_id = mr.GetParam('cue_id')
41 if not cue_id:
42 raise monorailrequest.InputException('no cue_id specified')
43
44 logging.info('Handling user set cue request: %r', cue_id)
45 new_dismissed_cues = mr.auth.user_pb.dismissed_cues
46 new_dismissed_cues.append(cue_id)
47 self.services.user.UpdateUserSettings(
48 mr.cnxn, mr.auth.user_id, mr.auth.user_pb,
49 dismissed_cues=new_dismissed_cues)
50
OLDNEW
« 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