-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding links pointing to the new user profile page #1704
Conversation
972885c
to
13f0eb7
Compare
if not user: | ||
return '' | ||
url = '/superset/profile/{}/'.format(user.username) | ||
return '<a href="{}">{}</a>'.format(url, escape(user) or '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we return html here? looks like we should just be returning the url.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's for the list_columns
view of the CRUD generated "Dashboards" and "Slices" page. We're tricking the list view into displaying links.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gotcha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in flask we can put links instead of the text, DatasourceAccessRequest
is implemented in similar fashion.
@mistercrunch :
s/escape(user)/escape(user.username)
lgtm |
@@ -1767,7 +1767,7 @@ def recent_activity(self, user_id): | |||
) | |||
.filter( | |||
sqla.and_( | |||
M.Log.action != 'queries', | |||
~M.Log.action.in_(('queries', 'shortner', 'sql_json')), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is ~ a type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oddly overloaded operator for NOT
} | ||
if o.Dashboard.created_by: | ||
user = o.Dashboard.created_by | ||
d['creator'] = str(user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/ str(user)/'{}'.format(user.username) to be consistent and a bit more implicit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the repr
of the object is good here, in some organization the username may not always be very explicit and can't be changed. For example early employees of companies get to pick their usernames/handles. We had a fair amount of those at FB.
} | ||
if o.Slice.created_by: | ||
user = o.Slice.created_by | ||
d['creator'] = str(user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
LGTM once comments are resolved |
Gonna let that one slip in as is. We can always alter it later. |
No description provided.