Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cleaning-portalmec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Richard Fernando Heise Ferreira
cleaning-portalmec
Commits
d8de3373
Commit
d8de3373
authored
7 years ago
by
Israel Barreto Sant'Anna
Browse files
Options
Downloads
Patches
Plain Diff
Created mailer to notify admins about dspace info
parent
1c66ffd4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/mailers/dspace_mailer.rb
+27
-0
27 additions, 0 deletions
app/mailers/dspace_mailer.rb
app/models/user.rb
+8
-1
8 additions, 1 deletion
app/models/user.rb
app/views/dspace_mailer/new_dspace_info.erb
+14
-0
14 additions, 0 deletions
app/views/dspace_mailer/new_dspace_info.erb
with
49 additions
and
1 deletion
app/mailers/dspace_mailer.rb
0 → 100644
+
27
−
0
View file @
d8de3373
# Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana
#
# This file is part of portalmec.
#
# portalmec is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# portalmec is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with portalmec. If not, see <http://www.gnu.org/licenses/>.
class
DSpaceMailer
<
ApplicationMailer
default
to:
'portalmec@inf.ufpr.br'
def
dspace_info_updated
(
partner
)
@partner
=
partner
mail
(
subject:
"Dados para OAI harvest atualizados"
)
end
end
This diff is collapsed.
Click to expand it.
app/models/user.rb
+
8
−
1
View file @
d8de3373
...
@@ -88,6 +88,7 @@ class User < ApplicationRecord
...
@@ -88,6 +88,7 @@ class User < ApplicationRecord
has_many
:applications
has_many
:applications
after_create
:default_role
after_create
:default_role
after_save
:verify_dspace_info
has_attached_file
:avatar
,
styles:
{
medium:
'300x300>'
,
thumb:
'60x60>'
},
default_url:
''
has_attached_file
:avatar
,
styles:
{
medium:
'300x300>'
,
thumb:
'60x60>'
},
default_url:
''
validates_attachment_content_type
:avatar
,
content_type:
[
'image/jpg'
,
'image/jpeg'
,
'image/png'
,
'image/gif'
]
validates_attachment_content_type
:avatar
,
content_type:
[
'image/jpg'
,
'image/jpeg'
,
'image/png'
,
'image/gif'
]
...
@@ -270,6 +271,12 @@ class User < ApplicationRecord
...
@@ -270,6 +271,12 @@ class User < ApplicationRecord
)
)
end
end
def
verify_dspace_info
if
roles
.
include?
(
Role
.
find_by_name
(
"partner"
))
&&
!
(
changed
&
[
"dspace_url"
,
"dspace_handle"
,
"dspace_sets"
]).
empty?
DSpaceMailer
.
dspace_info_updated
(
self
)
end
end
def
activity_owner
def
activity_owner
self
self
end
end
...
@@ -280,7 +287,7 @@ class User < ApplicationRecord
...
@@ -280,7 +287,7 @@ class User < ApplicationRecord
def
update_tracked_fields
(
request
)
def
update_tracked_fields
(
request
)
super
super
# Change request.remote_ip to req.env["HTTP_X_REAL_IP"] in production
# Change request.remote_ip to req
uest
.env["HTTP_X_REAL_IP"] in production
self
.
current_sign_in_ip
=
request
.
remote_ip
self
.
current_sign_in_ip
=
request
.
remote_ip
end
end
end
end
This diff is collapsed.
Click to expand it.
app/views/dspace_mailer/new_dspace_info.erb
0 → 100644
+
14
−
0
View file @
d8de3373
<!DOCTYPE html>
<html>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<style>
/* Email styles need to be inline */
</style>
</head>
<body>
<h2>
ID do usuário:
<%=
@partner
.
id
%>
</h1>
<h2>
Nome do usuário:
<%=
@partner
.
name
%>
</h1>
<h2>
URL do DSpace:
<%=
@partner
.
dspace_url
%>
</h1>
<h2>
Handle:
<%=
@partner
.
dspace_url
%>
</h1>
<h2>
Sets:
<%=
@partner
.
dspace_sets
.
join
(
","
)
%>
</h1>
</body>
</html>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment