Allow to tag reviews
In order to be able to filter out non-human comments and votes we need to tag them. This change introduces new property to the ReviewInput object called 'tag'. This allows us to add some meta information about where this vote come from. Then in the UI we can show/hide comments and votes that have different tags. Also ApprovalInfo, CommentInfo and ChangeMessageInfo were extended to include value of 'tag' property read from DB. To be able to persist those data new column (tag) was introduced to change_messages, patch_set_comments and patch_set_approvals tables. Change-Id: If6378c5a9f4e0673c00ab348297549f27a06110b Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
This commit is contained in:
committed by
Dave Borowitz
parent
b50cd86eff
commit
c70e862596
@@ -74,6 +74,10 @@ public final class ChangeMessage {
|
||||
@Column(id = 5, notNull = false)
|
||||
protected PatchSet.Id patchset;
|
||||
|
||||
/** Tag associated with change message */
|
||||
@Column(id = 6, notNull = false)
|
||||
protected String tag;
|
||||
|
||||
protected ChangeMessage() {
|
||||
}
|
||||
|
||||
@@ -117,6 +121,14 @@ public final class ChangeMessage {
|
||||
message = s;
|
||||
}
|
||||
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
public void setTag(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public PatchSet.Id getPatchSetId() {
|
||||
return patchset;
|
||||
}
|
||||
@@ -132,6 +144,7 @@ public final class ChangeMessage {
|
||||
+ ", author=" + author
|
||||
+ ", writtenOn=" + writtenOn
|
||||
+ ", patchset=" + patchset
|
||||
+ ", tag=" + tag
|
||||
+ ", message=[" + message
|
||||
+ "]}";
|
||||
}
|
||||
|
||||
@@ -122,6 +122,9 @@ public final class PatchLineComment {
|
||||
@Column(id = 9, notNull = false)
|
||||
protected CommentRange range;
|
||||
|
||||
@Column(id = 10, notNull = false)
|
||||
protected String tag;
|
||||
|
||||
/**
|
||||
* The RevId for the commit to which this comment is referring.
|
||||
*
|
||||
@@ -249,6 +252,14 @@ public final class PatchLineComment {
|
||||
return revId;
|
||||
}
|
||||
|
||||
public void setTag(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o instanceof PatchLineComment) {
|
||||
@@ -262,7 +273,8 @@ public final class PatchLineComment {
|
||||
&& Objects.equals(message, c.getMessage())
|
||||
&& Objects.equals(parentUuid, c.getParentUuid())
|
||||
&& Objects.equals(range, c.getRange())
|
||||
&& Objects.equals(revId, c.getRevId());
|
||||
&& Objects.equals(revId, c.getRevId())
|
||||
&& Objects.equals(tag, c.getTag());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -289,6 +301,7 @@ public final class PatchLineComment {
|
||||
builder.append("range=").append(Objects.toString(range, ""))
|
||||
.append(',');
|
||||
builder.append("revId=").append(revId != null ? revId.get() : "");
|
||||
builder.append("tag=").append(Objects.toString(tag, ""));
|
||||
builder.append('}');
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
@@ -90,6 +90,9 @@ public final class PatchSetApproval {
|
||||
@Column(id = 3)
|
||||
protected Timestamp granted;
|
||||
|
||||
@Column(id = 6, notNull = false)
|
||||
protected String tag;
|
||||
|
||||
// DELETED: id = 4 (changeOpen)
|
||||
// DELETED: id = 5 (changeSortKey)
|
||||
|
||||
@@ -145,6 +148,10 @@ public final class PatchSetApproval {
|
||||
}
|
||||
}
|
||||
|
||||
public void setTag(String t) {
|
||||
tag = t;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return getLabelId().get();
|
||||
}
|
||||
@@ -153,10 +160,14 @@ public final class PatchSetApproval {
|
||||
return LabelId.LEGACY_SUBMIT_NAME.equals(getLabel());
|
||||
}
|
||||
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new StringBuilder().append('[').append(key).append(": ")
|
||||
.append(value).append(']').toString();
|
||||
.append(value).append(",tag:").append(tag).append(']').toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -165,13 +176,14 @@ public final class PatchSetApproval {
|
||||
PatchSetApproval p = (PatchSetApproval) o;
|
||||
return Objects.equals(key, p.key)
|
||||
&& Objects.equals(value, p.value)
|
||||
&& Objects.equals(granted, p.granted);
|
||||
&& Objects.equals(granted, p.granted)
|
||||
&& Objects.equals(tag, p.tag);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(key, value, granted);
|
||||
return Objects.hash(key, value, granted, tag);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user