From f679b4e1cf66d22c4f4601a88a87d80b5fbbce9d Mon Sep 17 00:00:00 2001 From: nixzhu Date: Thu, 10 Dec 2015 15:05:07 +0800 Subject: [PATCH] fix logic of can report in Feeds --- .../Feeds/FeedsViewController.swift | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Yep/ViewControllers/Feeds/FeedsViewController.swift b/Yep/ViewControllers/Feeds/FeedsViewController.swift index c989efc6..706d0eac 100644 --- a/Yep/ViewControllers/Feeds/FeedsViewController.swift +++ b/Yep/ViewControllers/Feeds/FeedsViewController.swift @@ -1078,13 +1078,22 @@ extension FeedsViewController: UITableViewDataSource, UITableViewDelegate { func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool { - let feed = feeds[indexPath.item] + switch indexPath.section { - if feed.creator.id == YepUserDefaults.userID.value { + case Section.SkillUsers.rawValue: + return false + + case Section.Feed.rawValue: + let feed = feeds[indexPath.item] + if feed.creator.id == YepUserDefaults.userID.value { + return false + } else { + return true + } + + default: return false } - - return true } func tableView(tableView: UITableView, titleForDeleteConfirmationButtonForRowAtIndexPath indexPath: NSIndexPath) -> String? {