Merge pull request #5131 from wegotcoders/3801_delete_own_photos
3801 delete own photos
This commit is contained in:
commit
c4970b485f
11 changed files with 86 additions and 15 deletions
|
|
@ -34,6 +34,7 @@
|
|||
* Expose which services are configured in /statistics.json [#5121](https://github.com/diaspora/diaspora/pull/5121)
|
||||
* In filtered notification views, replace "Mark all as read" with "Mark shown as read" [#5122](https://github.com/diaspora/diaspora/pull/5122)
|
||||
* When ignoring a user remove his posts from the stream instantly [#5127](https://github.com/diaspora/diaspora/pull/5127)
|
||||
* Allow to delete photos from the pictures stream [#5131](https://github.com/diaspora/diaspora/pull/5131)
|
||||
|
||||
# 0.4.0.1
|
||||
|
||||
|
|
|
|||
|
|
@ -15,5 +15,9 @@ app.models.User = Backbone.Model.extend({
|
|||
|
||||
isServiceConfigured : function(providerName) {
|
||||
return _.include(this.get("configured_services"), providerName)
|
||||
},
|
||||
|
||||
isAuthorOf: function(model) {
|
||||
return this.authenticated() && model.get("author").id == this.id;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,10 +4,21 @@ app.views.Photo = app.views.Base.extend({
|
|||
|
||||
className : "photo loaded",
|
||||
|
||||
events: {
|
||||
"click .remove_post": "destroyModel"
|
||||
},
|
||||
|
||||
tooltipSelector : ".block_user, .delete",
|
||||
|
||||
initialize : function() {
|
||||
$(this.el).attr("id", this.model.get("guid"));
|
||||
this.model.bind('remove', this.remove, this);
|
||||
return this;
|
||||
}
|
||||
},
|
||||
|
||||
presenter : function() {
|
||||
return _.extend(this.defaultPresenter(), {
|
||||
authorIsCurrentUser : app.currentUser.isAuthorOf(this.model),
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -1,16 +1,12 @@
|
|||
app.views.Post = app.views.Base.extend({
|
||||
presenter : function() {
|
||||
return _.extend(this.defaultPresenter(), {
|
||||
authorIsCurrentUser : this.authorIsCurrentUser(),
|
||||
authorIsCurrentUser : app.currentUser.isAuthorOf(this.model),
|
||||
showPost : this.showPost(),
|
||||
text : app.helpers.textFormatter(this.model.get("text"), this.model)
|
||||
})
|
||||
},
|
||||
|
||||
authorIsCurrentUser : function() {
|
||||
return app.currentUser.authenticated() && this.model.get("author").id == app.user().id
|
||||
},
|
||||
|
||||
showPost : function() {
|
||||
return (app.currentUser.get("showNsfw")) || !this.model.get("nsfw")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,16 +25,12 @@ app.views.SinglePostContent = app.views.Base.extend({
|
|||
|
||||
presenter : function() {
|
||||
return _.extend(this.defaultPresenter(), {
|
||||
authorIsCurrentUser : this.authorIsCurrentUser(),
|
||||
authorIsCurrentUser :app.currentUser.isAuthorOf(this.model),
|
||||
showPost : this.showPost(),
|
||||
text : app.helpers.textFormatter(this.model.get("text"), this.model)
|
||||
})
|
||||
},
|
||||
|
||||
authorIsCurrentUser : function() {
|
||||
return app.currentUser.authenticated() && this.model.get("author").id == app.user().id
|
||||
},
|
||||
|
||||
showPost : function() {
|
||||
return (app.currentUser.get("showNsfw")) || !this.model.get("nsfw")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
@import 'report'
|
||||
@import 'new_styles/_forms'
|
||||
@import 'tag'
|
||||
@import 'photo'
|
||||
|
||||
/* ====== media ====== */
|
||||
.media
|
||||
|
|
|
|||
19
app/assets/stylesheets/photo.css.scss
Normal file
19
app/assets/stylesheets/photo.css.scss
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
.photo {
|
||||
.controls:first-child {
|
||||
.control_icon {
|
||||
@include transition(opacity);
|
||||
@include opacity(0);
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.controls:first-child {
|
||||
.control_icon {
|
||||
@include opacity(0.3);
|
||||
}
|
||||
.control_icon:hover {
|
||||
@include opacity(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +1,29 @@
|
|||
<div class="media">
|
||||
<div class="bd">
|
||||
{{#if loggedIn}}
|
||||
<div class="controls">
|
||||
{{#unless authorIsCurrentUser}}
|
||||
<a href="#" rel="nofollow" data-type="post" class="post_report" title="{{t "report.name"}}">
|
||||
<div class="icons-report control_icon"/>
|
||||
</a>
|
||||
<a href="#" rel="nofollow" class="block_user" title="{{t "ignore"}}">
|
||||
<div class="icons-ignoreuser control_icon"></div>
|
||||
</a>
|
||||
<a href="#" rel="nofollow" class="delete hide_post" title="{{t "stream.hide"}}">
|
||||
<div class="icons-deletelabel delete control_icon"/>
|
||||
</a>
|
||||
{{else}}
|
||||
<a href="#" rel="nofollow" class="delete remove_post" title="{{t "delete"}}">
|
||||
<div class="icons-deletelabel delete control_icon"/>
|
||||
</a>
|
||||
{{/unless}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<a href="#" class="photo-link">
|
||||
<img src="{{sizes.large}}" class="photo big_photo" data-small-photo="{{sizes.small}}" data-full-photo="{{sizes.large}}" rel="lightbox">
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
|
@ -23,3 +23,12 @@ Feature: show photos
|
|||
When I sign in as "alice@alice.alice"
|
||||
And I am on "robert@grimm.grimm"'s page
|
||||
Then I should not see "photos" within "div#profile"
|
||||
|
||||
|
||||
Scenario: I delete a photo
|
||||
Given I am on "robert@grimm.grimm"'s photos page
|
||||
When I delete a photo
|
||||
And I confirm the alert
|
||||
Then I should not see "photos" within "div#profile"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,3 +6,8 @@ And /^I mark myself as safe for work$/ do
|
|||
uncheck('profile[nsfw]')
|
||||
end
|
||||
|
||||
When(/^I delete a photo$/) do
|
||||
find('.photo.loaded').hover
|
||||
find('.delete', :match => :first).click
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ module NavigationHelpers
|
|||
# '.diaspora_handle' on desktop, '.description' on mobile
|
||||
special_elem: { selector: '.diaspora_handle, .description', text: p.diaspora_handle }
|
||||
}
|
||||
when /^"([^\"]*)"'s photos page$/
|
||||
p = User.find_by_email($1).person
|
||||
person_photos_path p
|
||||
when /^my account settings page$/
|
||||
edit_user_path
|
||||
when /^my new profile page$/
|
||||
|
|
|
|||
Loading…
Reference in a new issue