Skip to content

Commit

Permalink
Merge branch 'show-user-data' into mampf-next
Browse files Browse the repository at this point in the history
  • Loading branch information
zebleck committed Jan 18, 2023
2 parents 4fa9e8d + 00d06ce commit 55b5add
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/abilities/profile_ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ def initialize(user)

can [:edit, :update, :check_for_consent, :add_consent,
:toggle_thread_subscription, :subscribe_lecture, :unsubscribe_lecture,
:star_lecture, :unstar_lecture, :show_accordion], :profile
:star_lecture, :unstar_lecture, :show_accordion, :request_data], :profile
end
end
5 changes: 5 additions & 0 deletions app/controllers/profile_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ def show_accordion
@link = @collapse_id.remove('collapse').camelize(:lower) + 'Link'
end

def request_data
MathiMailer.data_request_email(current_user).deliver_later
redirect_to edit_profile_path, notice: t('profile.data_request_sent')
end

private

def set_user
Expand Down
6 changes: 6 additions & 0 deletions app/mailers/mathi_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ def ghost_email(user)
@hash = user.ghost_hash
mail(to: user.email, subject: t('mailer.hash_mail_subject'))
end

def data_request_email(user)
@mail = user.email
@id = user.id
mail(to: DefaultSetting::PROJECT_EMAIL, subject: 'Data request')
end
end
1 change: 1 addition & 0 deletions app/views/mathi_mailer/data_request_email.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= t('mailer.data_request_mail_body', mail: @mail, id: @id) %>
8 changes: 8 additions & 0 deletions app/views/profile/_data.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="col-12 mb-3">
<%= t('profile.data_explanation') %>
</div>
<div class="col-12 text-center">
<%= link_to t('profile.data_request'),
request_data_path,
class: 'btn btn-sm btn-primary' %>
</div>
18 changes: 18 additions & 0 deletions app/views/profile/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,24 @@
</div>
</div>
<% end %>
<div class="row mb-3">
<div class="col-12">
<div class="card bg-light">
<div class="card-header">
<div class="row">
<div class="col-12">
<h5>
<%= t('profile.my_data') %>
</h5>
</div>
</div>
</div>
<div class="card-body">
<%= render partial: 'profile/data' %>
</div>
</div>
</div>
</div>
<%= render partial: 'shared/generic_modal',
locals: { sort: 'deleteAccount',
title: t('profile.delete_account') } %>
13 changes: 13 additions & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2041,6 +2041,17 @@ de:
unstar_lecture: Veranstaltung aus dem Schnellzugriff entfernen
my_talks: Meine Vorträge
media_search: Mediensuche
my_data: Welchen Daten werden über mich gespeichert?
data_explanation: >
Im Rahmen des Services, die Mampf anbietet, werden einige Daten über Nutzer
gespeichert. Neben den oben aufgeführten Daten werden essentielle Informationen
wie deine abonnierten Vorlesungen oder eingereichten Abgaben gespeichert. Mit dem
folgenden Knopf kannst du alle Daten, die wir über dich speichern, anfordern. Wir
werden sie an deine bei MaMpf hinterlegte E-Mail schicken.
data_request: >
Daten anfordern
data_request_sent: >
Wir haben deine Anfrage erhalten und werden dir deine Daten zeitnah schicken.
mampf_news:
title: 'MaMpf-News'
check_notifications: 'Alle erledigen'
Expand Down Expand Up @@ -3031,6 +3042,8 @@ de:
Mit dieser Email wird überprüft, ob Dein Emailkonto noch existiert. Da dies der Fall ist,
werden keine Änderungen an Deinem Account vorgenommen. Du kannst diese Email daher ignorieren.
Hash:%{hash}
data_request_mail_body: >
%{mail} mit User-Id: %{id} hat ihre Daten angefordert.
statistics:
video_thyme: 'THymE-Aufrufe'
video_downloads: 'Downloads'
Expand Down
10 changes: 10 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1918,6 +1918,14 @@ en:
unstar_lecture: Remove Lecture from Fast Access
my_talks: My talks
media_search: Search media
my_data: What data is saved about me?
data_explanation: >
Within the framework of the services offered by Mampf, some data about users will be
stored. All of your data that is not listed above are listed here.
data_request: >
Request data
data_request_sent: >
We have received your request and will send you your data as soon as possible.
mampf_news:
title: 'MaMpf News'
check_notifications: 'Clear all'
Expand Down Expand Up @@ -2857,6 +2865,8 @@ en:
This email is to check if your email account still exists. Since this is the case, no changes
will be made to your account. You can therefore ignore this email.
Hash:%{hash}
data_request_mail_body: >
%{mail} with user-id: %{id} has requested his data.
statistics:
video_thyme: 'Accessed by THymE'
video_downloads: 'Downloads'
Expand Down
3 changes: 3 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,9 @@
patch 'profile/unstar_lecture',
as: 'unstar_lecture'

get 'profile/request_data',
as: 'request_data'

# programs routes

resources :programs, except: [:show]
Expand Down

0 comments on commit 55b5add

Please sign in to comment.