From c94ba63328809668b98cc5b71c1ceea3f10cbba5 Mon Sep 17 00:00:00 2001 From: Mohsin Sheikh Date: Thu, 19 Aug 2021 19:48:09 +0500 Subject: [PATCH 1/2] Changed author field to RedditorRef --- lib/src/models/comment_impl.dart | 3 --- lib/src/models/mixins/voteable.dart | 6 +++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/src/models/comment_impl.dart b/lib/src/models/comment_impl.dart index ab75cae..0246628 100644 --- a/lib/src/models/comment_impl.dart +++ b/lib/src/models/comment_impl.dart @@ -259,9 +259,6 @@ class Comment extends CommentRef /// Is this [Comment] archived. bool get archived => data!['archived']; - // TODO(bkonyi): update this definition. - // RedditorRef get author => reddit.redditor(data['author']); - /// The author's flair text, if set. /// /// Returns `null` if the author does not have any flair text set. diff --git a/lib/src/models/mixins/voteable.dart b/lib/src/models/mixins/voteable.dart index e421b02..25beba5 100644 --- a/lib/src/models/mixins/voteable.dart +++ b/lib/src/models/mixins/voteable.dart @@ -7,6 +7,7 @@ import 'dart:async'; import 'package:draw/src/api_paths.dart'; import 'package:draw/src/base.dart'; +import 'package:draw/src/models/redditor.dart'; enum VoteState { none, @@ -28,7 +29,10 @@ int _voteStateToIndex(VoteState vote) { /// A mixin which provides voting functionality for [Comment] and [Submission]. mixin VoteableMixin implements RedditBaseInitializedMixin { /// The author of the item. - String get author => data!['author']; + // String get author => data!['author']; + + /// Returns the [Redditor] associated with this item. + RedditorRef get author => RedditorRef.name(reddit, data!['author']); /// The body of the item. /// From 961ce15f793a4e5db5c9733b28958fa49a92dba7 Mon Sep 17 00:00:00 2001 From: Mohsin Sheikh <29257166+SupremeDeity@users.noreply.github.com> Date: Thu, 19 Aug 2021 21:26:58 +0500 Subject: [PATCH 2/2] re-added author field and field name changes --- lib/src/models/mixins/voteable.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/src/models/mixins/voteable.dart b/lib/src/models/mixins/voteable.dart index 25beba5..0fe3bbd 100644 --- a/lib/src/models/mixins/voteable.dart +++ b/lib/src/models/mixins/voteable.dart @@ -28,11 +28,12 @@ int _voteStateToIndex(VoteState vote) { /// A mixin which provides voting functionality for [Comment] and [Submission]. mixin VoteableMixin implements RedditBaseInitializedMixin { - /// The author of the item. - // String get author => data!['author']; + + /// The name of the author associated with this item. + String get author => data!['author']; /// Returns the [Redditor] associated with this item. - RedditorRef get author => RedditorRef.name(reddit, data!['author']); + RedditorRef get redditor => RedditorRef.name(reddit, data!['author']); /// The body of the item. ///