don't expose follow/unfollow to a user in the UI
following is good for bookkeeping in the database, but provides confusion, and could limit likes and/or commenting to start receiving notifications in a conversation.
This commit is contained in:
parent
462959fbcd
commit
699b0cff16
9 changed files with 0 additions and 109 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 4 KiB |
|
|
@ -31,34 +31,6 @@ app.models.Post = Backbone.Model.extend(_.extend({}, app.models.formatDateMixin,
|
|||
return this.get("author")
|
||||
},
|
||||
|
||||
toggleFollow : function() {
|
||||
var userParticipation = this.get("user_participation");
|
||||
if(userParticipation) {
|
||||
this.unfollow();
|
||||
} else {
|
||||
this.follow();
|
||||
}
|
||||
},
|
||||
|
||||
follow : function() {
|
||||
var self = this;
|
||||
this.participations.create({}, {success : function(resp){
|
||||
self.set(resp)
|
||||
self.trigger('interacted', self)
|
||||
}});
|
||||
},
|
||||
|
||||
unfollow : function() {
|
||||
var self = this;
|
||||
var participationModel = new app.models.Participation(this.get("user_participation"));
|
||||
participationModel.url = this.participations.url + "/" + participationModel.id;
|
||||
|
||||
participationModel.destroy({success : function(model, resp){
|
||||
self.set(resp);
|
||||
self.trigger('interacted', this)
|
||||
}});
|
||||
},
|
||||
|
||||
toggleLike : function() {
|
||||
var userLike = this.get("user_like")
|
||||
if(userLike) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ app.views.Feedback = app.views.Base.extend({
|
|||
|
||||
events: {
|
||||
"click .like_action" : "toggleLike",
|
||||
"click .participate_action" : "toggleFollow",
|
||||
"click .reshare_action" : "resharePost"
|
||||
},
|
||||
|
||||
|
|
@ -20,11 +19,6 @@ app.views.Feedback = app.views.Base.extend({
|
|||
})
|
||||
},
|
||||
|
||||
toggleFollow : function(evt) {
|
||||
if(evt) { evt.preventDefault(); }
|
||||
this.model.toggleFollow();
|
||||
},
|
||||
|
||||
toggleLike: function(evt) {
|
||||
if(evt) { evt.preventDefault(); }
|
||||
this.model.toggleLike();
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ app.views.PostViewerFeedback = app.views.Feedback.extend({
|
|||
"click *[rel='auth-required']" : "requireAuth",
|
||||
|
||||
"click .like" : "toggleLike",
|
||||
"click .follow" : "toggleFollow",
|
||||
"click .reshare" : "resharePost",
|
||||
|
||||
"click *[rel='invoke-interaction-pane']" : "invokePane",
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ a { color : rgb(42,156,235) }
|
|||
|
||||
/* bootstrap extentions */
|
||||
.icon-red { background-image: image_url("img/glyphicons-halflings-red.png"); }
|
||||
.icon-green { background-image: image_url("img/glyphicons-halflings-green.png"); }
|
||||
.icon-blue { background-image: image_url("img/glyphicons-halflings-blue.png"); }
|
||||
|
||||
@media (max-width: 770px) { //why is 770 a magic number?
|
||||
|
|
|
|||
|
|
@ -13,14 +13,6 @@
|
|||
–
|
||||
</span>
|
||||
|
||||
<a href="#" class="participate_action" rel='nofollow'>
|
||||
{{#if user_participation}}
|
||||
{{t "stream.unfollow"}}
|
||||
{{else}}
|
||||
{{t "stream.follow"}}
|
||||
{{/if}}
|
||||
</a>
|
||||
·
|
||||
|
||||
<a href="#" class="like_action" rel='nofollow'>
|
||||
{{#if user_like}}
|
||||
|
|
|
|||
|
|
@ -7,15 +7,6 @@
|
|||
{{likes_count}}
|
||||
</a>
|
||||
|
||||
<a href="#" rel="auth-required" class="label follow" title="{{#if user_participation}} {{t "viewer.stop_following_post"}} {{else}} {{t "viewer.follow_post"}} {{/if}}">
|
||||
{{#if user_participation}}
|
||||
<i class="icon-plus icon-green"></i>
|
||||
{{else}}
|
||||
<i class="icon-plus icon-white"></i>
|
||||
{{/if}}
|
||||
{{participations_count}}
|
||||
</a>
|
||||
|
||||
{{#if userCanReshare}}
|
||||
<a href="#" rel="auth-required" class="label reshare" title="{{#if user_reshare}} {{t "viewer.reshared"}} {{else}} {{t "viewer.reshare"}} {{/if}}">
|
||||
{{#if user_reshare}}
|
||||
|
|
|
|||
|
|
@ -15,23 +15,6 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{# if participations}}
|
||||
<div id="post-follows">
|
||||
<div class="well media">
|
||||
<div class="img">
|
||||
<i class="icon-plus icon-green"></i>
|
||||
</div>
|
||||
<div class="bd">
|
||||
{{#each participations}}
|
||||
{{#linkToPerson author}}
|
||||
{{{personImage this "small" "micro"}}}
|
||||
{{/linkToPerson}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{# if reshares}}
|
||||
<div id="post-reshares">
|
||||
<div class="well media">
|
||||
|
|
|
|||
|
|
@ -75,43 +75,4 @@ describe("app.models.Post", function() {
|
|||
expect(app.models.Like.prototype.destroy).toHaveBeenCalled();
|
||||
})
|
||||
})
|
||||
|
||||
describe("toggleFollow", function(){
|
||||
it("calls unfollow when the user_participation exists", function(){
|
||||
this.post.set({user_participation: "123"});
|
||||
spyOn(this.post, "unfollow").andReturn(true);
|
||||
|
||||
this.post.toggleFollow();
|
||||
expect(this.post.unfollow).toHaveBeenCalled();
|
||||
})
|
||||
|
||||
it("calls follow when the user_participation does not exist", function(){
|
||||
this.post.set({user_participation: null});
|
||||
spyOn(this.post, "follow").andReturn(true);
|
||||
|
||||
this.post.toggleFollow();
|
||||
expect(this.post.follow).toHaveBeenCalled();
|
||||
})
|
||||
})
|
||||
|
||||
describe("follow", function(){
|
||||
it("calls create on the participations collection", function(){
|
||||
spyOn(this.post.participations, "create");
|
||||
|
||||
this.post.follow();
|
||||
expect(this.post.participations.create).toHaveBeenCalled();
|
||||
})
|
||||
})
|
||||
|
||||
describe("unfollow", function(){
|
||||
it("calls destroy on the participations collection", function(){
|
||||
var participation = new app.models.Participation();
|
||||
this.post.set({user_participation : participation.toJSON()})
|
||||
|
||||
spyOn(app.models.Participation.prototype, "destroy");
|
||||
|
||||
this.post.unfollow();
|
||||
expect(app.models.Participation.prototype.destroy).toHaveBeenCalled();
|
||||
})
|
||||
})
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue