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
ee749488
Commit
ee749488
authored
Oct 19, 2011
by
Ilya Zhitomirskiy
Committed by
danielgrippi
Oct 24, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip welcome post, publisher object
parent
c6a17cc0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
71 additions
and
2 deletions
+71
-2
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+2
-1
app/controllers/tag_followings_controller.rb
app/controllers/tag_followings_controller.rb
+1
-1
lib/publisher.rb
lib/publisher.rb
+18
-0
lib/stream/base.rb
lib/stream/base.rb
+5
-0
spec/lib/publisher_spec.rb
spec/lib/publisher_spec.rb
+41
-0
spec/shared_behaviors/stream.rb
spec/shared_behaviors/stream.rb
+4
-0
No files found.
app/controllers/application_controller.rb
View file @
ee749488
...
...
@@ -22,7 +22,8 @@ class ApplicationController < ActionController::Base
:my_contacts_count
,
:only_sharing_count
,
:tag_followings
,
:tags
:tags
,
:open_publisher
def
ensure_http_referer_is_set
request
.
env
[
'HTTP_REFERER'
]
||=
'/aspects'
...
...
app/controllers/tag_followings_controller.rb
View file @
ee749488
...
...
@@ -61,6 +61,6 @@ class TagFollowingsController < ApplicationController
@tag_following
=
current_user
.
tag_followings
.
create
(
:tag_id
=>
@tag
.
id
)
end
redirect_to
aspects_path
redirect_to
aspects_path
(
:welcome
=>
true
)
end
end
lib/publisher.rb
0 → 100644
View file @
ee749488
class
Publisher
attr_accessor
:user
,
:open
,
:prefill_text
,
:public
def
initialize
(
user
,
opts
=
{})
self
.
user
=
user
self
.
open
=
(
opts
[
:open
]
==
true
)?
true
:
false
self
.
prefill_text
=
opts
[
:prefill_text
]
self
.
public
=
(
opts
[
:public
]
==
true
)?
true
:
false
end
def
open?
self
.
open
end
def
public?
self
.
public
end
end
lib/stream/base.rb
View file @
ee749488
require
File
.
join
(
Rails
.
root
,
"lib"
,
"publisher"
)
class
Stream::Base
TYPES_OF_POST_IN_STREAM
=
[
'StatusMessage'
,
'Reshare'
,
'ActivityStreams::Photo'
]
attr_accessor
:max_time
,
:order
,
:user
...
...
@@ -106,6 +107,10 @@ class Stream::Base
@order
||=
'created_at'
end
def
publisher
@publisher
||=
Publisher
.
new
(
self
.
user
)
end
private
# Memoizes all Contacts present in the Stream
...
...
spec/lib/publisher_spec.rb
0 → 100644
View file @
ee749488
require
'spec_helper'
#NOTE;why is it not auto loadeded?
require
File
.
join
(
Rails
.
root
,
'lib'
,
'publisher'
)
describe
Publisher
do
before
do
@publisher
=
Publisher
.
new
(
alice
)
end
describe
'#open?'
do
it
'defaults to closed'
do
@publisher
.
open?
.
should
be_false
end
it
'listens to the opts'
do
Publisher
.
new
(
alice
,
:open
=>
true
).
open?
.
should
be_true
end
end
describe
"#prefill"
do
it
'defaults to nothing'
do
@publisher
.
prefill_text
.
should
be_blank
end
it
'is settable'
do
Publisher
.
new
(
alice
,
:prefill_text
=>
"party!"
).
prefill_text
.
should
==
"party!"
end
end
describe
"#public?"
do
it
'defaults to false'
do
@publisher
.
public?
.
should
be_false
end
it
'listens to the opts'
do
Publisher
.
new
(
alice
,
:public
=>
true
).
public?
.
should
be_true
end
end
end
spec/shared_behaviors/stream.rb
View file @
ee749488
...
...
@@ -40,6 +40,10 @@ describe 'Streams' do
@stream
.
order
=
nil
@stream
.
order
.
should
==
'created_at'
end
it
'initializes a publisher'
do
@stream
.
publisher
.
should
be_a
(
Publisher
)
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment