summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/admin/users/components/user_avatar.vue15
-rw-r--r--app/assets/javascripts/admin/users/constants.js2
-rw-r--r--app/assets/javascripts/jobs/store/getters.js10
-rw-r--r--app/controllers/registrations/experience_levels_controller.rb2
-rw-r--r--app/finders/user_recent_events_finder.rb23
-rw-r--r--app/models/user_callout.rb21
-rw-r--r--app/serializers/admin/user_entity.rb1
-rw-r--r--app/serializers/admin/user_serializer.rb2
8 files changed, 35 insertions, 41 deletions
diff --git a/app/assets/javascripts/admin/users/components/user_avatar.vue b/app/assets/javascripts/admin/users/components/user_avatar.vue
index 4f79c4fd451..ff0e91fcb8f 100644
--- a/app/assets/javascripts/admin/users/components/user_avatar.vue
+++ b/app/assets/javascripts/admin/users/components/user_avatar.vue
@@ -1,12 +1,17 @@
<script>
-import { GlAvatarLink, GlAvatarLabeled, GlBadge } from '@gitlab/ui';
-import { USER_AVATAR_SIZE } from '../constants';
+import { GlAvatarLink, GlAvatarLabeled, GlBadge, GlIcon, GlTooltipDirective } from '@gitlab/ui';
+import { truncate } from '~/lib/utils/text_utility';
+import { USER_AVATAR_SIZE, LENGTH_OF_USER_NOTE_TOOLTIP } from '../constants';
export default {
+ directives: {
+ GlTooltip: GlTooltipDirective,
+ },
components: {
GlAvatarLink,
GlAvatarLabeled,
GlBadge,
+ GlIcon,
},
props: {
user: {
@@ -22,6 +27,9 @@ export default {
adminUserHref() {
return this.adminUserPath.replace('id', this.user.username);
},
+ userNoteShort() {
+ return truncate(this.user.note, LENGTH_OF_USER_NOTE_TOOLTIP);
+ },
},
USER_AVATAR_SIZE,
};
@@ -42,6 +50,9 @@ export default {
:sub-label="user.email"
>
<template #meta>
+ <div v-if="user.note" class="gl-text-gray-500 gl-p-1">
+ <gl-icon v-gl-tooltip="userNoteShort" name="document" />
+ </div>
<div v-for="(badge, idx) in user.badges" :key="idx" class="gl-p-1">
<gl-badge class="gl-display-flex!" size="sm" :variant="badge.variant">{{
badge.text
diff --git a/app/assets/javascripts/admin/users/constants.js b/app/assets/javascripts/admin/users/constants.js
index 956c7a15738..e26643cad60 100644
--- a/app/assets/javascripts/admin/users/constants.js
+++ b/app/assets/javascripts/admin/users/constants.js
@@ -1,3 +1,5 @@
export const USER_AVATAR_SIZE = 32;
export const SHORT_DATE_FORMAT = 'd mmm, yyyy';
+
+export const LENGTH_OF_USER_NOTE_TOOLTIP = 100;
diff --git a/app/assets/javascripts/jobs/store/getters.js b/app/assets/javascripts/jobs/store/getters.js
index 30a4a247dc4..930a225857d 100644
--- a/app/assets/javascripts/jobs/store/getters.js
+++ b/app/assets/javascripts/jobs/store/getters.js
@@ -1,7 +1,7 @@
import { isEmpty, isString } from 'lodash';
import { isScrolledToBottom } from '~/lib/utils/scroll_utils';
-export const headerTime = (state) => (state.job.started ? state.job.started : state.job.created_at);
+export const headerTime = (state) => state.job.started ?? state.job.created_at;
export const hasForwardDeploymentFailure = (state) =>
state?.job?.failure_reason === 'forward_deployment_failure';
@@ -28,11 +28,9 @@ export const hasEnvironment = (state) => !isEmpty(state.job.deployment_status);
export const hasTrace = (state) =>
state.job.has_trace || (!isEmpty(state.job.status) && state.job.status.group === 'running');
-export const emptyStateIllustration = (state) =>
- (state.job && state.job.status && state.job.status.illustration) || {};
+export const emptyStateIllustration = (state) => state?.job?.status?.illustration || {};
-export const emptyStateAction = (state) =>
- (state.job && state.job.status && state.job.status.action) || null;
+export const emptyStateAction = (state) => state?.job?.status?.action || null;
/**
* Shared runners limit is only rendered when
@@ -48,4 +46,4 @@ export const shouldRenderSharedRunnerLimitWarning = (state) =>
export const isScrollingDown = (state) => isScrolledToBottom() && !state.isTraceComplete;
export const hasRunnersForProject = (state) =>
- state.job.runners.available && !state.job.runners.online;
+ state?.job?.runners?.available && !state?.job?.runners?.online;
diff --git a/app/controllers/registrations/experience_levels_controller.rb b/app/controllers/registrations/experience_levels_controller.rb
index 5c78f7a9bbb..ddc5d128766 100644
--- a/app/controllers/registrations/experience_levels_controller.rb
+++ b/app/controllers/registrations/experience_levels_controller.rb
@@ -15,7 +15,7 @@ module Registrations
if current_user.save
hide_advanced_issues
- if experiment_enabled?(:default_to_issues_board) && learn_gitlab.available?
+ if learn_gitlab.available?
redirect_to namespace_project_board_path(params[:namespace_path], learn_gitlab.project, learn_gitlab.board)
else
redirect_to group_path(params[:namespace_path])
diff --git a/app/finders/user_recent_events_finder.rb b/app/finders/user_recent_events_finder.rb
index f376b26ab9c..c9a1c918365 100644
--- a/app/finders/user_recent_events_finder.rb
+++ b/app/finders/user_recent_events_finder.rb
@@ -26,42 +26,23 @@ class UserRecentEventsFinder
@params = params
end
- # rubocop: disable CodeReuse/ActiveRecord
def execute
return Event.none unless can?(current_user, :read_user_profile, target_user)
- recent_events(params[:offset] || 0)
- .joins(:project)
+ target_events
.with_associations
.limit_recent(limit, params[:offset])
+ .order_created_desc
end
- # rubocop: enable CodeReuse/ActiveRecord
private
# rubocop: disable CodeReuse/ActiveRecord
- def recent_events(offset)
- sql = <<~SQL
- (#{projects}) AS projects_for_join
- JOIN (#{target_events.to_sql}) AS #{Event.table_name}
- ON #{Event.table_name}.project_id = projects_for_join.id
- SQL
-
- # Workaround for https://github.com/rails/rails/issues/24193
- Event.from([Arel.sql(sql)])
- end
- # rubocop: enable CodeReuse/ActiveRecord
-
- # rubocop: disable CodeReuse/ActiveRecord
def target_events
Event.where(author: target_user)
end
# rubocop: enable CodeReuse/ActiveRecord
- def projects
- target_user.project_interactions.to_sql
- end
-
def limit
return DEFAULT_LIMIT unless params[:limit].present?
diff --git a/app/models/user_callout.rb b/app/models/user_callout.rb
index 6e57673bafc..d93fe611538 100644
--- a/app/models/user_callout.rb
+++ b/app/models/user_callout.rb
@@ -7,19 +7,19 @@ class UserCallout < ApplicationRecord
gke_cluster_integration: 1,
gcp_signup_offer: 2,
cluster_security_warning: 3,
- gold_trial: 4, # EE-only
- geo_enable_hashed_storage: 5, # EE-only
- geo_migrate_hashed_storage: 6, # EE-only
- canary_deployment: 7, # EE-only
- gold_trial_billings: 8, # EE-only
+ gold_trial: 4, # EE-only
+ geo_enable_hashed_storage: 5, # EE-only
+ geo_migrate_hashed_storage: 6, # EE-only
+ canary_deployment: 7, # EE-only
+ gold_trial_billings: 8, # EE-only
suggest_popover_dismissed: 9,
tabs_position_highlight: 10,
- threat_monitoring_info: 11, # EE-only
- account_recovery_regular_check: 12, # EE-only
+ threat_monitoring_info: 11, # EE-only
+ account_recovery_regular_check: 12, # EE-only
webhooks_moved: 13,
service_templates_deprecated: 14,
admin_integrations_moved: 15,
- web_ide_alert_dismissed: 16, # no longer in use
+ web_ide_alert_dismissed: 16, # no longer in use
active_user_count_threshold: 18, # EE-only
buy_pipeline_minutes_notification_dot: 19, # EE-only
personal_access_token_expiry: 21, # EE-only
@@ -27,8 +27,9 @@ class UserCallout < ApplicationRecord
customize_homepage: 23,
feature_flags_new_version: 24,
registration_enabled_callout: 25,
- new_user_signups_cap_reached: 26, # EE-only
- unfinished_tag_cleanup_callout: 27
+ new_user_signups_cap_reached: 26, # EE-only
+ unfinished_tag_cleanup_callout: 27,
+ eoa_bronze_plan_banner: 28 # EE-only
}
validates :user, presence: true
diff --git a/app/serializers/admin/user_entity.rb b/app/serializers/admin/user_entity.rb
index ad96c101822..8908d610046 100644
--- a/app/serializers/admin/user_entity.rb
+++ b/app/serializers/admin/user_entity.rb
@@ -10,6 +10,7 @@ module Admin
expose :email
expose :last_activity_on
expose :avatar_url
+ expose :note
expose :badges do |user|
user_badges_in_admin_section(user)
end
diff --git a/app/serializers/admin/user_serializer.rb b/app/serializers/admin/user_serializer.rb
index 09036428bab..edd28e88553 100644
--- a/app/serializers/admin/user_serializer.rb
+++ b/app/serializers/admin/user_serializer.rb
@@ -2,6 +2,6 @@
module Admin
class UserSerializer < BaseSerializer
- entity UserEntity
+ entity Admin::UserEntity
end
end