forked from hotsh/rstat.us
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes Issue hotsh#536: ALPS microblogging API - only unauthenticated …
…read messages (statuses)
- Loading branch information
1 parent
468e962
commit 4e23455
Showing
11 changed files
with
203 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
class StaticController < ApplicationController | ||
def homepage | ||
@list_class = "all" | ||
render :layout => false | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,28 @@ | ||
- reply ||= false | ||
.update | ||
.byline | ||
= AuthorDecorator.decorate(update.author).avatar | ||
%a{:href => "/users/#{update.author.username}"} | ||
= update.author.username | ||
.update-text | ||
.content | ||
!= update.to_html | ||
.update-date | ||
- if reply | ||
%a.timeago{:href => "/updates/#{update.id}", :title => update.created_at.getutc.iso8601} | ||
- else | ||
%abbr.timeago{:title => update.created_at.getutc.iso8601} | ||
#messages | ||
%ul.single | ||
%li.message | ||
.update | ||
.byline | ||
= AuthorDecorator.decorate(update.author).avatar | ||
%a{:href => "/users/#{update.author.username}"} | ||
= update.author.username | ||
.update-text | ||
.content | ||
!= update.to_html | ||
.update-date | ||
- if reply | ||
%a.timeago{:href => "/updates/#{update.id}", :title => update.created_at.getutc.iso8601} | ||
- else | ||
%abbr.timeago{:title => update.created_at.getutc.iso8601} | ||
|
||
.actions | ||
-unless current_user.nil? or (current_user.author.id == update.author.id) | ||
%a.share{:href => "/?share=#{update.id}"} share | ||
| | ||
%a.reply{:href => "/?reply=#{update.id}"} reply | ||
.actions | ||
-unless current_user.nil? or (current_user.author.id == update.author.id) | ||
%a.share{:href => "/?share=#{update.id}"} share | ||
| | ||
%a.reply{:href => "/?reply=#{update.id}"} reply | ||
|
||
- if current_user and update.author.id == current_user.author.id | ||
= form_tag "/updates/#{update.id}" do | ||
%input{:type => "hidden", :name => "_method", :value => "delete"} | ||
= submit_tag "I Regret This", :class => "remove-update", :confirm => t(:remove_update, :scope => :confirms) | ||
- if current_user and update.author.id == current_user.author.id | ||
= form_tag "/updates/#{update.id}" do | ||
%input{:type => "hidden", :name => "_method", :value => "delete"} | ||
= submit_tag "I Regret This", :class => "remove-update", :confirm => t(:remove_update, :scope => :confirms) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
require 'require_relative' if RUBY_VERSION[0,3] == '1.8' | ||
require_relative 'acceptance_helper' | ||
|
||
# This file tests our compatibility with the ALPS microblogging profile | ||
# defined at http://amundsen.com/hypermedia/profiles/ | ||
|
||
describe "ALPS microblogging spec" do | ||
include AcceptanceHelper | ||
|
||
describe "messages" do | ||
describe "ALPS all, rstat.us homepage (logged out /)" do | ||
it "has an individual status in an li with class message" do | ||
@u2 = Fabricate(:user) | ||
@update = Fabricate(:update) | ||
@u2.feed.updates << @update | ||
|
||
visit "/" | ||
|
||
within "div#messages ul.all li.message" do | ||
assert has_content? @update.text | ||
end | ||
end | ||
end | ||
|
||
describe "ALPS all, rstat.us world (/updates)" do | ||
it "has an individual status in an li with class message" do | ||
@u2 = Fabricate(:user) | ||
@update = Fabricate(:update) | ||
@u2.feed.updates << @update | ||
|
||
visit "/updates" | ||
|
||
within "div#messages ul.all li.message" do | ||
assert has_content? @update.text | ||
end | ||
end | ||
end | ||
|
||
describe "Unspecified in ALPS: a user's profile other than currently logged in user ('not me')" do | ||
# Addition not specified in official ALPS spec!!! | ||
it "has a user's updates in a ul with class single-user" do | ||
@u2 = Fabricate(:user) | ||
@update = Fabricate(:update, :author => @u2.author) | ||
@u2.feed.updates << @update | ||
|
||
visit "/users/#{@u2.username}" | ||
|
||
within "div#messages ul.single-user li.message" do | ||
assert has_content? @update.text | ||
end | ||
end | ||
end | ||
|
||
describe "ALPS single, rstat.us update show" do | ||
it "shows the status in a ul with class single" do | ||
update = Fabricate(:update) | ||
|
||
visit "/updates/#{update.id}" | ||
|
||
within "div#messages ul.single li.message" do | ||
assert has_content? update.text | ||
end | ||
end | ||
end | ||
|
||
describe "ALPS li.message descendants" do | ||
before do | ||
@a_user = Fabricate(:user) | ||
@an_update = Fabricate(:update, :author => @a_user.author) | ||
@a_user.feed.updates << @an_update | ||
|
||
visit "/" | ||
end | ||
|
||
it "has the user nickname in span.user-text" do | ||
within "li.message span.user-text" do | ||
assert has_content? @a_user.username | ||
end | ||
end | ||
|
||
it "has a link to the user's profile page in a.rel=user" do | ||
within "li.message" do | ||
assert has_selector?( | ||
:xpath, | ||
".//a[contains(@rel, 'user') and @href='#{@a_user.url}']" | ||
) | ||
end | ||
end | ||
|
||
it "has the text of the status in span.message-text" do | ||
within "li.message span.message-text" do | ||
assert has_content? @an_update.text | ||
end | ||
end | ||
|
||
it "has the permalink to the update in a.rel=message" do | ||
within "li.message" do | ||
assert has_selector?( | ||
:xpath, | ||
"//a[contains(@rel, 'message') and @href='#{@an_update.url}']" | ||
) | ||
end | ||
end | ||
|
||
it "has a gravatar in img.user-image" do | ||
within "li.message" do | ||
assert has_selector?( | ||
:xpath, | ||
"//img[contains(@class, 'user-image') and @src='#{@a_user.author.avatar_url}']" | ||
) | ||
end | ||
end | ||
|
||
it "has the update time in span.date-time" do | ||
# valid per RFC3339 | ||
within "li.message" do | ||
assert has_selector?("span.date-time") | ||
end | ||
end | ||
end | ||
end | ||
end |