MDL-63692 message: Resolve bad merge conflict
authorAndrew Nicols <andrew@nicols.co.uk>
Tue, 20 Nov 2018 01:02:16 +0000 (09:02 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Tue, 20 Nov 2018 01:04:53 +0000 (09:04 +0800)
message/classes/api.php

index 3545f46..68e290b 100644 (file)
@@ -944,7 +944,12 @@ class api {
         }
 
         $ufservice = \core_favourites\service_factory::get_service_for_user_context($userctx);
-        return $ufservice->create_favourite('core_message', 'message_conversations', $conversationid, $conversationctx);
+
+        if ($favourite = $ufservice->get_favourite('core_message', 'message_conversations', $conversationid, $conversationctx)) {
+            return $favourite;
+        } else {
+            return $ufservice->create_favourite('core_message', 'message_conversations', $conversationid, $conversationctx);
+        }
     }
 
     /**