Skip to content

Commit

Permalink
If a user declines a feed invitation, they can be invited again
Browse files Browse the repository at this point in the history
Fixes CV2-3802.
  • Loading branch information
caiosba authored Nov 24, 2023
1 parent 4ad2855 commit 3b2bb35
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/models/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def editor_perms
obj.annotation.team&.id == @context_team.id
end
can [:create, :update, :read, :destroy], [Account, Source, TiplineNewsletter, TiplineResource, Feed, FeedTeam], :team_id => @context_team.id
can [:create, :update, :destroy], FeedInvitation, { feed: { team_id: @context_team.id } }
can [:create, :update], FeedInvitation, { feed: { team_id: @context_team.id } }
can :destroy, FeedTeam do |obj|
obj.team.id == @context_team.id || obj.feed.team.id == @context_team.id
end
Expand Down
3 changes: 2 additions & 1 deletion app/models/feed_invitation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def accept!(team_id)
end

def reject!
self.update_column(:state, :rejected)
# self.update_column(:state, :rejected)
self.destroy!
end

private
Expand Down
4 changes: 2 additions & 2 deletions lib/check_basic_abilities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ def extra_perms_for_all_users
!(@user.cached_teams & obj.feed.team_ids).empty?
end

can :read, FeedInvitation do |obj|
@user.email == obj.email || @user.id == obj.user_id
can [:read, :destroy], FeedInvitation do |obj|
@user.email == obj.email || @user.id == obj.user_id || TeamUser.where(user_id: @user.id, team_id: obj.feed.team_id, role: 'admin').exists?
end
end

Expand Down

0 comments on commit 3b2bb35

Please sign in to comment.