mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 09:42:36 +02:00
Merge branch 'master' into supporter_plan_display_after_signup
This commit is contained in:
commit
8fba5e7a9b
10 changed files with 55 additions and 9 deletions
|
@ -12,7 +12,7 @@ def browse_sites_dataset
|
||||||
@current_page = @current_page.to_i
|
@current_page = @current_page.to_i
|
||||||
@current_page = 1 if @current_page == 0
|
@current_page = 1 if @current_page == 0
|
||||||
|
|
||||||
site_dataset = Site.filter(is_banned: false, is_crashing: false).filter(site_changed: true)
|
site_dataset = Site.filter(is_deleted: false, is_banned: false, is_crashing: false).filter(site_changed: true)
|
||||||
|
|
||||||
if current_site
|
if current_site
|
||||||
if !current_site.blocking_site_ids.empty?
|
if !current_site.blocking_site_ids.empty?
|
||||||
|
|
|
@ -6,7 +6,8 @@ end
|
||||||
|
|
||||||
get '/site/:username/?' do |username|
|
get '/site/:username/?' do |username|
|
||||||
site = Site[username: username]
|
site = Site[username: username]
|
||||||
not_found if site.nil? || site.is_banned
|
# TODO: There should probably be a "this site was deleted" page.
|
||||||
|
not_found if site.nil? || site.is_banned || site.is_deleted
|
||||||
|
|
||||||
@title = site.title
|
@title = site.title
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,8 @@ module Sequel
|
||||||
# so this adds the filter for the first time the class' dataset is accessed for the new model.
|
# so this adds the filter for the first time the class' dataset is accessed for the new model.
|
||||||
def dataset
|
def dataset
|
||||||
if @_is_deleted_filter_set.nil?
|
if @_is_deleted_filter_set.nil?
|
||||||
@dataset.filter! is_deleted: false
|
#KD: I turned this off because I think it's easier to do this manually.
|
||||||
|
#@dataset.filter! is_deleted: false
|
||||||
@_is_deleted_filter_set = true
|
@_is_deleted_filter_set = true
|
||||||
end
|
end
|
||||||
super
|
super
|
||||||
|
|
|
@ -220,6 +220,7 @@ class Site < Sequel::Model
|
||||||
site = get_with_identifier username_or_email
|
site = get_with_identifier username_or_email
|
||||||
|
|
||||||
return false if site.nil?
|
return false if site.nil?
|
||||||
|
return false if site.is_deleted
|
||||||
site.valid_password? plaintext
|
site.valid_password? plaintext
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -385,6 +386,8 @@ class Site < Sequel::Model
|
||||||
|
|
||||||
FileUtils.mv files_path, File.join(DELETED_SITES_ROOT, username)
|
FileUtils.mv files_path, File.join(DELETED_SITES_ROOT, username)
|
||||||
remove_all_tags
|
remove_all_tags
|
||||||
|
#remove_all_events
|
||||||
|
#Event.where(actioning_site_id: id).destroy
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -542,6 +545,7 @@ class Site < Sequel::Model
|
||||||
matches = f.grep SPAM_MATCH_REGEX
|
matches = f.grep SPAM_MATCH_REGEX
|
||||||
|
|
||||||
if !matches.empty?
|
if !matches.empty?
|
||||||
|
=begin
|
||||||
EmailWorker.perform_async({
|
EmailWorker.perform_async({
|
||||||
from: 'web@neocities.org',
|
from: 'web@neocities.org',
|
||||||
reply_to: email,
|
reply_to: email,
|
||||||
|
@ -552,6 +556,7 @@ class Site < Sequel::Model
|
||||||
https://#{self.host}/#{relative_path}
|
https://#{self.host}/#{relative_path}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
=end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -656,6 +661,11 @@ class Site < Sequel::Model
|
||||||
begin
|
begin
|
||||||
FileUtils.rm files_path(path)
|
FileUtils.rm files_path(path)
|
||||||
rescue Errno::EISDIR
|
rescue Errno::EISDIR
|
||||||
|
site_files.each do |site_file|
|
||||||
|
if site_file.path.match /^#{path}\//
|
||||||
|
site_file.destroy
|
||||||
|
end
|
||||||
|
end
|
||||||
FileUtils.remove_dir files_path(path), true
|
FileUtils.remove_dir files_path(path), true
|
||||||
rescue Errno::ENOENT
|
rescue Errno::ENOENT
|
||||||
end
|
end
|
||||||
|
|
|
@ -253,6 +253,7 @@
|
||||||
font-size: 9px;
|
font-size: 9px;
|
||||||
position: relative;
|
position: relative;
|
||||||
color: rgba(255, 255, 255, 0.4);
|
color: rgba(255, 255, 255, 0.4);
|
||||||
|
display: inline-block;
|
||||||
|
|
||||||
>.fa-heart {
|
>.fa-heart {
|
||||||
display:none;
|
display:none;
|
||||||
|
|
|
@ -1497,6 +1497,7 @@ a.tag:hover {
|
||||||
color: #e93250;
|
color: #e93250;
|
||||||
vertical-align: .45em;
|
vertical-align: .45em;
|
||||||
margin-left: -.15em;
|
margin-left: -.15em;
|
||||||
|
display: inline;
|
||||||
}
|
}
|
||||||
.fa-user {
|
.fa-user {
|
||||||
margin-right: 0.25em;
|
margin-right: 0.25em;
|
||||||
|
|
|
@ -29,7 +29,10 @@
|
||||||
.username {
|
.username {
|
||||||
float: left;
|
float: left;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
width: 63%;
|
width: 63%;
|
||||||
|
height: 1.3em;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
.site-stats {
|
.site-stats {
|
||||||
float: right;
|
float: right;
|
||||||
|
@ -42,6 +45,9 @@
|
||||||
height: 1.4em;
|
height: 1.4em;
|
||||||
float: left;
|
float: left;
|
||||||
margin-top: -4px;
|
margin-top: -4px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
.site-tags .fa-tag {
|
.site-tags .fa-tag {
|
||||||
vertical-align: -2px;
|
vertical-align: -2px;
|
||||||
|
@ -54,6 +60,12 @@
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
margin-bottom: 2px;
|
margin-bottom: 2px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
a {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
width: 100%;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.int-Gall{
|
&.int-Gall{
|
||||||
|
@ -70,7 +82,8 @@
|
||||||
width:32%
|
width:32%
|
||||||
}
|
}
|
||||||
@media (max-device-width:480px), screen and (max-width:800px){
|
@media (max-device-width:480px), screen and (max-width:800px){
|
||||||
width:49%
|
width:48%;
|
||||||
|
margin:0 1% 12px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&.suggestions {
|
&.suggestions {
|
||||||
|
@ -86,6 +99,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-device-width:480px), screen and (max-width:800px){
|
||||||
|
padding: 4% 2%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin {
|
.admin {
|
||||||
|
|
|
@ -21,7 +21,7 @@ describe '/' do
|
||||||
@another_site = Fabricate :site
|
@another_site = Fabricate :site
|
||||||
@followed_site.toggle_follow @another_site
|
@followed_site.toggle_follow @another_site
|
||||||
visit '/'
|
visit '/'
|
||||||
find('.news-item', match: :first).text.must_match /#{@followed_site.username} followed #{@another_site.username}/i
|
find('.news-item', match: :first).text.must_match /#{@followed_site.username} started following the site of #{@another_site.username}/i
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'loads my activities only' do
|
it 'loads my activities only' do
|
||||||
|
@ -37,7 +37,7 @@ describe '/' do
|
||||||
@followed_site = Fabricate :site
|
@followed_site = Fabricate :site
|
||||||
@site.toggle_follow @followed_site
|
@site.toggle_follow @followed_site
|
||||||
visit "/?event_id=#{@followed_site.events.first.id}"
|
visit "/?event_id=#{@followed_site.events.first.id}"
|
||||||
find('.news-item').text.must_match /you followed #{@followed_site.username}/i
|
find('.news-item').text.must_match /you started following the site of #{@followed_site.username}/i
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -63,4 +63,4 @@ describe '/' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,6 +31,20 @@ describe 'site_files' do
|
||||||
File.exists?(file_path).must_equal false
|
File.exists?(file_path).must_equal false
|
||||||
SiteFile[site_id: @site.id, path: 'test.jpg'].must_be_nil
|
SiteFile[site_id: @site.id, path: 'test.jpg'].must_be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'deletes all files in a directory' do
|
||||||
|
upload(
|
||||||
|
'dir' => 'test',
|
||||||
|
'files[]' => Rack::Test::UploadedFile.new('./tests/files/test.jpg', 'image/jpeg')
|
||||||
|
)
|
||||||
|
upload(
|
||||||
|
'dir' => '',
|
||||||
|
'files[]' => Rack::Test::UploadedFile.new('./tests/files/test.jpg', 'image/jpeg')
|
||||||
|
)
|
||||||
|
delete_file filename: 'test'
|
||||||
|
@site.site_files.select {|f| f.path =~ /^test\//}.length.must_equal 0
|
||||||
|
@site.site_files.select {|f| f.path =~ /^test/}.length.must_equal 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'upload' do
|
describe 'upload' do
|
||||||
|
@ -161,4 +175,4 @@ describe 'site_files' do
|
||||||
@site.reload.changed_count.must_equal 2
|
@site.reload.changed_count.must_equal 2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,11 +27,12 @@
|
||||||
<a href="/site/<%= actioning_site.username %>" class="user" title="<%= actioning_site.title %>"><i class="fa fa-user"><% if actioning_site.supporter? %><i class="fa fa-heart"></i><% end %></i><%= actioning_site.username %></a>
|
<a href="/site/<%= actioning_site.username %>" class="user" title="<%= actioning_site.title %>"><i class="fa fa-user"><% if actioning_site.supporter? %><i class="fa fa-heart"></i><% end %></i><%= actioning_site.username %></a>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
followed
|
started following
|
||||||
|
|
||||||
<% if current_site && event_site.id == current_site.id %>
|
<% if current_site && event_site.id == current_site.id %>
|
||||||
<a href="/site/<%= current_site.username %>" class="you">you</a>
|
<a href="/site/<%= current_site.username %>" class="you">you</a>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
the <a class="user" href="http://<%= event_site.host %>" title="<%= event_site.title %>">site</a> of
|
||||||
<a href="/site/<%= event_site.username %>" class="user" title="<%= event_site.title %>"><i class="fa fa-user"><% if event_site.supporter? %><i class="fa fa-heart"></i><% end %></i><%= event_site.username %></a>
|
<a href="/site/<%= event_site.username %>" class="user" title="<%= event_site.title %>"><i class="fa fa-user"><% if event_site.supporter? %><i class="fa fa-heart"></i><% end %></i><%= event_site.username %></a>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue