Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
diaspora
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
diasporg
diaspora
Commits
e70e48d6
Commit
e70e48d6
authored
Sep 09, 2012
by
Jonne Haß
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some refactoring regarding the law of demeter
parent
f0619dbb
Changes
67
Hide whitespace changes
Inline
Side-by-side
Showing
67 changed files
with
150 additions
and
115 deletions
+150
-115
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+1
-1
app/controllers/conversations_controller.rb
app/controllers/conversations_controller.rb
+5
-5
app/controllers/messages_controller.rb
app/controllers/messages_controller.rb
+1
-1
app/controllers/photos_controller.rb
app/controllers/photos_controller.rb
+1
-1
app/controllers/profiles_controller.rb
app/controllers/profiles_controller.rb
+1
-1
app/controllers/reshares_controller.rb
app/controllers/reshares_controller.rb
+1
-1
app/controllers/services_controller.rb
app/controllers/services_controller.rb
+4
-4
app/controllers/users_controller.rb
app/controllers/users_controller.rb
+2
-2
app/helpers/contacts_helper.rb
app/helpers/contacts_helper.rb
+3
-3
app/helpers/invitation_codes_helper.rb
app/helpers/invitation_codes_helper.rb
+1
-1
app/helpers/mobile_helper.rb
app/helpers/mobile_helper.rb
+3
-3
app/helpers/notifications_helper.rb
app/helpers/notifications_helper.rb
+1
-1
app/helpers/posts_helper.rb
app/helpers/posts_helper.rb
+3
-3
app/mailers/notification_mailers/also_commented.rb
app/mailers/notification_mailers/also_commented.rb
+3
-2
app/mailers/notification_mailers/base.rb
app/mailers/notification_mailers/base.rb
+4
-0
app/mailers/notification_mailers/comment_on_post.rb
app/mailers/notification_mailers/comment_on_post.rb
+2
-2
app/mailers/notification_mailers/confirm_email.rb
app/mailers/notification_mailers/confirm_email.rb
+1
-1
app/mailers/notification_mailers/liked.rb
app/mailers/notification_mailers/liked.rb
+2
-1
app/mailers/notification_mailers/mentioned.rb
app/mailers/notification_mailers/mentioned.rb
+2
-1
app/mailers/notification_mailers/private_message.rb
app/mailers/notification_mailers/private_message.rb
+1
-1
app/mailers/notification_mailers/reshared.rb
app/mailers/notification_mailers/reshared.rb
+3
-1
app/mailers/notifier.rb
app/mailers/notifier.rb
+1
-1
app/models/block.rb
app/models/block.rb
+3
-1
app/models/comment.rb
app/models/comment.rb
+4
-0
app/models/contact.rb
app/models/contact.rb
+4
-1
app/models/invitation_code.rb
app/models/invitation_code.rb
+2
-0
app/models/message.rb
app/models/message.rb
+2
-0
app/models/person.rb
app/models/person.rb
+3
-1
app/models/photo.rb
app/models/photo.rb
+1
-0
app/models/reshare.rb
app/models/reshare.rb
+2
-1
app/models/status_message.rb
app/models/status_message.rb
+4
-0
app/models/user.rb
app/models/user.rb
+5
-2
app/presenters/o_embed_presenter.rb
app/presenters/o_embed_presenter.rb
+3
-3
app/presenters/person_presenter.rb
app/presenters/person_presenter.rb
+4
-4
app/presenters/post_presenter.rb
app/presenters/post_presenter.rb
+1
-1
app/views/community_spotlight/_user.html.haml
app/views/community_spotlight/_user.html.haml
+1
-1
app/views/contacts/index.html.haml
app/views/contacts/index.html.haml
+2
-2
app/views/contacts/sharing.haml
app/views/contacts/sharing.haml
+2
-2
app/views/notifications/_notify_popup_item.haml
app/views/notifications/_notify_popup_item.haml
+1
-1
app/views/notifier/also_commented.markerb
app/views/notifier/also_commented.markerb
+2
-2
app/views/notifier/comment_on_post.markerb
app/views/notifier/comment_on_post.markerb
+1
-1
app/views/notifier/confirm_email.markerb
app/views/notifier/confirm_email.markerb
+3
-3
app/views/notifier/liked.markerb
app/views/notifier/liked.markerb
+3
-3
app/views/notifier/mentioned.markerb
app/views/notifier/mentioned.markerb
+1
-1
app/views/notifier/reshared.markerb
app/views/notifier/reshared.markerb
+2
-2
app/views/notifier/started_sharing.markerb
app/views/notifier/started_sharing.markerb
+2
-2
app/views/people/_profile_sidebar.html.haml
app/views/people/_profile_sidebar.html.haml
+8
-8
app/views/people/_sub_header.html.haml
app/views/people/_sub_header.html.haml
+1
-1
app/views/photos/_photo.haml
app/views/photos/_photo.haml
+1
-1
app/views/posts/_photo.html.haml
app/views/posts/_photo.html.haml
+1
-1
app/views/publics/hcard.haml
app/views/publics/hcard.haml
+5
-5
app/views/shared/_photo_area.mobile.haml
app/views/shared/_photo_area.mobile.haml
+1
-1
app/views/status_messages/_status_message.mobile.haml
app/views/status_messages/_status_message.mobile.haml
+1
-1
app/views/users/getting_started.haml
app/views/users/getting_started.haml
+1
-1
app/views/users/privacy_settings.html.haml
app/views/users/privacy_settings.html.haml
+1
-1
app/views/users/public.atom.builder
app/views/users/public.atom.builder
+5
-5
lib/collect_user_photos.rb
lib/collect_user_photos.rb
+1
-1
lib/diaspora/exporter.rb
lib/diaspora/exporter.rb
+2
-2
lib/diaspora/relayable.rb
lib/diaspora/relayable.rb
+3
-2
lib/diaspora/shareable.rb
lib/diaspora/shareable.rb
+2
-1
lib/email_inviter.rb
lib/email_inviter.rb
+1
-1
lib/postzord/dispatcher.rb
lib/postzord/dispatcher.rb
+3
-3
lib/postzord/receiver/local_batch.rb
lib/postzord/receiver/local_batch.rb
+2
-2
lib/postzord/receiver/private.rb
lib/postzord/receiver/private.rb
+1
-1
lib/postzord/receiver/public.rb
lib/postzord/receiver/public.rb
+3
-3
lib/stream/base.rb
lib/stream/base.rb
+2
-2
spec/presenters/post_presenter_spec.rb
spec/presenters/post_presenter_spec.rb
+1
-1
No files found.
app/controllers/application_controller.rb
View file @
e70e48d6
...
...
@@ -86,7 +86,7 @@ class ApplicationController < ActionController::Base
def
set_grammatical_gender
if
(
user_signed_in?
&&
I18n
.
inflector
.
inflected_locale?
)
gender
=
current_user
.
profile
.
gender
.
to_s
.
tr
(
'!()[]"\'`*=|/\#.,-:'
,
''
).
downcase
gender
=
current_user
.
gender
.
to_s
.
tr
(
'!()[]"\'`*=|/\#.,-:'
,
''
).
downcase
unless
gender
.
empty?
i_langs
=
I18n
.
inflector
.
inflected_locales
(
:gender
)
i_langs
.
delete
I18n
.
locale
...
...
app/controllers/conversations_controller.rb
View file @
e70e48d6
...
...
@@ -5,10 +5,10 @@ class ConversationsController < ApplicationController
def
index
@conversations
=
Conversation
.
joins
(
:conversation_visibilities
).
where
(
:conversation_visibilities
=>
{
:person_id
=>
current_user
.
person
.
id
}).
paginate
(
:conversation_visibilities
=>
{
:person_id
=>
current_user
.
person
_
id
}).
paginate
(
:page
=>
params
[
:page
],
:per_page
=>
15
,
:order
=>
'updated_at DESC'
)
@visibilities
=
ConversationVisibility
.
where
(
:person_id
=>
current_user
.
person
.
id
).
paginate
(
@visibilities
=
ConversationVisibility
.
where
(
:person_id
=>
current_user
.
person
_
id
).
paginate
(
:page
=>
params
[
:page
],
:per_page
=>
15
,
:order
=>
'updated_at DESC'
)
@unread_counts
=
{}
...
...
@@ -18,7 +18,7 @@ class ConversationsController < ApplicationController
@conversations
.
each
{
|
c
|
@authors
[
c
.
id
]
=
c
.
last_author
}
@conversation
=
Conversation
.
joins
(
:conversation_visibilities
).
where
(
:conversation_visibilities
=>
{
:person_id
=>
current_user
.
person
.
id
,
:conversation_id
=>
params
[
:conversation_id
]}).
first
:conversation_visibilities
=>
{
:person_id
=>
current_user
.
person
_
id
,
:conversation_id
=>
params
[
:conversation_id
]}).
first
respond_with
do
|
format
|
format
.
html
...
...
@@ -31,7 +31,7 @@ class ConversationsController < ApplicationController
contact
.
person_id
end
params
[
:conversation
][
:participant_ids
]
=
person_ids
|
[
current_user
.
person
.
id
]
params
[
:conversation
][
:participant_ids
]
=
person_ids
|
[
current_user
.
person
_
id
]
params
[
:conversation
][
:author
]
=
current_user
.
person
message_text
=
params
[
:conversation
].
delete
(
:text
)
params
[
:conversation
][
:messages_attributes
]
=
[
{
:author
=>
current_user
.
person
,
:text
=>
message_text
}]
...
...
@@ -52,7 +52,7 @@ class ConversationsController < ApplicationController
def
show
if
@conversation
=
Conversation
.
joins
(
:conversation_visibilities
).
where
(
:id
=>
params
[
:id
],
:conversation_visibilities
=>
{
:person_id
=>
current_user
.
person
.
id
}).
first
:conversation_visibilities
=>
{
:person_id
=>
current_user
.
person
_
id
}).
first
if
@visibility
=
ConversationVisibility
.
where
(
:conversation_id
=>
params
[
:id
],
:person_id
=>
current_user
.
person
.
id
).
first
@visibility
.
unread
=
0
@visibility
.
save
...
...
app/controllers/messages_controller.rb
View file @
e70e48d6
...
...
@@ -11,7 +11,7 @@ class MessagesController < ApplicationController
def
create
cnv
=
Conversation
.
joins
(
:conversation_visibilities
).
where
(
:id
=>
params
[
:conversation_id
],
:conversation_visibilities
=>
{
:person_id
=>
current_user
.
person
.
id
}).
first
:conversation_visibilities
=>
{
:person_id
=>
current_user
.
person
_
id
}).
first
if
cnv
message
=
Message
.
new
(
:conversation_id
=>
cnv
.
id
,
:text
=>
params
[
:message
][
:text
],
:author
=>
current_user
.
person
)
...
...
app/controllers/photos_controller.rb
View file @
e70e48d6
...
...
@@ -58,7 +58,7 @@ class PhotosController < ApplicationController
end
def
make_profile_photo
author_id
=
current_user
.
person
.
id
author_id
=
current_user
.
person
_
id
@photo
=
Photo
.
where
(
:id
=>
params
[
:photo_id
],
:author_id
=>
author_id
).
first
if
@photo
...
...
app/controllers/profiles_controller.rb
View file @
e70e48d6
...
...
@@ -42,7 +42,7 @@ class ProfilesController < ApplicationController
@profile_attrs
[
:nsfw
]
||=
false
if
params
[
:photo_id
]
@profile_attrs
[
:photo
]
=
Photo
.
where
(
:author_id
=>
current_user
.
person
.
id
,
:id
=>
params
[
:photo_id
]).
first
@profile_attrs
[
:photo
]
=
Photo
.
where
(
:author_id
=>
current_user
.
person
_
id
,
:id
=>
params
[
:photo_id
]).
first
end
if
current_user
.
update_profile
(
@profile_attrs
)
...
...
app/controllers/reshares_controller.rb
View file @
e70e48d6
...
...
@@ -6,7 +6,7 @@ class ResharesController < ApplicationController
@reshare
=
current_user
.
build_post
(
:reshare
,
:root_guid
=>
params
[
:root_guid
])
if
@reshare
.
save
current_user
.
add_to_streams
(
@reshare
,
current_user
.
aspects
)
current_user
.
dispatch_post
(
@reshare
,
:url
=>
post_url
(
@reshare
),
:additional_subscribers
=>
@reshare
.
root
.
author
)
current_user
.
dispatch_post
(
@reshare
,
:url
=>
post_url
(
@reshare
),
:additional_subscribers
=>
@reshare
.
root
_
author
)
end
render
:json
=>
ExtremePostPresenter
.
new
(
@reshare
,
current_user
),
:status
=>
201
...
...
app/controllers/services_controller.rb
View file @
e70e48d6
...
...
@@ -33,9 +33,9 @@ class ServicesController < ApplicationController
current_user
.
services
<<
service
if
service
.
persisted?
fetch_photo
=
current_user
.
p
erson
.
p
rofile
[
:image_url
].
blank?
fetch_photo
=
current_user
.
profile
[
:image_url
].
blank?
current_user
.
update_profile
(
current_user
.
p
erson
.
p
rofile
.
from_omniauth_hash
(
user
))
current_user
.
update_profile
(
current_user
.
profile
.
from_omniauth_hash
(
user
))
Resque
.
enqueue
(
Jobs
::
FetchProfilePhoto
,
current_user
.
id
,
service
.
id
,
user
[
"image"
])
if
fetch_photo
flash
[
:notice
]
=
I18n
.
t
'services.create.success'
...
...
@@ -44,7 +44,7 @@ class ServicesController < ApplicationController
if
existing_service
=
Service
.
where
(
:type
=>
service
.
type
.
to_s
,
:uid
=>
service
.
uid
).
first
flash
[
:error
]
<<
I18n
.
t
(
'services.create.already_authorized'
,
:diaspora_id
=>
existing_service
.
user
.
p
erson
.
p
rofile
.
diaspora_handle
,
:diaspora_id
=>
existing_service
.
user
.
profile
.
diaspora_handle
,
:service_name
=>
provider
.
camelize
)
end
end
...
...
@@ -65,4 +65,4 @@ class ServicesController < ApplicationController
redirect_to
services_url
end
end
\ No newline at end of file
end
app/controllers/users_controller.rb
View file @
e70e48d6
...
...
@@ -101,7 +101,7 @@ class UsersController < ApplicationController
if
@user
=
User
.
find_by_username
(
params
[
:username
])
respond_to
do
|
format
|
format
.
atom
do
@posts
=
StatusMessage
.
where
(
:author_id
=>
@user
.
person
.
id
,
:public
=>
true
).
order
(
'created_at DESC'
).
limit
(
25
)
@posts
=
StatusMessage
.
where
(
:author_id
=>
@user
.
person
_
id
,
:public
=>
true
).
order
(
'created_at DESC'
).
limit
(
25
)
end
format
.
any
{
redirect_to
person_path
(
@user
.
person
)
}
...
...
@@ -140,7 +140,7 @@ class UsersController < ApplicationController
username
=
params
[
:username
].
split
(
'@'
)[
0
]
user
=
User
.
find_by_username
(
username
)
if
user
.
present?
redirect_to
user
.
profile
.
image_url
redirect_to
user
.
image_url
else
render
:nothing
=>
true
,
:status
=>
404
end
...
...
app/helpers/contacts_helper.rb
View file @
e70e48d6
...
...
@@ -6,9 +6,9 @@ module ContactsHelper
:action
=>
'destroy'
,
:id
=>
42
,
:aspect_id
=>
@aspect
.
id
,
:person_id
=>
contact
.
person
.
id
:person_id
=>
contact
.
person
_
id
},
:title
=>
t
(
'.remove_person_from_aspect'
,
:person_name
=>
contact
.
person
.
first_name
,
:aspect_name
=>
@aspect
.
name
),
:title
=>
t
(
'.remove_person_from_aspect'
,
:person_name
=>
contact
.
person
_
first_name
,
:aspect_name
=>
@aspect
.
name
),
:method
=>
'delete'
)
else
...
...
@@ -17,4 +17,4 @@ module ContactsHelper
:current_user
=>
current_user
}
end
end
end
\ No newline at end of file
end
app/helpers/invitation_codes_helper.rb
View file @
e70e48d6
...
...
@@ -4,7 +4,7 @@ module InvitationCodesHelper
content_tag
(
:div
,
:class
=>
'media well'
)
do
person_image_link
(
invite
.
user
.
person
,
:class
=>
'img'
)
+
content_tag
(
:div
,
:class
=>
'bd'
)
do
I18n
.
translate
(
'invitation_codes.excited'
,
:name
=>
invite
.
user
.
name
)
I18n
.
translate
(
'invitation_codes.excited'
,
:name
=>
invite
.
user
_
name
)
end
end
end
...
...
app/helpers/mobile_helper.rb
View file @
e70e48d6
...
...
@@ -8,11 +8,11 @@ module MobileHelper
if
(
post
.
public?
||
reshare?
(
post
))
&&
(
user_signed_in?
&&
post
.
author
!=
current_user
.
person
)
root
=
reshare?
(
post
)
?
post
.
root
:
post
if
root
.
author
!=
current_user
.
person
.
id
reshare
=
Reshare
.
where
(
:author_id
=>
current_user
.
person
.
id
,
if
root
.
author
!=
current_user
.
person
_
id
reshare
=
Reshare
.
where
(
:author_id
=>
current_user
.
person
_
id
,
:root_guid
=>
root
.
guid
).
first
klass
=
reshare
.
present?
?
"active"
:
"inactive"
link_to
''
,
reshares_path
(
:root_guid
=>
root
.
guid
),
:title
=>
t
(
'reshares.reshare.reshare_confirmation'
,
:author
=>
root
.
author
.
name
),
:class
=>
"image_link reshare_action
#{
klass
}
"
link_to
''
,
reshares_path
(
:root_guid
=>
root
.
guid
),
:title
=>
t
(
'reshares.reshare.reshare_confirmation'
,
:author
=>
root
.
author
_
name
),
:class
=>
"image_link reshare_action
#{
klass
}
"
end
end
end
...
...
app/helpers/notifications_helper.rb
View file @
e70e48d6
...
...
@@ -13,7 +13,7 @@ module NotificationsHelper
end
elsif
note
.
instance_of?
(
Notifications
::
CommentOnPost
)
||
note
.
instance_of?
(
Notifications
::
AlsoCommented
)
||
note
.
instance_of?
(
Notifications
::
Reshared
)
||
note
.
instance_of?
(
Notifications
::
Liked
)
if
post
=
note
.
linked_object
translation
(
target_type
,
:actors
=>
actors
,
:count
=>
actors_count
,
:post_author
=>
h
(
post
.
author
.
name
),
:post_link
=>
link_to
(
t
(
'notifications.post'
),
post_path
(
post
),
'data-ref'
=>
post
.
id
,
:class
=>
'hard_object_link'
).
html_safe
)
translation
(
target_type
,
:actors
=>
actors
,
:count
=>
actors_count
,
:post_author
=>
h
(
post
.
author
_
name
),
:post_link
=>
link_to
(
t
(
'notifications.post'
),
post_path
(
post
),
'data-ref'
=>
post
.
id
,
:class
=>
'hard_object_link'
).
html_safe
)
else
t
(
note
.
deleted_translation_key
,
:actors
=>
actors
,
:count
=>
actors_count
).
html_safe
end
...
...
app/helpers/posts_helper.rb
View file @
e70e48d6
...
...
@@ -5,14 +5,14 @@
module
PostsHelper
def
post_page_title
(
post
,
opts
=
{})
if
post
.
is_a?
(
Photo
)
I18n
.
t
"posts.show.photos_by"
,
:count
=>
1
,
:author
=>
post
.
status_message
.
author
.
name
I18n
.
t
"posts.show.photos_by"
,
:count
=>
1
,
:author
=>
post
.
status_message
_author_
name
elsif
post
.
is_a?
(
Reshare
)
I18n
.
t
"posts.show.reshare_by"
,
:author
=>
post
.
author
.
name
I18n
.
t
"posts.show.reshare_by"
,
:author
=>
post
.
author
_
name
else
if
post
.
text
.
present?
truncate
(
post
.
text
(
:plain_text
=>
true
),
:length
=>
opts
.
fetch
(
:length
,
20
))
elsif
post
.
respond_to?
(
:photos
)
&&
post
.
photos
.
present?
I18n
.
t
"posts.show.photos_by"
,
:count
=>
post
.
photos
.
size
,
:author
=>
post
.
author
.
name
I18n
.
t
"posts.show.photos_by"
,
:count
=>
post
.
photos
.
size
,
:author
=>
post
.
author
_
name
end
end
end
...
...
app/mailers/notification_mailers/also_commented.rb
View file @
e70e48d6
...
...
@@ -3,13 +3,14 @@ module NotificationMailers
include
ActionView
::
Helpers
::
TextHelper
attr_accessor
:comment
delegate
:post
,
to: :comment
,
prefix:
true
def
set_headers
(
comment_id
)
@comment
=
Comment
.
find_by_id
(
comment_id
)
if
mail?
@headers
[
:from
]
=
"
\"
#{
@comment
.
author
.
name
}
(Diaspora*)
\"
<
#{
AppConfig
[
:smtp_sender_address
]
}
>"
@headers
[
:subject
]
=
truncate
(
@comment
.
parent
.
comment_email_subject
,
:length
=>
TRUNCATION_LEN
)
@headers
[
:from
]
=
"
\"
#{
@comment
.
author
_
name
}
(Diaspora*)
\"
<
#{
AppConfig
[
:smtp_sender_address
]
}
>"
@headers
[
:subject
]
=
truncate
(
@comment
.
comment_email_subject
,
:length
=>
TRUNCATION_LEN
)
@headers
[
:subject
]
=
"Re:
#{
@headers
[
:subject
]
}
"
end
end
...
...
app/mailers/notification_mailers/base.rb
View file @
e70e48d6
...
...
@@ -3,6 +3,10 @@ module NotificationMailers
class
Base
attr_accessor
:recipient
,
:sender
delegate
:unconfirmed_email
,
:confirm_email_token
,
:first_name
,
to: :recipient
,
prefix:
true
delegate
:first_name
,
:name
,
:sender
,
to: :sender
,
prefix:
true
def
initialize
(
recipient_id
,
sender_id
=
nil
,
*
args
)
@headers
=
{}
...
...
app/mailers/notification_mailers/comment_on_post.rb
View file @
e70e48d6
...
...
@@ -7,8 +7,8 @@ module NotificationMailers
def
set_headers
(
comment_id
)
@comment
=
Comment
.
find
(
comment_id
)
@headers
[
:from
]
=
"
\"
#{
@comment
.
author
.
name
}
(Diaspora*)
\"
<
#{
AppConfig
[
:smtp_sender_address
]
}
>"
@headers
[
:subject
]
=
truncate
(
@comment
.
parent
.
comment_email_subject
,
:length
=>
TRUNCATION_LEN
)
@headers
[
:from
]
=
"
\"
#{
@comment
.
author
_
name
}
(Diaspora*)
\"
<
#{
AppConfig
[
:smtp_sender_address
]
}
>"
@headers
[
:subject
]
=
truncate
(
@comment
.
comment_email_subject
,
:length
=>
TRUNCATION_LEN
)
@headers
[
:subject
]
=
"Re:
#{
@headers
[
:subject
]
}
"
end
end
...
...
app/mailers/notification_mailers/confirm_email.rb
View file @
e70e48d6
module
NotificationMailers
class
ConfirmEmail
<
NotificationMailers
::
Base
def
set_headers
@headers
[
:to
]
=
name_and_address
(
@recipient
.
profile
.
first_name
,
@recipient
.
unconfirmed_email
)
@headers
[
:to
]
=
name_and_address
(
@recipient
.
first_name
,
@recipient
.
unconfirmed_email
)
@headers
[
:subject
]
=
I18n
.
t
(
'notifier.confirm_email.subject'
,
:unconfirmed_email
=>
@recipient
.
unconfirmed_email
)
end
end
...
...
app/mailers/notification_mailers/liked.rb
View file @
e70e48d6
module
NotificationMailers
class
Liked
<
NotificationMailers
::
Base
attr_accessor
:like
delegate
:target
,
to: :like
,
prefix:
true
def
set_headers
(
like_id
)
@like
=
Like
.
find
(
like_id
)
...
...
@@ -8,4 +9,4 @@ module NotificationMailers
@headers
[
:subject
]
=
I18n
.
t
(
'notifier.liked.liked'
,
:name
=>
@sender
.
name
)
end
end
end
\ No newline at end of file
end
app/mailers/notification_mailers/mentioned.rb
View file @
e70e48d6
module
NotificationMailers
class
Mentioned
<
NotificationMailers
::
Base
attr_accessor
:post
delegate
:author_name
,
to: :post
,
prefix:
true
def
set_headers
(
target_id
)
@post
=
Mention
.
find_by_id
(
target_id
).
post
...
...
@@ -8,4 +9,4 @@ module NotificationMailers
@headers
[
:subject
]
=
I18n
.
t
(
'notifier.mentioned.subject'
,
:name
=>
@sender
.
name
)
end
end
end
\ No newline at end of file
end
app/mailers/notification_mailers/private_message.rb
View file @
e70e48d6
...
...
@@ -7,7 +7,7 @@ module NotificationMailers
@conversation
=
@message
.
conversation
@participants
=
@conversation
.
participants
@headers
[
:from
]
=
"
\"
#{
@message
.
author
.
name
}
(Diaspora*)
\"
<
#{
AppConfig
[
:smtp_sender_address
]
}
>"
@headers
[
:from
]
=
"
\"
#{
@message
.
author
_
name
}
(Diaspora*)
\"
<
#{
AppConfig
[
:smtp_sender_address
]
}
>"
@headers
[
:subject
]
=
@conversation
.
subject
.
strip
@headers
[
:subject
]
=
"Re:
#{
@headers
[
:subject
]
}
"
if
@conversation
.
messages
.
size
>
1
end
...
...
app/mailers/notification_mailers/reshared.rb
View file @
e70e48d6
module
NotificationMailers
class
Reshared
<
NotificationMailers
::
Base
attr_accessor
:reshare
delegate
:root
,
to: :reshare
,
prefix:
true
def
set_headers
(
reshare_id
)
@reshare
=
Reshare
.
find
(
reshare_id
)
...
...
@@ -8,4 +10,4 @@ module NotificationMailers
@headers
[
:subject
]
=
I18n
.
t
(
'notifier.reshared.reshared'
,
:name
=>
@sender
.
name
)
end
end
end
\ No newline at end of file
end
app/mailers/notifier.rb
View file @
e70e48d6
...
...
@@ -43,7 +43,7 @@ class Notifier < ActionMailer::Base
@invitation_code
=
invitation_code
mail_opts
=
{
:to
=>
email
,
:from
=>
AppConfig
[
:smtp_sender_address
],
:subject
=>
I18n
.
t
(
'notifier.invited_you'
,
:name
=>
@inviter
.
person
.
name
),
:subject
=>
I18n
.
t
(
'notifier.invited_you'
,
:name
=>
@inviter
.
name
),
:host
=>
AppConfig
[
:pod_uri
].
host
}
I18n
.
with_locale
(
locale
)
do
...
...
app/models/block.rb
View file @
e70e48d6
...
...
@@ -2,6 +2,8 @@ class Block < ActiveRecord::Base
belongs_to
:person
belongs_to
:user
delegate
:name
,
to: :person
,
prefix:
true
validates
:user_id
,
:presence
=>
true
validates
:person_id
,
:presence
=>
true
,
:uniqueness
=>
{
:scope
=>
:user_id
}
...
...
@@ -12,4 +14,4 @@ class Block < ActiveRecord::Base
errors
[
:person_id
]
<<
"stop blocking yourself!"
end
end
end
\ No newline at end of file
end
app/models/comment.rb
View file @
e70e48d6
...
...
@@ -22,6 +22,10 @@ class Comment < ActiveRecord::Base
belongs_to
:commentable
,
:touch
=>
true
,
:polymorphic
=>
true
alias_attribute
:post
,
:commentable
belongs_to
:author
,
:class_name
=>
'Person'
delegate
:name
,
to: :author
,
prefix:
true
delegate
:comment_email_subject
,
to: :parent
delegate
:author_name
,
to: :parent
,
prefix:
true
validates
:text
,
:presence
=>
true
,
:length
=>
{
:maximum
=>
65535
}
validates
:parent
,
:presence
=>
true
#should be in relayable (pending on fixing Message)
...
...
app/models/contact.rb
View file @
e70e48d6
...
...
@@ -7,6 +7,9 @@ class Contact < ActiveRecord::Base
belongs_to
:person
validates
:person
,
:presence
=>
true
delegate
:name
,
:diaspora_handle
,
:guid
,
:first_name
,
to: :person
,
prefix:
true
has_many
:aspect_memberships
has_many
:aspects
,
:through
=>
:aspect_memberships
...
...
@@ -72,7 +75,7 @@ class Contact < ActiveRecord::Base
incoming_aspects
=
Aspect
.
where
(
:user_id
=>
self
.
person
.
owner_id
,
:contacts_visible
=>
true
).
joins
(
:contacts
).
where
(
:contacts
=>
{
:person_id
=>
self
.
user
.
person
.
id
}).
select
(
'aspects.id'
)
:contacts
=>
{
:person_id
=>
self
.
user
.
person
_
id
}).
select
(
'aspects.id'
)
incoming_aspect_ids
=
incoming_aspects
.
map
{
|
a
|
a
.
id
}
similar_contacts
=
Person
.
joins
(
:contacts
=>
:aspect_memberships
).
where
(
:aspect_memberships
=>
{
:aspect_id
=>
incoming_aspect_ids
}).
where
(
people
[
:id
].
not_eq
(
self
.
user
.
person
.
id
)).
select
(
'DISTINCT people.*'
)
...
...
app/models/invitation_code.rb
View file @
e70e48d6
...
...
@@ -5,6 +5,8 @@ class InvitationCode < ActiveRecord::Base
before_create
:generate_token
,
:set_default_invite_count
delegate
:name
,
to: :user
,
prefix:
true
def
to_param
token
end
...
...
app/models/message.rb
View file @
e70e48d6
...
...
@@ -11,6 +11,8 @@ class Message < ActiveRecord::Base
belongs_to
:author
,
:class_name
=>
'Person'
belongs_to
:conversation
,
:touch
=>
true
delegate
:name
,
to: :author
,
prefix:
true
validates
:text
,
:presence
=>
true
validate
:participant_of_parent_conversation
...
...
app/models/person.rb
View file @
e70e48d6
...
...
@@ -32,7 +32,9 @@ class Person < ActiveRecord::Base
xml_attr
:exported_key
has_one
:profile
,
:dependent
=>
:destroy
delegate
:last_name
,
:image_url
,
:to
=>
:profile
delegate
:last_name
,
:image_url
,
:tag_string
,
:bio
,
:location
,
:gender
,
:birthday
,
:formatted_birthday
,
:tags
,
:searchable
,
to: :profile
accepts_nested_attributes_for
:profile
before_validation
:downcase_diaspora_handle
...
...
app/models/photo.rb
View file @
e70e48d6
...
...
@@ -41,6 +41,7 @@ class Photo < ActiveRecord::Base
belongs_to
:status_message
,
:foreign_key
=>
:status_message_guid
,
:primary_key
=>
:guid
validates_associated
:status_message
delegate
:author_name
,
to: :status_message
,
prefix:
true
attr_accessible
:text
,
:pending
validate
:ownership_of_status_message
...
...
app/models/reshare.rb
View file @
e70e48d6
...
...
@@ -9,6 +9,7 @@ class Reshare < Post
attr_accessible
:root_guid
,
:public
validates_presence_of
:root
,
:on
=>
:create
validates_uniqueness_of
:root_guid
,
:scope
=>
:author_id
delegate
:author
,
to: :root
,
prefix:
true
xml_attr
:root_diaspora_id
xml_attr
:root_guid
...
...
@@ -58,7 +59,7 @@ class Reshare < Post
end
def
comment_email_subject
I18n
.
t
(
'reshares.comment_email_subject'
,
:resharer
=>
author
.
name
,
:author
=>
root
.
author
.
name
)
I18n
.
t
(
'reshares.comment_email_subject'
,
:resharer
=>
author
.
name
,
:author
=>
root
.
author
_
name
)
end
def
notification_type
(
user
,
person
)
...
...
app/models/status_message.rb
View file @
e70e48d6
...
...
@@ -146,6 +146,10 @@ class StatusMessage < Post
formatted_message
(
:plain_text
=>
true
)
end
def
first_photo_url
(
*
args
)
photos
.
first
.
url
(
*
args
)
end
def
text_and_photos_blank?
self
.
text
.
blank?
&&
self
.
photos
.
blank?
end
...
...
app/models/user.rb
View file @
e70e48d6
...
...
@@ -38,7 +38,10 @@ class User < ActiveRecord::Base
serialize
:hidden_shareables
,
Hash
has_one
:person
,
:foreign_key
=>
:owner_id
delegate
:guid
,
:public_key
,
:posts
,
:photos
,
:owns?
,
:diaspora_handle
,
:name
,
:public_url
,
:profile
,
:first_name
,
:last_name
,
:participations
,
:to
=>
:person
delegate
:guid
,
:public_key
,
:posts
,
:photos
,
:owns?
,
:image_url
,
:diaspora_handle
,
:name
,
:public_url
,
:profile
,
:url
,
:first_name
,
:last_name
,
:gender
,
:participations
,
to: :person
delegate
:id
,
:guid
,
to: :person
,
prefix:
true
has_many
:invitations_from_me
,
:class_name
=>
'Invitation'
,
:foreign_key
=>
:sender_id
has_many
:invitations_to_me
,
:class_name
=>
'Invitation'
,
:foreign_key
=>
:recipient_id
...
...
@@ -361,7 +364,7 @@ class User < ActiveRecord::Base
params
[
:image_url_small
]
=
photo
.
url
(
:thumb_small
)
end
if
self
.
p
erson
.
p
rofile
.
update_attributes
(
params
)
if
self
.
profile
.
update_attributes
(
params
)
Postzord
::
Dispatcher
.
build
(
self
,
profile
).
post
true
else
...
...
app/presenters/o_embed_presenter.rb
View file @
e70e48d6
...
...
@@ -15,7 +15,7 @@ class OEmbedPresenter
def
as_json
(
opts
=
{})
{
:provider_name
=>
"Diaspora"
,
:provider_url
=>
AppConfig
[
:pod_url
],
:provider_
h
url
=>
AppConfig
[
:pod_url
],
:type
=>
'rich'
,
:version
=>
'1.0'
,
:title
=>
post_title
,
...
...
@@ -36,7 +36,7 @@ class OEmbedPresenter
end
def
post_author
@post
.
author
.
name
@post
.
author
_
name
end
def
post_author_url
...
...
@@ -46,4 +46,4 @@ class OEmbedPresenter
def
iframe_html
post_iframe_url
(
@post
.
id
,
:height
=>
@opts
[
:maxheight
],
:width
=>
@opts
[
:maxwidth
])
end
end
\ No newline at end of file
end
app/presenters/person_presenter.rb
View file @
e70e48d6
...
...
@@ -12,9 +12,9 @@ class PersonPresenter
if
is_own_profile
||
person_is_following_current_user
attrs
.
merge!
({
:location
=>
@person
.
profile
.
location
,
:birthday
=>
@person
.
profile
.
formatted_birthday
,
:bio
=>
@person
.
profile
.
bio
:location
=>
@person
.
location
,
:birthday
=>
@person
.
formatted_birthday
,
:bio
=>
@person
.
bio
})
end
...
...
@@ -30,4 +30,4 @@ class PersonPresenter
def
person_is_following_current_user
@person
.
shares_with
(
@current_user
)
end
end
\ No newline at end of file
end
app/presenters/post_presenter.rb
View file @
e70e48d6
...
...
@@ -55,7 +55,7 @@ class PostPresenter
end
def
title
@post
.
text
.
present?
?
@post
.
text
(
:plain_text
=>
true
)
:
I18n
.
translate
(
'posts.presenter.title'
,
:name
=>
@post
.
author
.
name
)
@post
.
text
.
present?
?
@post
.
text
(
:plain_text
=>
true
)
:
I18n
.
translate
(
'posts.presenter.title'
,
:name
=>
@post
.
author
_
name
)
end
def
template_name
#kill me, lol, I should be client side
...
...
app/views/community_spotlight/_user.html.haml
View file @
e70e48d6
...
...
@@ -4,7 +4,7 @@
=
person
.
name
.tags
-
person
.
profile
.
tags
.
each
do
|
tag
|
-
person
.
tags
.
each
do
|
tag
|
=
link_to
"#
#{
tag
}
"
,
tag_path
(
:name
=>
tag
.
name
)
.add_user_to_aspect
...
...
app/views/contacts/index.html.haml
View file @
e70e48d6
...
...
@@ -29,7 +29,7 @@
-
if
@contacts
.
size
>
0
-
for
contact
in
@contacts
.stream_element
{
:id
=>
contact
.
person
.
id
}
.stream_element
{
:id
=>
contact
.
person
_
id
}
.float-right
=
contact_aspect_dropdown
(
contact
)
...
...
@@ -41,7 +41,7 @@
.bd
=
person_link
(
contact
.
person
)
.info
=
contact
.
person
.
diaspora_handle
=
contact
.
person
_
diaspora_handle
=
will_paginate
@contacts
-
else
...
...
app/views/contacts/sharing.haml
View file @
e70e48d6
...
...
@@ -18,9 +18,9 @@
%li
{
:data
=>
{
:contact_id
=>
contact
.
id
}}
=
person_image_tag
contact
.
person
%h4
.name
=
link_to
contact
.
person
.
name
,
contact
.
person
=
link_to
contact
.
person
_
name
,
contact
.
person
.description
=
contact
.
person
.
diaspora_handle
=
contact
.
person
_
diaspora_handle
.right
=
aspect_membership_dropdown
(
contact
,
contact
.
person
,
'right'
)
...
...
app/views/notifications/_notify_popup_item.haml
View file @
e70e48d6
.notification_element
{
:data
=>
{
:guid
=>
n
.
id
},
:class
=>
(
n
.
unread
?
"unread"
:
"read"
)}
%img
{
:src
=>
n
.
actors
.
first
.
profile
.
image_url
(
:thumb_medium
)}
%img
{
:src
=>
n
.
actors
.
first
.
image_url
(
:thumb_medium
)}
=
notification_message_for
(
n
)
%br
/
%abbr
.timeago
{
:title
=>
n
.
created_at
.
iso8601
}
...
...
app/views/notifier/also_commented.markerb
View file @
e70e48d6
<%= comment_message(@notification.comment, :process_newlines => true) %>
[<%= t('notifier.comment_on_post.reply', :name => @notification.comment
.post.author.
first_name) %>][1]
[<%= t('notifier.comment_on_post.reply', :name => @notification.comment
_post.author_
first_name) %>][1]
[1]: <%= post_url(@notification.comment
.
post) %>
[1]: <%= post_url(@notification.comment
_
post) %>
app/views/notifier/comment_on_post.markerb
View file @
e70e48d6
<%= comment_message(@notification.comment, :process_newlines => true) %>
[<%= t('notifier.comment_on_post.reply', :name => @notification.comment.p
ost.author.
name) %>][1]
[<%= t('notifier.comment_on_post.reply', :name => @notification.comment.p
arent_author_
name) %>][1]
[1]: <%= post_url(@notification.comment.post) %>
app/views/notifier/confirm_email.markerb
View file @
e70e48d6
<%= t('notifier.hello', :name => @notification.recipient
.profile.
first_name) %>
<%= t('notifier.hello', :name => @notification.recipient
_
first_name) %>
<%= t('notifier.confirm_email.click_link', :unconfirmed_email => @notification.recipient
.
unconfirmed_email) %>
<%= t('notifier.confirm_email.click_link', :unconfirmed_email => @notification.recipient
_
unconfirmed_email) %>
<<%= confirm_email_url(:token => @notification.recipient
.
confirm_email_token) %>>
<<%= confirm_email_url(:token => @notification.recipient
_
confirm_email_token) %>>
app/views/notifier/liked.markerb
View file @
e70e48d6
<%= "#{t('.liked', :name => "#{@notification.sender
.
name}")}:" %>
<%= "#{t('.liked', :name => "#{@notification.sender
_
name}")}:" %>
<%= post_message(@notification.like
.
target, :process_newlines => true) %>
<%= post_message(@notification.like
_
target, :process_newlines => true) %>
[<%= t('.view_post') %>][1]
[1]: <%= post_url(@notification.like
.
target) %>
[1]: <%= post_url(@notification.like
_
target) %>
app/views/notifier/mentioned.markerb
View file @
e70e48d6
<%= post_message(@notification.post, :process_newlines => true, :length => 600) %>
[<%= t('notifier.comment_on_post.reply', :name => @notification.post
.author.
name) %>][1]
[<%= t('notifier.comment_on_post.reply', :name => @notification.post
_author_
name) %>][1]
[1]: <%= post_url(@notification.post) %>
app/views/notifier/reshared.markerb
View file @
e70e48d6
<%= "#{t('.reshared', :name => "#{@notification.sender
.
name}")}:" %>
<%= "#{t('.reshared', :name => "#{@notification.sender
_
name}")}:" %>